Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

193
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda