Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
How to use/install sodium-plus

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')

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It works with this link :

src="https://cdn.jsdelivr.net/npm/sodium-plus@0.9.0/dist/sodium-plus.min.js"

and I delete the code :

let { SodiumPlus } = "sodium-plus";
require(["sodium-plus"], function(result){
    SodiumPlus = result;
});

But I keep the requirejs script from this website (at the bottom of my scripts because there is sometimes an issue with jQuery) :

https://cdnjs.com/libraries/require.js

And after, to avoid an issue about requirejs script, I do this :

define(function (require) {
    const { SodiumPlus } = require("sodium-plus");
});
let sodium;

Not this :

const { SodiumPlus } = require('sodium-plus');
let sodium;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!