Supports Fastify versions 3.x
npm i --save fastify-argon2
Require fastify-argon2
and register. This will decorate your fastify
instance with the following methods: hash
, verify
, and needsRehash
. It will also register request.argon2Hash
, request.argon2Verify
, and request.argon2NeedsRehash
.
const fastify = require('fastify')()
fastify.register(require('fastify-argon2'))
fastify.argon2.hash('password')
.then(hash => fastify.argon2.verify(hash, 'password'))
.then(isMatch => console.log(isMatch ? 'Matched" : 'Not matched'))
.catch(err => console.error(err.message))
fastify.listen(3000)
Licensed under MIT.