Create a new Argon hash driver instance
Configuration options for the Argon2 hasher
Check if the value is a valid hash. This method just checks for the formatting of the hash.
argon.isValidHash('hello world') // false
argon.isValidHash('$argon2id$v=19$t=3,m=4096,p=1$drxJBWzWahR5tMubp+a1Sw$L/Oh2uw6QKW77i/KQ8eGuOt3ui52hEmmKlu1KBVBxiM')
The value to check
True if the value is a valid Argon2 hash format
Hash a plain text value
const hash = await argon.make('password')
The plain text value to hash
Promise resolving to the Argon2 hash
Verify the plain text value against an existing hash
if (await argon.verify(hash, plainText)) {
}
The hashed value to verify against
The plain text value to verify
Promise resolving to true if verification succeeds
Find if the hash value needs a rehash or not. The rehash is required when.
const isValid = await argon.verify(hash, plainText)
// Plain password is valid and hash needs a rehash
if (isValid && await argon.needsReHash(hash)) {
const newHash = await argon.make(plainText)
}
The hashed value to check
True if the hash needs to be rehashed
Hash driver built on top of "argon2" hash algorigthm. Under the hood we make use of the "argon2" npm package.
The Argon implementation uses the PHC formatting for creating and verifying hashes.