summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/crypto
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-12-18 19:25:26 +0100
committerFlorian Dold <florian@dold.me>2023-12-18 19:25:26 +0100
commit12a9b08c6f8c31f684239a30fc39acc9189c6571 (patch)
tree3755eb1a6b7659d44059ddb4cf85c832a8f88a8e /packages/taler-wallet-core/src/crypto
parenta488ce70d6dbfe08845eccaeb2375b367f7c307a (diff)
downloadwallet-core-12a9b08c6f8c31f684239a30fc39acc9189c6571.tar.gz
wallet-core-12a9b08c6f8c31f684239a30fc39acc9189c6571.tar.bz2
wallet-core-12a9b08c6f8c31f684239a30fc39acc9189c6571.zip
wallet-core: towards properly handling peer-pull-debit expiry
Diffstat (limited to 'packages/taler-wallet-core/src/crypto')
-rw-r--r--packages/taler-wallet-core/src/crypto/cryptoImplementation.ts28
-rw-r--r--packages/taler-wallet-core/src/crypto/cryptoTypes.ts10
2 files changed, 38 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts
index 36ca128ae..7c6b142fb 100644
--- a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts
+++ b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts
@@ -103,6 +103,8 @@ import {
EncryptContractForDepositResponse,
EncryptContractRequest,
EncryptContractResponse,
+ SignCoinHistoryRequest,
+ SignCoinHistoryResponse,
SignDeletePurseRequest,
SignDeletePurseResponse,
SignPurseMergeRequest,
@@ -243,6 +245,10 @@ export interface TalerCryptoInterface {
signDeletePurse(
req: SignDeletePurseRequest,
): Promise<SignDeletePurseResponse>;
+
+ signCoinHistoryRequest(
+ req: SignCoinHistoryRequest,
+ ): Promise<SignCoinHistoryResponse>;
}
/**
@@ -427,6 +433,11 @@ export const nullCrypto: TalerCryptoInterface = {
): Promise<SignDeletePurseResponse> {
throw new Error("Function not implemented.");
},
+ signCoinHistoryRequest: function (
+ req: SignCoinHistoryRequest,
+ ): Promise<SignCoinHistoryResponse> {
+ throw new Error("Function not implemented.");
+ },
};
export type WithArg<X> = X extends (req: infer T) => infer R
@@ -1705,6 +1716,23 @@ export const nativeCryptoR: TalerCryptoInterfaceR = {
sig: sigResp.sig,
};
},
+ async signCoinHistoryRequest(
+ tci: TalerCryptoInterfaceR,
+ req: SignCoinHistoryRequest,
+ ): Promise<SignCoinHistoryResponse> {
+ const coinHistorySigBlob = buildSigPS(
+ TalerSignaturePurpose.WALLET_COIN_HISTORY,
+ )
+ .put(bufferForUint64(req.startOffset))
+ .build();
+ const sigResp = await tci.eddsaSign(tci, {
+ msg: encodeCrock(coinHistorySigBlob),
+ priv: req.coinPriv,
+ });
+ return {
+ sig: sigResp.sig,
+ };
+ },
};
export interface EddsaSignRequest {
diff --git a/packages/taler-wallet-core/src/crypto/cryptoTypes.ts b/packages/taler-wallet-core/src/crypto/cryptoTypes.ts
index 2204fac71..df25b87e4 100644
--- a/packages/taler-wallet-core/src/crypto/cryptoTypes.ts
+++ b/packages/taler-wallet-core/src/crypto/cryptoTypes.ts
@@ -279,6 +279,16 @@ export interface SignDeletePurseResponse {
sig: EddsaSignatureString;
}
+export interface SignCoinHistoryRequest {
+ coinPub: string;
+ coinPriv: string;
+ startOffset: number;
+}
+
+export interface SignCoinHistoryResponse {
+ sig: EddsaSignatureString;
+}
+
export interface SignReservePurseCreateRequest {
mergeTimestamp: TalerProtocolTimestamp;