@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!