mumba-jwt
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Mumba JWT

A service for working with JSON Web Tokens based on jsonwebtoken.

Installation

$ npm install --save mumba-jwt

Examples

import {TokenService} from 'mumba-jwt';
 
// Sync example
let service = new TokenService({
  passKey: 'abc123'
});
 
let data = {
    foo: 'bar'
};
 
// Not a token.
service.decode('foo'); // null
 
// Creating and decoding token.
let token = service.sign(data, { subject: '123' });
let decoded = service.decode(token);
 
console.log(decoded.sub); // 123
console.log(decoded.foo); // bar
 
// Verifying a bad token.
service.verify('not.even.close')
  .catch(function (err: Error) {
    console.log(err);
  });
 
service.verify(token)
  .then(function (decoded: any) {
   console.log(decoded.foo); // bar
  });

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

People

The original author of Mumba WAMP is Andrew Eddie.

List of all contributors

License

Apache 2.0


© 2017 Mumba Pty Ltd. All rights reserved.

Readme

Keywords

Package Sidebar

Install

npm i mumba-jwt

Weekly Downloads

1

Version

0.1.1

License

Apache-2.0

Unpacked Size

20.2 kB

Total Files

13

Last publish

Collaborators

  • arvin.domingo
  • dennis.barbamumba
  • mumba.cloud
  • carl-oehme-mumba
  • kennbaker