diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-03-12 00:44:28 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-03-12 00:44:28 +0530 |
commit | 2c52046f0bf358a5e07c53394b3b72d091356cce (patch) | |
tree | 8993c992b9c8240ee865671cdfbab380e61af96c /src/crypto/workers/cryptoImplementation.ts | |
parent | 6e2881fabf74a3c1da8e94dcbe3e68fce6080d9e (diff) |
full recoup, untested/unfinished first attempt
Diffstat (limited to 'src/crypto/workers/cryptoImplementation.ts')
-rw-r--r-- | src/crypto/workers/cryptoImplementation.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/crypto/workers/cryptoImplementation.ts b/src/crypto/workers/cryptoImplementation.ts index 220046209..3447c56f0 100644 --- a/src/crypto/workers/cryptoImplementation.ts +++ b/src/crypto/workers/cryptoImplementation.ts @@ -31,9 +31,10 @@ import { RefreshSessionRecord, TipPlanchet, WireFee, + CoinSourceType, } from "../../types/dbTypes"; -import { CoinDepositPermission, ContractTerms, PaybackRequest } from "../../types/talerTypes"; +import { CoinDepositPermission, RecoupRequest } from "../../types/talerTypes"; import { BenchmarkResult, PlanchetCreationResult, @@ -73,7 +74,7 @@ enum SignaturePurpose { WALLET_COIN_MELT = 1202, TEST = 4242, MERCHANT_PAYMENT_OK = 1104, - WALLET_COIN_PAYBACK = 1203, + WALLET_COIN_RECOUP = 1203, WALLET_COIN_LINK = 1204, } @@ -198,10 +199,10 @@ export class CryptoImplementation { } /** - * Create and sign a message to request payback for a coin. + * Create and sign a message to recoup a coin. */ - createPaybackRequest(coin: CoinRecord): PaybackRequest { - const p = buildSigPS(SignaturePurpose.WALLET_COIN_PAYBACK) + createRecoupRequest(coin: CoinRecord): RecoupRequest { + const p = buildSigPS(SignaturePurpose.WALLET_COIN_RECOUP) .put(decodeCrock(coin.coinPub)) .put(decodeCrock(coin.denomPubHash)) .put(decodeCrock(coin.blindingKey)) @@ -209,12 +210,13 @@ export class CryptoImplementation { const coinPriv = decodeCrock(coin.coinPriv); const coinSig = eddsaSign(p, coinPriv); - const paybackRequest: PaybackRequest = { + const paybackRequest: RecoupRequest = { coin_blind_key_secret: coin.blindingKey, coin_pub: coin.coinPub, coin_sig: encodeCrock(coinSig), denom_pub: coin.denomPub, denom_sig: coin.denomSig, + refreshed: (coin.coinSource.type === CoinSourceType.Refresh), }; return paybackRequest; } |