From c53c6b8b3c0a66f3862883ec1314c6d4bf68af32 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 3 Apr 2024 19:18:56 +0200 Subject: wallet-core: introduce setConfig request Currently just an alias for initWallet, behavior might diverge in the future. --- packages/taler-wallet-core/src/wallet-api-types.ts | 16 +++++++++++++++- packages/taler-wallet-core/src/wallet.ts | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts index 4f4b24b62..0fd0ffbd6 100644 --- a/packages/taler-wallet-core/src/wallet-api-types.ts +++ b/packages/taler-wallet-core/src/wallet-api-types.ts @@ -154,6 +154,7 @@ import { PaymentBalanceDetails } from "./balance.js"; export enum WalletApiOperation { InitWallet = "initWallet", + SetConfig = "setConfig", WithdrawTestkudos = "withdrawTestkudos", WithdrawTestBalance = "withdrawTestBalance", PreparePayForUri = "preparePayForUri", @@ -263,10 +264,11 @@ export enum WalletApiOperation { // group: Initialization type EmptyObject = Record; + /** * Initialize wallet-core. * - * Must be the request before any other operations. + * Must be the first request made to wallet-core. */ export type InitWalletOp = { op: WalletApiOperation.InitWallet; @@ -274,6 +276,17 @@ export type InitWalletOp = { response: InitResponse; }; +/** + * Change the configuration of wallet-core. + * + * Currently an alias for the initWallet request. + */ +export type SetConfigOp = { + op: WalletApiOperation.SetConfig; + request: InitRequest; + response: InitResponse; +}; + export type GetVersionOp = { op: WalletApiOperation.GetVersion; request: EmptyObject; @@ -1147,6 +1160,7 @@ export type ForceRefreshOp = { export type WalletOperations = { [WalletApiOperation.InitWallet]: InitWalletOp; + [WalletApiOperation.SetConfig]: SetConfigOp; [WalletApiOperation.GetVersion]: GetVersionOp; [WalletApiOperation.PreparePayForUri]: PreparePayForUriOp; [WalletApiOperation.SharePayment]: SharePaymentOp; diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index eb981e79c..1f91f5ecf 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -186,9 +186,9 @@ import { timestampProtocolToDb, } from "./db.js"; import { + checkDepositGroup, createDepositGroup, generateDepositGroupTxId, - checkDepositGroup, } from "./deposits.js"; import { DevExperimentHttpLib, applyDevExperiment } from "./dev-experiments.js"; import { @@ -688,6 +688,7 @@ async function dispatchRequestInternal( await recoverStoredBackup(wex, req); return {}; } + case WalletApiOperation.SetConfig: case WalletApiOperation.InitWallet: { const req = codecForInitRequest().decode(payload); -- cgit v1.2.3