From d881f4fd258a27cc765a25c24e5fef9f86b6226f Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 23 Mar 2022 21:24:23 +0100 Subject: wallet: simplify crypto workers --- packages/taler-wallet-core/src/wallet.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'packages/taler-wallet-core/src/wallet.ts') diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 5e71cfbc7..d1e9aa646 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -90,7 +90,10 @@ import { RecoupOperations, ReserveOperations, } from "./internal-wallet-state.js"; -import { CryptoApi, CryptoWorkerFactory } from "./crypto/workers/cryptoApi.js"; +import { + CryptoDispatcher, + CryptoWorkerFactory, +} from "./crypto/workers/cryptoDispatcher.js"; import { AuditorTrustRecord, CoinSourceType, @@ -99,10 +102,7 @@ import { ReserveRecordStatus, WalletStoresV1, } from "./db.js"; -import { - getErrorDetailFromException, - TalerError, -} from "./errors.js"; +import { getErrorDetailFromException, TalerError } from "./errors.js"; import { exportBackup } from "./operations/backup/export.js"; import { addBackupProvider, @@ -193,6 +193,10 @@ import { import { DbAccess, GetReadWriteAccess } from "./util/query.js"; import { TimerGroup } from "./util/timer.js"; import { WalletCoreApiClient } from "./wallet-api-types.js"; +import { + TalerCryptoInterface, + TalerCryptoInterfaceR, +} from "./crypto/cryptoImplementation.js"; const builtinAuditors: AuditorTrustRecord[] = [ { @@ -1158,7 +1162,8 @@ class InternalWalletStateImpl implements InternalWalletState { memoProcessRefresh: AsyncOpMemoMap = new AsyncOpMemoMap(); memoProcessRecoup: AsyncOpMemoMap = new AsyncOpMemoMap(); memoProcessDeposit: AsyncOpMemoMap = new AsyncOpMemoMap(); - cryptoApi: CryptoApi; + cryptoApi: TalerCryptoInterface; + cryptoDispatcher: CryptoDispatcher; merchantInfoCache: Record = {}; @@ -1213,7 +1218,8 @@ class InternalWalletStateImpl implements InternalWalletState { public http: HttpRequestLibrary, cryptoWorkerFactory: CryptoWorkerFactory, ) { - this.cryptoApi = new CryptoApi(cryptoWorkerFactory); + this.cryptoDispatcher = new CryptoDispatcher(cryptoWorkerFactory); + this.cryptoApi = this.cryptoDispatcher.cryptoApi; } async getDenomInfo( @@ -1258,7 +1264,7 @@ class InternalWalletStateImpl implements InternalWalletState { stop(): void { this.stopped = true; this.timerGroup.stopCurrentAndFutureTimers(); - this.cryptoApi.stop(); + this.cryptoDispatcher.stop(); } async runUntilDone( -- cgit v1.2.3