diff options
author | Florian Dold <florian@dold.me> | 2024-04-03 19:18:56 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-04-03 19:18:56 +0200 |
commit | c53c6b8b3c0a66f3862883ec1314c6d4bf68af32 (patch) | |
tree | e90d3dd24ffc11385a0740599a960f480a949c54 | |
parent | 65a656163797e9dd298b34ec916b982082db7f52 (diff) | |
download | wallet-core-c53c6b8b3c0a66f3862883ec1314c6d4bf68af32.tar.xz |
wallet-core: introduce setConfig request
Currently just an alias for initWallet, behavior might diverge in the future.
-rw-r--r-- | packages/taler-wallet-core/src/wallet-api-types.ts | 16 | ||||
-rw-r--r-- | 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<string, never>; + /** * 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<Op extends WalletApiOperation>( await recoverStoredBackup(wex, req); return {}; } + case WalletApiOperation.SetConfig: case WalletApiOperation.InitWallet: { const req = codecForInitRequest().decode(payload); |