libsodium.js icon indicating copy to clipboard operation
libsodium.js copied to clipboard

Is there a way to know what version is currently used (wasm/pure JS)?

Open rap2hpoutre opened this issue 2 years ago • 3 comments

Is there a way to know what version is currently used (wasm/pure JS)?

And is there a way to choose one version over another version?

rap2hpoutre avatar Nov 23 '21 13:11 rap2hpoutre

Hi!

Your package.json file has the version used by your project, and also lets you choose a specific version to use.

If you are referring to the bundled libsodium version, this information is accessible via the sodium_version_string() function. The SODIUM_LIBRARY_VERSION_MAJOR and SODIUM_LIBRARY_VERSION_MINOR constants are also defined.

jedisct1 avatar Nov 23 '21 18:11 jedisct1

Hi @jedisct1!

Thank you for your answer. My question was actually not clear, I apologize!

A bit of context: I'm using libsodium in two projects. One project seems to decrypt data really fast, the other one seems to be slower. Assuming this lib falls back to pure JS implementation when it fails to use wasm implementation (maybe my assumption is false though), I wanted to be sure that both of my projects use wasm implementation.

Let me know if my question is not clear!

rap2hpoutre avatar Nov 25 '21 07:11 rap2hpoutre

https://github.com/jedisct1/libsodium.js/issues/149#issuecomment-379317711

jedisct1 avatar Nov 25 '21 10:11 jedisct1