import { EncryptionService } from "./EncryptionService";
import { SJCLEncryptionService } from "./SJCLEncryptionService";
// import PromiseWorker = require('promise-worker');
import PromiseWorker from "promise-worker";

export class EncryptionServiceFactory {
  private static readonly _worker = new Worker(
    localStorage.getItem("CHAT_WORKER_BUNDLE") || "chat-worker-error.js"
  );
  private static readonly _promiseWorker = new PromiseWorker(
    EncryptionServiceFactory._worker
  );
  public static getEncryptionService(): EncryptionService {
    return new SJCLEncryptionService(this._promiseWorker);
  }
}
