Open
Description
README.md
says:
argon2.verify({
// <CODE ELIDED>
})
// result
.then(res => {
res.hash // hash as Uint8Array
res.hashHex // hash as hex-string
res.encoded // encoded hash, as required by argon2
})
// or error
.catch(err => {
err.message // error message as string, if available
err.code // numeric error code
})
Which is desirable! I need res.hash
after a successful verification. But, meanwhile, back in argon2.js
:
let result;
if (res || err) {
// <CODE ELIDED>
result = { message: err, code: res };
}
// <CODE ELIDED>
if (err) {
throw result;
} else {
return result;
}
.. returning undefined
in the case of success. And indeed argon2_library.c
indicates we can only receive a status code and not the various hash values:
ret = argon2_verify_ctx(&ctx, (char *)desired_result, type);
SO, the res
data structure containing encoded
, hash
, hashHex
needs to be re-written out of the README.md
sample .then()
clause , perhaps like this:
argon2.verify({
// <CODE ELIDED>
})
// success
then(() => console.log("success!"))
// or error
.catch(err => {
err.message // error message as string, if available
err.code // numeric error code
})
Metadata
Assignees
Labels
No labels
Activity