diff options
Diffstat (limited to 'src/crypto/cryptoApi.ts')
-rw-r--r-- | src/crypto/cryptoApi.ts | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/src/crypto/cryptoApi.ts b/src/crypto/cryptoApi.ts index c68b10700..a4e12c00f 100644 --- a/src/crypto/cryptoApi.ts +++ b/src/crypto/cryptoApi.ts @@ -34,6 +34,8 @@ import { WireFee, } from "../dbTypes"; +import { CryptoWorker } from "./cryptoWorker"; + import { ContractTerms, PaybackRequest } from "../talerTypes"; import { BenchmarkResult, CoinWithDenom, PayCoinInfo } from "../walletTypes"; @@ -83,15 +85,6 @@ interface WorkItem { */ const NUM_PRIO = 5; -interface CryptoWorker { - postMessage(message: any): void; - - terminate(): void; - - onmessage: (m: any) => void; - onerror: (m: any) => void; -} - export interface CryptoWorkerFactory { /** * Start a new worker. @@ -105,21 +98,6 @@ export interface CryptoWorkerFactory { getConcurrency(): number; } -export class NodeCryptoWorkerFactory implements CryptoWorkerFactory { - startWorker(): CryptoWorker { - if (typeof require === "undefined") { - throw Error("cannot make worker, require(...) not defined"); - } - const workerCtor = require("./nodeProcessWorker").Worker; - const workerPath = __dirname + "/cryptoWorker.js"; - return new workerCtor(workerPath); - } - - getConcurrency(): number { - return 2; - } -} - export class BrowserCryptoWorkerFactory implements CryptoWorkerFactory { startWorker(): CryptoWorker { const workerCtor = Worker; @@ -142,24 +120,6 @@ export class BrowserCryptoWorkerFactory implements CryptoWorkerFactory { } /** - * The synchronous crypto worker produced by this factory doesn't run in the - * background, but actually blocks the caller until the operation is done. - */ -export class SynchronousCryptoWorkerFactory implements CryptoWorkerFactory { - startWorker(): CryptoWorker { - if (typeof require === "undefined") { - throw Error("cannot make worker, require(...) not defined"); - } - const workerCtor = require("./synchronousWorker").SynchronousCryptoWorker; - return new workerCtor(); - } - - getConcurrency(): number { - return 1; - } -} - -/** * Crypto API that interfaces manages a background crypto thread * for the execution of expensive operations. */ |