import { createWorker , WorkerScript } from '../workers' ; interface GenerateEncryptionKeyArgs { password : string ; salt : string ; } export async function generateEncryptionKey ( args ) { const worker = createWorker ( WorkerScript . DecryptionWorker ) ; return new Promise ( resolve => { worker . addEventListener ( 'message' , ( e ) => { worker . terminate ( ) ; resolve ( e . data ) ; } ) ; worker . postMessage ( args ) ; } ) ; }