From aff3100d8901fe16a7e635945edfdad6f08fdf37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Thu, 21 Jul 2022 11:35:31 +0200 Subject: proper handling of coin with age restriction When a coin with age restriction is used for payment, the contract might or might not require an attestation of minimum age. When it does, we sent the signed minimum age along with the whole age commitment (array of pubkeys). Added: When the contract doesn't require a minimum age, we still sent the hash of the age commitment, as this is needed for the deposit of the coin. --- packages/taler-wallet-core/src/crypto/cryptoImplementation.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'packages/taler-wallet-core/src/crypto/cryptoImplementation.ts') diff --git a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts index c177a51dd..968abbfd9 100644 --- a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts +++ b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts @@ -1042,9 +1042,15 @@ export const nativeCryptoR: TalerCryptoInterfaceR = { cipher: DenomKeyType.Rsa, rsa_signature: depositInfo.denomSig.rsa_signature, }, - age_commitment: depositInfo.ageCommitmentProof?.commitment.publicKeys, - minimum_age_sig: minimumAgeSig, }; + + if (depositInfo.requiredMinimumAge != null) { + s.minimum_age_sig = minimumAgeSig; + s.age_commitment = depositInfo.ageCommitmentProof?.commitment.publicKeys; + } else if (depositInfo.ageCommitmentProof) { + s.h_age_commitment = hAgeCommitment; + } + return s; } else { throw Error( -- cgit v1.2.3