[Vuejs]-Running argon2-browser with vite and vue

0👍

If I understood correctly, see if it helps you with the solution

import argon2Wasm from 'argon2-browser/dist/argon2.wasm';
 
async function instantiateArgon2() {
  const argon2 = await WebAssembly.instantiateStreaming(fetch(argon2Wasm), {
    env: {
      memoryBase: 0,
      tableBase: 0,
      memory: new WebAssembly.Memory({ initial: 256 }),
      table: new WebAssembly.Table({ initial: 0, element: 'anyfunc' }),
      __memory_base: 0,
      __table_base: 0,
    },
  });

  return argon2.instance.exports;
}

const argon2 = await instantiateArgon2();
console.log(argon2); // exemplo de uso

Leave a comment