diff options
author | Florian Dold <florian@dold.me> | 2021-01-18 23:35:41 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-01-18 23:35:41 +0100 |
commit | 5f3c02d31a223add55a32b20f4a289210cbb4f15 (patch) | |
tree | d91ded55692aea1294c0565328515f120559ab6a /packages/taler-wallet-core/src/crypto/workers | |
parent | f884193b1adf0861f710c6ab1bb94ea2073ade65 (diff) | |
download | wallet-core-5f3c02d31a223add55a32b20f4a289210cbb4f15.tar.xz |
implement deposits
Diffstat (limited to 'packages/taler-wallet-core/src/crypto/workers')
-rw-r--r-- | packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts | 5 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts index ef149823c..d7eddd699 100644 --- a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts +++ b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts @@ -43,6 +43,7 @@ import { DerivedTipPlanchet, DeriveRefreshSessionRequest, DeriveTipRequest, + SignTrackTransactionRequest, } from "../../types/cryptoTypes"; const logger = new Logger("cryptoApi.ts"); @@ -326,6 +327,10 @@ export class CryptoApi { return this.doRpc<DerivedTipPlanchet>("createTipPlanchet", 1, req); } + signTrackTransaction(req: SignTrackTransactionRequest): Promise<string> { + return this.doRpc<string>("signTrackTransaction", 1, req); + } + hashString(str: string): Promise<string> { return this.doRpc<string>("hashString", 1, str); } diff --git a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts index 1f44d6277..87fad8634 100644 --- a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts +++ b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts @@ -72,11 +72,13 @@ import { DerivedTipPlanchet, DeriveRefreshSessionRequest, DeriveTipRequest, + SignTrackTransactionRequest, } from "../../types/cryptoTypes"; const logger = new Logger("cryptoImplementation.ts"); enum SignaturePurpose { + MERCHANT_TRACK_TRANSACTION = 1103, WALLET_RESERVE_WITHDRAW = 1200, WALLET_COIN_DEPOSIT = 1201, MASTER_DENOMINATION_KEY_VALIDITY = 1025, @@ -211,6 +213,16 @@ export class CryptoImplementation { return tipPlanchet; } + signTrackTransaction(req: SignTrackTransactionRequest): string { + const p = buildSigPS(SignaturePurpose.MERCHANT_TRACK_TRANSACTION) + .put(decodeCrock(req.contractTermsHash)) + .put(decodeCrock(req.wireHash)) + .put(decodeCrock(req.merchantPub)) + .put(decodeCrock(req.coinPub)) + .build(); + return encodeCrock(eddsaSign(p, decodeCrock(req.merchantPriv))); + } + /** * Create and sign a message to recoup a coin. */ |