Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

148
Vistas
How to use bcrypt hash on the browser side?

I'm already using bcrypt.hashSync() on the NodeJS server side (included with NPM), but I can't use it on the browser side: the 'bcrypt' object is undefined when I call it with:

    <script src="node_modules/bcryptjs/dist/bcrypt.min.js"></script>

    ...
    EnteredPassword = bcrypt.hashSync(pwd, 10);
7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

After some research, the solution is very simple: you have to add a prefix "dcodeIO." before "bcrypt" :

    <script src="node_modules/bcryptjs/dist/bcrypt.min.js"></script>

    ...
    EnteredPassword = dcodeIO.bcrypt.hashSync(pwd, 10);

 (or, as async...)

    EnteredPassword = await dcodeIO.bcrypt.hash(pwd, 10);
7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos