summaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-03-12 00:44:28 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-03-12 00:44:28 +0530
commit2c52046f0bf358a5e07c53394b3b72d091356cce (patch)
tree8993c992b9c8240ee865671cdfbab380e61af96c /src/crypto
parent6e2881fabf74a3c1da8e94dcbe3e68fce6080d9e (diff)
downloadwallet-core-2c52046f0bf358a5e07c53394b3b72d091356cce.tar.gz
wallet-core-2c52046f0bf358a5e07c53394b3b72d091356cce.tar.bz2
wallet-core-2c52046f0bf358a5e07c53394b3b72d091356cce.zip
full recoup, untested/unfinished first attempt
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/workers/cryptoApi.ts7
-rw-r--r--src/crypto/workers/cryptoImplementation.ts14
2 files changed, 11 insertions, 10 deletions
diff --git a/src/crypto/workers/cryptoApi.ts b/src/crypto/workers/cryptoApi.ts
index 489d56f5c..4adf2882e 100644
--- a/src/crypto/workers/cryptoApi.ts
+++ b/src/crypto/workers/cryptoApi.ts
@@ -30,12 +30,11 @@ import {
RefreshSessionRecord,
TipPlanchet,
WireFee,
- WalletContractData,
} from "../../types/dbTypes";
import { CryptoWorker } from "./cryptoWorker";
-import { ContractTerms, PaybackRequest, CoinDepositPermission } from "../../types/talerTypes";
+import { RecoupRequest, CoinDepositPermission } from "../../types/talerTypes";
import {
BenchmarkResult,
@@ -409,8 +408,8 @@ export class CryptoApi {
return this.doRpc<boolean>("isValidWireAccount", 4, paytoUri, sig, masterPub);
}
- createPaybackRequest(coin: CoinRecord): Promise<PaybackRequest> {
- return this.doRpc<PaybackRequest>("createPaybackRequest", 1, coin);
+ createRecoupRequest(coin: CoinRecord): Promise<RecoupRequest> {
+ return this.doRpc<RecoupRequest>("createRecoupRequest", 1, coin);
}
createRefreshSession(
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;
}