wallet-core: fix format of purse deposits

This commit is contained in:
Florian Dold 2022-09-05 13:26:09 +02:00
parent 300242637f
commit 27fb2d2970
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 12 additions and 4 deletions

View File

@ -1813,11 +1813,14 @@ export interface PurseDeposit {
ub_sig: UnblindedSignature; ub_sig: UnblindedSignature;
/** /**
* Age commitment hash for the coin, if the denomination is age-restricted. * Age commitment for the coin, if the denomination is age-restricted.
*/ */
h_age_commitment?: HashCodeString; age_commitment?: string[];
// FIXME-Oec: proof of age is missing. /**
* Attestation for the minimum age, if the denomination is age-restricted.
*/
attest?: string;
/** /**
* Signature over TALER_PurseDepositSignaturePS * Signature over TALER_PurseDepositSignaturePS

View File

@ -1362,12 +1362,15 @@ export const nativeCryptoR: TalerCryptoInterfaceR = {
const hExchangeBaseUrl = hash(stringToBytes(req.exchangeBaseUrl + "\0")); const hExchangeBaseUrl = hash(stringToBytes(req.exchangeBaseUrl + "\0"));
const deposits: PurseDeposit[] = []; const deposits: PurseDeposit[] = [];
for (const c of req.coins) { for (const c of req.coins) {
let haveAch: boolean;
let maybeAch: Uint8Array; let maybeAch: Uint8Array;
if (c.ageCommitmentProof) { if (c.ageCommitmentProof) {
haveAch = true;
maybeAch = decodeCrock( maybeAch = decodeCrock(
AgeRestriction.hashCommitment(c.ageCommitmentProof.commitment), AgeRestriction.hashCommitment(c.ageCommitmentProof.commitment),
); );
} else { } else {
haveAch = false;
maybeAch = new Uint8Array(32); maybeAch = new Uint8Array(32);
} }
const sigBlob = buildSigPS(TalerSignaturePurpose.WALLET_PURSE_DEPOSIT) const sigBlob = buildSigPS(TalerSignaturePurpose.WALLET_PURSE_DEPOSIT)
@ -1387,7 +1390,9 @@ export const nativeCryptoR: TalerCryptoInterfaceR = {
coin_sig: sigResp.sig, coin_sig: sigResp.sig,
denom_pub_hash: c.denomPubHash, denom_pub_hash: c.denomPubHash,
ub_sig: c.denomSig, ub_sig: c.denomSig,
h_age_commitment: undefined, age_commitment: c.ageCommitmentProof
? c.ageCommitmentProof.commitment.publicKeys
: undefined,
}); });
} }
return { return {