From f63765b9f7a089eb0f2a62d53f5ad1d56961fa1f Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 19 Sep 2022 17:08:04 +0200 Subject: wallet-core: fix tipping with age restricted denoms --- .../taler-wallet-core/src/crypto/cryptoImplementation.ts | 12 ++++++++++-- packages/taler-wallet-core/src/crypto/cryptoTypes.ts | 1 + packages/taler-wallet-core/src/operations/tip.ts | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'packages/taler-wallet-core/src') diff --git a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts index c21ee99e8..bfc48d961 100644 --- a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts +++ b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts @@ -743,9 +743,16 @@ export const nativeCryptoR: TalerCryptoInterfaceR = { if (req.denomPub.cipher !== DenomKeyType.Rsa) { throw Error(`unsupported cipher (${req.denomPub.cipher})`); } - const fc = setupTipPlanchet(decodeCrock(req.secretSeed), req.planchetIndex); + const fc = await setupTipPlanchet( + decodeCrock(req.secretSeed), + req.denomPub, + req.planchetIndex, + ); + const maybeAch = fc.ageCommitmentProof + ? AgeRestriction.hashCommitment(fc.ageCommitmentProof.commitment) + : undefined; const denomPub = decodeCrock(req.denomPub.rsa_public_key); - const coinPubHash = hash(fc.coinPub); + const coinPubHash = hashCoinPub(encodeCrock(fc.coinPub), maybeAch); const blindResp = await tci.rsaBlind(tci, { bks: encodeCrock(fc.bks), hm: encodeCrock(coinPubHash), @@ -763,6 +770,7 @@ export const nativeCryptoR: TalerCryptoInterfaceR = { ), coinPriv: encodeCrock(fc.coinPriv), coinPub: encodeCrock(fc.coinPub), + ageCommitmentProof: fc.ageCommitmentProof, }; return tipPlanchet; }, diff --git a/packages/taler-wallet-core/src/crypto/cryptoTypes.ts b/packages/taler-wallet-core/src/crypto/cryptoTypes.ts index 4c75aa91e..0858cffa9 100644 --- a/packages/taler-wallet-core/src/crypto/cryptoTypes.ts +++ b/packages/taler-wallet-core/src/crypto/cryptoTypes.ts @@ -122,6 +122,7 @@ export interface DerivedTipPlanchet { coinEvHash: string; coinPriv: string; coinPub: string; + ageCommitmentProof: AgeCommitmentProof | undefined; } export interface SignTrackTransactionRequest { diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts index 571721658..a0fd8d328 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -319,6 +319,7 @@ export async function processTip( status: CoinStatus.Fresh, coinEvHash: planchet.coinEvHash, maxAge: AgeRestriction.AGE_UNRESTRICTED, + ageCommitmentProof: planchet.ageCommitmentProof, }); } -- cgit v1.2.3