diff options
Diffstat (limited to 'packages/taler-wallet-core/src/crypto/cryptoImplementation.ts')
-rw-r--r-- | packages/taler-wallet-core/src/crypto/cryptoImplementation.ts | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts index 624ddf1d3..c86a732d8 100644 --- a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts +++ b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts @@ -445,17 +445,19 @@ export interface SignPurseCreationRequest { minAge: number; } -export interface SignPurseDepositsRequest { - pursePub: string; - exchangeBaseUrl: string; - coins: { - coinPub: string; +export interface SpendCoinDetails { + coinPub: string; coinPriv: string; contribution: AmountString; denomPubHash: string; denomSig: UnblindedSignature; ageCommitmentProof: AgeCommitmentProof | undefined; - }[]; +} + +export interface SignPurseDepositsRequest { + pursePub: string; + exchangeBaseUrl: string; + coins: SpendCoinDetails[]; } export interface SignPurseDepositsResponse { @@ -1451,25 +1453,24 @@ export const nativeCryptoR: TalerCryptoInterfaceR = { tci: TalerCryptoInterfaceR, req: EncryptContractRequest, ): Promise<EncryptContractResponse> { - const contractKeyPair = await this.createEddsaKeypair(tci, {}); + const enc = await encryptContractForMerge( decodeCrock(req.pursePub), - decodeCrock(contractKeyPair.priv), + decodeCrock(req.contractPriv), decodeCrock(req.mergePriv), req.contractTerms, ); const sigBlob = buildSigPS(TalerSignaturePurpose.WALLET_PURSE_ECONTRACT) .put(hash(enc)) - .put(decodeCrock(contractKeyPair.pub)) + .put(decodeCrock(req.contractPub)) .build(); const sig = eddsaSign(sigBlob, decodeCrock(req.pursePriv)); return { econtract: { - contract_pub: contractKeyPair.pub, + contract_pub: req.contractPub, econtract: encodeCrock(enc), econtract_sig: encodeCrock(sig), }, - contractPriv: contractKeyPair.priv, }; }, async decryptContractForMerge( |