I'm using Nestjs and have tried both libraries argon2
and bcrypt
.
import argon2 from 'argon2'
and import bcrypt from 'bcrypt'
are both causing the same error.
When I hover over hash
in userDto.password = await argon2.hash(userDto.password);
, I can see that the proprty exists but I keep getting the error.
Yes a lot of questions have been asked about the issue in bcrypt
which in most cases was caused by importing from bcryptjs
.
I tried clearing both npm and yarn cache, deleted and reinstalled node_modules multiple times.
But they don't seem to work for argon2
and bcrypt
both.
CodePudding user response:
Try this:
import * as argon2 from "argon2";
const hash = await argon2.hash(..);