aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2022-07-21 11:35:31 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2022-07-21 11:35:31 +0200
commitaff3100d8901fe16a7e635945edfdad6f08fdf37 (patch)
tree1eafa5ab83a52ada6a9d0d92184f60643a950148
parentb8a61eb98cdb0653a49dff367428fde2ca0cf529 (diff)
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.
-rw-r--r--packages/taler-wallet-core/src/crypto/cryptoImplementation.ts10
1 files changed, 8 insertions, 2 deletions
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(