Closed davidyuk closed 3 years ago
You can either upgrade your node.js to get atob
working, or bundle a polyfill if you need to redistribute the library for older node.js.
According to https://nodejs.org/ node@14 is still LTS version, I think it should be supported by default. atob
can be easily replaced with Buffer
in node. I was going to sent a PR with something like:
function decodeWasmBinary(base64) {
+ if (typeof Buffer === 'function') {
+ return new Uint8Array(Buffer.from(base64, 'base64'))
+ }
const text = atob(base64);
const binary = new Uint8Array(new ArrayBuffer(text.length));
for (let i = 0; i < text.length; i++) {
binary[i] = text.charCodeAt(i);
}
return binary;
}
but can't check it because of #66
Added the fallback, thanks
Thanks for solving the previous issue!
argon2-browser version is 1.18.0
Seems that
atob
is not available in node, but it is used in https://github.com/antelle/argon2-browser/blob/63cda65cd2182e39a139aa074e2306332ddd4417/lib/argon2.js#L97