Closed marcbachmann closed 2 years ago
Just checked. Would need some api changes.
E.g. .hashSync
and .hash
currently modify the input buffer
This probably doesn't make much sense anymore with the libsodium wasm api.
The wasm version is about 6 times slower with the same configs.
My motivation is mainly that the native build is causing issues.
I guess I'll try https://github.com/ranisalt/node-argon2 next.
It has prebuilt bindings and is a bit better maintained than sodium-native
.
In case anybody is interested, here's the wasm-based module using libsodium.js.
I've used the wasm bindings directly without the libsodium-wrappers
library to prevent .toString()
calls on the buffers.
Some first version https://github.com/livingdocsIO/secure-password/blob/argon2/index.js
@emilbayes if you're interested, I could do that PR against this repo. https://github.com/livingdocsIO/secure-password/pull/1
But it includes some breaking changes.
By now libsodium supports an official wasm build. Are you interested in getting a PR that completely replaces sodium-native with it?
One challenge would be async support without blocking the event loop. It most likely needs a worker thread for production systems.