2023-05-09 00:22:00 +00:00
|
|
|
import { WorkerServerBus } from '~/util/WorkerEventBus';
|
2023-05-08 16:36:10 +00:00
|
|
|
import { DECRYPTION_WORKER_ACTION_NAME } from './constants';
|
|
|
|
|
2023-05-14 23:09:26 +00:00
|
|
|
import { getSDKVersion } from '@jixun/libparakeet';
|
2023-05-14 22:15:59 +00:00
|
|
|
|
2023-05-14 23:09:26 +00:00
|
|
|
import { workerDecryptHandler } from './worker-handler/decrypt';
|
2023-05-09 00:23:35 +00:00
|
|
|
|
2023-05-08 16:36:10 +00:00
|
|
|
const bus = new WorkerServerBus();
|
|
|
|
onmessage = bus.onmessage;
|
|
|
|
|
2023-05-14 23:09:26 +00:00
|
|
|
bus.addEventHandler(DECRYPTION_WORKER_ACTION_NAME.DECRYPT, workerDecryptHandler);
|
2023-05-13 19:04:55 +00:00
|
|
|
|
2023-05-14 23:09:26 +00:00
|
|
|
bus.addEventHandler(DECRYPTION_WORKER_ACTION_NAME.VERSION, async () => {
|
|
|
|
return getSDKVersion();
|
2023-05-08 16:36:10 +00:00
|
|
|
});
|