wallet-core: only attest age if required/possible

This commit is contained in:
Florian Dold 2022-06-01 11:54:45 +02:00
parent f9192d986f
commit d780e9b187
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -916,10 +916,12 @@ export const nativeCryptoR: TalerCryptoInterfaceR = {
);
maybeAgeCommitmentHash = ach;
hAgeCommitment = decodeCrock(ach);
minimumAgeSig = AgeRestriction.commitmentAttest(
depositInfo.ageCommitmentProof,
depositInfo.requiredMinimumAge!,
);
if (depositInfo.requiredMinimumAge != null) {
minimumAgeSig = AgeRestriction.commitmentAttest(
depositInfo.ageCommitmentProof,
depositInfo.requiredMinimumAge,
);
}
} else {
// All zeros.
hAgeCommitment = new Uint8Array(32);