1.0.1 • Published 7 years ago

achim-crypto v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

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`)
    }
  })
}
1.0.1

7 years ago

1.0.0

7 years ago