From b214934b75418d0d01c9556577d9594f1db5a319 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 21 Jun 2022 12:40:12 +0200 Subject: wallet-core: P2P push payments (still incomplete) --- packages/taler-util/src/talerCrypto.ts | 2 ++ packages/taler-util/src/talerTypes.ts | 42 ++++++++++++++++++++++++++++++++-- packages/taler-util/src/walletTypes.ts | 27 +++++++++++++++------- 3 files changed, 61 insertions(+), 10 deletions(-) (limited to 'packages/taler-util') diff --git a/packages/taler-util/src/talerCrypto.ts b/packages/taler-util/src/talerCrypto.ts index e2360b095..188f5ec0a 100644 --- a/packages/taler-util/src/talerCrypto.ts +++ b/packages/taler-util/src/talerCrypto.ts @@ -773,6 +773,8 @@ export enum TalerSignaturePurpose { WALLET_COIN_LINK = 1204, WALLET_COIN_RECOUP_REFRESH = 1206, WALLET_AGE_ATTESTATION = 1207, + WALLET_PURSE_CREATE = 1210, + WALLET_PURSE_DEPOSIT = 1211, EXCHANGE_CONFIRM_RECOUP = 1039, EXCHANGE_CONFIRM_RECOUP_REFRESH = 1041, ANASTASIS_POLICY_UPLOAD = 1400, diff --git a/packages/taler-util/src/talerTypes.ts b/packages/taler-util/src/talerTypes.ts index 7fc3fcba0..7afa76e9e 100644 --- a/packages/taler-util/src/talerTypes.ts +++ b/packages/taler-util/src/talerTypes.ts @@ -565,8 +565,8 @@ export interface MerchantAbortPayRefundDetails { refund_amount: string; /** - * Fee for the refund. - */ + * Fee for the refund. + */ refund_fee: string; /** @@ -1794,3 +1794,41 @@ export const codecForDepositSuccess = (): Codec => .property("exchange_timestamp", codecForTimestamp) .property("transaction_base_url", codecOptional(codecForString())) .build("DepositSuccess"); + +export interface PurseDeposit { + /** + * Amount to be deposited, can be a fraction of the + * coin's total value. + */ + amount: AmountString; + + /** + * Hash of denomination RSA key with which the coin is signed. + */ + denom_pub_hash: HashCodeString; + + /** + * Exchange's unblinded RSA signature of the coin. + */ + ub_sig: UnblindedSignature; + + /** + * Age commitment hash for the coin, if the denomination is age-restricted. + */ + h_age_commitment?: HashCodeString; + + // FIXME-Oec: proof of age is missing. + + /** + * Signature over TALER_PurseDepositSignaturePS + * of purpose TALER_SIGNATURE_WALLET_PURSE_DEPOSIT + * made by the customer with the + * coin's private key. + */ + coin_sig: EddsaSignatureString; + + /** + * Public key of the coin being deposited into the purse. + */ + coin_pub: EddsaPublicKeyString; +} diff --git a/packages/taler-util/src/walletTypes.ts b/packages/taler-util/src/walletTypes.ts index 2e5dd418d..4b1911164 100644 --- a/packages/taler-util/src/walletTypes.ts +++ b/packages/taler-util/src/walletTypes.ts @@ -32,10 +32,7 @@ import { codecForAmountJson, codecForAmountString, } from "./amounts.js"; -import { - codecForTimestamp, - TalerProtocolTimestamp, -} from "./time.js"; +import { codecForTimestamp, TalerProtocolTimestamp } from "./time.js"; import { buildCodecForObject, codecForString, @@ -1230,15 +1227,14 @@ export interface ForcedCoinSel { } export interface TestPayResult { - payCoinSelection: PayCoinSelection, + payCoinSelection: PayCoinSelection; } - /** * Result of selecting coins, contains the exchange, and selected * coins with their denomination. */ - export interface PayCoinSelection { +export interface PayCoinSelection { /** * Amount requested by the merchant. */ @@ -1263,4 +1259,19 @@ export interface TestPayResult { * How much of the deposit fees is the customer paying? */ customerDepositFees: AmountJson; -} \ No newline at end of file +} + +export interface InitiatePeerPushPaymentRequest { + amount: AmountString; +} + +export interface InitiatePeerPushPaymentResponse { + pursePub: string; + mergePriv: string; +} + +export const codecForInitiatePeerPushPaymentRequest = + (): Codec => + buildCodecForObject() + .property("amount", codecForAmountString()) + .build("InitiatePeerPushPaymentRequest"); -- cgit v1.2.3