@nutility/jwt
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

@nutility/jwt

JWT Wrapper module for NestJS

Usage

Import NutilityJwtModule

NutilityJwtService exposes 3 methods (sign, verify, decode), which are native mappings to jsonwebtoken

You can specify a type for those methods: Example:

interface IUser {
  id: string;
  name: string;
}

const token = nutilityJwtService.sign<IUser>(foo); // foo must be of type IUser!
const user = nutilityJwtService.verify<IUser>(token); // user is of type IUser!
const decodedUser = nutilityJwtService.decode<IUser>(token); // decodedUser is of type IUser!

Package Sidebar

Install

npm i @nutility/jwt

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

2.7 kB

Total Files

10

Last publish

Collaborators

  • murbal