It was pointed out that subtle
is actually undefined
.
I replaced my function with this code and it now works (and is nicer as it just returns a string
not a Promise<String>
:
export default function hashPassword(unHashedPassword) {
const hash = crypto.createHash("sha256")
return hash.update(unHashedPassword).digest().toString("hex")
}