0

Hi I am trying to use libsodium as CDN in my HTML page

code is

<script>
    window.sodium = {
        onload: function (sodium) {
            let h = sodium.crypto_generichash(64, sodium.from_string('test'));
            console.log(sodium.to_hex(h));
        }
    };
</script>
<script src="sodium.js" async></script>

it is same as show on https://github.com/jedisct1/libsodium.js

but I got error Uncaught TypeError: Cannot read properties of undefined (reading 'ready')

how to use this libsodium.js in html page ?

Romil
  • 3
  • 2

0 Answers0