diff options
author | Florian Dold <florian@dold.me> | 2022-09-19 17:08:04 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-09-19 17:08:04 +0200 |
commit | f63765b9f7a089eb0f2a62d53f5ad1d56961fa1f (patch) | |
tree | 07bfe90b5ca4cd8a75f49e54d0d6b6cfddba5874 /packages/taler-wallet-core/src | |
parent | ffe6a9521400ceabca713c08010532ece03152a8 (diff) | |
download | wallet-core-f63765b9f7a089eb0f2a62d53f5ad1d56961fa1f.tar.xz |
wallet-core: fix tipping with age restricted denoms
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r-- | packages/taler-wallet-core/src/crypto/cryptoImplementation.ts | 12 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/crypto/cryptoTypes.ts | 1 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/tip.ts | 1 |
3 files changed, 12 insertions, 2 deletions
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, }); } |