NODE: if (parentPort == null) setTimeout(() => listener(event), 0)
const action = parseAction(data)
const keySalt = parseKeySalt(action, data)
+ const type = parseType(action, data)
+ const id = parseId(action, data)
+ const iv = parseIv(action, data)
+ const parsed = parseData(action, data)
+ const { seed, mnemonicPhrase, mnemonicSalt, index, encrypted, message, timeout } = parsed
passkey(action, keySalt, data)
.then((key: CryptoKey | undefined): Promise<Record<string, boolean | number | ArrayBuffer> | void> => {
- const type = parseType(action, data)
- const id = parseId(action, data)
- const iv = parseIv(action, data)
- const { seed, mnemonicPhrase, mnemonicSalt, index, encrypted, message, timeout } = parseData(action, data)
switch (action) {
case 'STOP': {
BROWSER: close()
NODE: parentPort?.postMessage({ data: result }, transfer)
})
.catch((err: any) => {
- for (let data of Object.values(event.data)) {
- if (data instanceof ArrayBuffer && data.byteLength !== 0) {
- new Uint8Array(data).fill(0)
- }
- data = undefined
- }
BROWSER: self.postMessage({ taskUrl, taskId, error: 'Failed to process Vault request', cause: err })
NODE: parentPort?.postMessage({ data: { taskUrl, taskId, error: 'Failed to process Vault request', cause: err } })
})
+ .finally(() => {
+ new Uint8Array(seed ?? []).fill(0)
+ new Uint8Array(encrypted ?? []).fill(0)
+ new Uint8Array(message ?? []).fill(0)
+ })
}
BROWSER: self.addEventListener('message', listener)
NODE: parentPort?.on('message', listener)