achim-crypto

1.0.1 • Public • Published

How to use

This package designed to help you to hash or encrypt your password. usually used when user login, register, change password etc. this package also comes with other packages "achim-salt"

Install

>> npm i -S achim-crypto achim-salt

Example

const hash = require('achim-crypto');
const salt = require('achim-salt');

var register = (req, res) => {
  secretKey = salt()
  pass = hash(req.body.password, secretKey)
  User.find({username: req.body.username})
  .then(result => {
    if(result.length == 0){
      User.create({
        username: req.body.username,
        password: pass,
        secret: secretKey
      })
      .then(result => res.send(result))
    } else {
      res.send(`${req.body.username} : allready exist`)
    }
  })
}

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i achim-crypto

      Weekly Downloads

      0

      Version

      1.0.1

      License

      MIT

      Last publish

      Collaborators

      • achimbaggins