1.1.1 • Published 5 years ago

tokener v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Tokener

Generate and verify ephemeral tokens.

The inspiration behind this API comes from here.

Instantiation

var tokener = require("tokener");

// Signing key is required, everything else is optional
var signer = tokener("SIGNING KEY HERE", {
  algorithm: "sha1",   // from crypto module
  msValid: 86400000,   // 1 day is default (milliseconds!)
  throwOnError: false  // can change verify method to throw
});

Signing

var token = signer.create("some data to sign");

Verification

var data = signer.verify(token); // this will throw when throwOnError is true
if ( data instanceof Error ) {
  // uh-oh, token could NOT be verified, or was expired
}
else {
  // we're good!
}
1.1.1

5 years ago

1.1.0

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago