diff options
author | Florian Dold <florian@dold.me> | 2022-09-01 22:43:57 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-09-01 22:43:57 +0200 |
commit | 9fe0e742563a008623c10593973dfdfea5c0db90 (patch) | |
tree | 6c9edc5cbb726a324364d09ec9810be82669caef | |
parent | ec43b6a5bf4f8064aaad7fc303a10c7f585a110e (diff) |
wallet-core: fix withdrawal of age-restricted denoms without age restriction
-rw-r--r-- | packages/taler-wallet-core/src/crypto/cryptoImplementation.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts index f0a5cba2b..193712e52 100644 --- a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts +++ b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts @@ -674,16 +674,17 @@ export const nativeCryptoR: TalerCryptoInterfaceR = { let maybeAcp: AgeCommitmentProof | undefined = undefined; let maybeAgeCommitmentHash: string | undefined = undefined; - if (req.restrictAge) { - if (denomPub.age_mask === 0) { + if (req.restrictAge || denomPub.age_mask) { + if (req.restrictAge && denomPub.age_mask === 0) { throw Error( "requested age restriction for a denomination that does not support age restriction", ); } - logger.info("creating age-restricted planchet"); + const age = req.restrictAge || 32; + logger.info(`creating age-restricted planchet (age ${age})`); maybeAcp = await AgeRestriction.restrictionCommit( denomPub.age_mask, - req.restrictAge, + age, ); maybeAgeCommitmentHash = AgeRestriction.hashCommitment( maybeAcp.commitment, |