Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
wasmBinaryBase64 +
'"), c => c.charCodeAt(0)),' +
'print(...args) { postMessage({op:"log",args}) },' +
'printErr(...args) { postMessage({op:"log",args}) },' +
'postRun:' +
this.workerPostRun.toString() +
',' +
'calcHash:' +
this.calcHash.toString() +
',' +
'wasmMemory:wasmMemory,' +
'buffer:wasmMemory.buffer,' +
'TOTAL_MEMORY:' +
initialMemory * WASM_PAGE_SIZE +
'}';
const script = argon2LoaderCode.replace(
/^var Module.*?}/,
memoryDecl + moduleDecl
);
const blob = new Blob([script], { type: 'application/javascript' });
const objectUrl = URL.createObjectURL(blob);
const worker = new Worker(objectUrl);
const onMessage = e => {
switch (e.data.op) {
case 'log':
logger.debug(...e.data.args);
break;
case 'postRun':
logger.debug(
'WebAssembly runtime loaded (web worker)',
logger.ts(ts)
);