1.0.6 • Published 6 years ago

juw v1.0.6

Weekly downloads
1
License
MIT
Repository
gitlab
Last release
6 years ago

Juw

type safe jwt usage

Features

  • type safe
  • give secret only once

Quick Start

import { initJwtService } from 'juw';
import { IUser } from './your.user.interface';

const userJwtService = initJwtService<IUser>(YOUR_SECRET_KEY);

const token = userJwtService.sign(
  payloadToSign /* must be of type IUser */,
  opts /* jsonwebtoken SignOptions */
);
const decoded = userJwtService.decode(
  token,
  opts /* jsonwebtoken DecodeOptions */
);
// decoded is now of type IUser!
import { initJwtService } from 'juw';
import { ISession } from './your.session.interface';

const sessionJwtService = initJwtService<ISession>(YOUR_SECRET_KEY)
...
const decoded = sessionJwtService.decode(token, opts)
// decoded is now of type ISession!
1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago