I have an issue, I don't understand how to "install" sodium-plus for using on my website.
I installed :
<script src="https://cdn.jsdelivr.net/npm/sodium-plus@0.9.0/index.min.js"></script>
<script type="text/javascript" src="/require.js"></script>
and I want to test this script :
<script>
(async function() {
if (!window.sodium) window.sodium = await SodiumPlus.auto();
// You can now use the sodium object here.
// Just some example code to ensure it s running:
let random = await sodium.randombytes_buf(32);
let hash = await sodium.crypto_generichash(
"hello world");
console.log({
"random": random.toString("hex"),
"hash": hash.toString("hex")
});
})();
</script>
But I have two errors :
Uncaught ReferenceError: module is not defined Uncaught (in promise)
TypeError: Cannot read properties of undefined (reading 'auto')