From 666b767766ef299bd58655c55ece6d4a82c3e947 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 23 Apr 2024 12:49:42 +0200 Subject: wallet-core: support for withdrawals with forced reserve key --- packages/taler-wallet-core/src/withdraw.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'packages/taler-wallet-core/src/withdraw.ts') diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts index 4936135bd..a55ada796 100644 --- a/packages/taler-wallet-core/src/withdraw.ts +++ b/packages/taler-wallet-core/src/withdraw.ts @@ -41,6 +41,7 @@ import { DenomSelItem, DenomSelectionState, Duration, + EddsaPrivateKeyString, ExchangeBatchWithdrawRequest, ExchangeUpdateStatus, ExchangeWireAccount, @@ -3050,6 +3051,7 @@ export async function createManualWithdrawal( amount: AmountLike; restrictAge?: number; forcedDenomSel?: ForcedDenomSel; + forceReservePriv?: EddsaPrivateKeyString; }, ): Promise { const { exchangeBaseUrl } = req; @@ -3061,9 +3063,20 @@ export async function createManualWithdrawal( "manual withdrawal with conversion from foreign currency is not yet supported", ); } - const reserveKeyPair: EddsaKeypair = await wex.cryptoApi.createEddsaKeypair( - {}, - ); + + let reserveKeyPair: EddsaKeypair; + if (req.forceReservePriv) { + const pubResp = await wex.cryptoApi.eddsaGetPublic({ + priv: req.forceReservePriv, + }); + + reserveKeyPair = { + priv: req.forceReservePriv, + pub: pubResp.pub, + }; + } else { + reserveKeyPair = await wex.cryptoApi.createEddsaKeypair({}); + } const withdrawalAccountsList = await fetchWithdrawalAccountInfo( wex, -- cgit v1.2.3