1.0.0 • Published 7 years ago

plus.nodetoken v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

plus.nodetoken

The simplest secure token. Node.js crypto and base64url based.

const Cipher = require('plus.nodetoken');

const cipher = Cipher({
  secret: '',
  encryption: 'aes256',
  hmac: 'sha256',
  saltBytes: 4
});

cipher.encrypt({hey: 'here'})
  .then((token) => {
    console.log({token});
    return cipher.decrypt(token)
  })
  .then((data) => {
    console.log(data)
  });

// { token: 'nWq8JzGvoNR_YXR5mEHm2-evjIhVqMHHBHIxPgngoaY.TkEdV4K3JGnzoskzSklPqP11u89KsyxZ5XZhJwDOPV8' }
// { hey: 'here' }