joi-jwt

1.0.1 • Public • Published

joi-jwt

Lead Maintainer: Roman Rodomansky

Joi extensions for JWT Token rules.

Installation

yarn add joi-jwt --save

Usage

const JoiBase = require('joi');
const Joi = JoiBase.extend(require('joi-jwt'));
 
const schema = Joi.jwt().valid({secret: 'secret-key'}).required();
 
const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaXRlIjoiaHR0cHM6Ly9yYWxhYnMub3JnIiwiaWF0IjoxNTU1Njk5Njg5fQ.1-YemibEH2bC7EqoQtG2naPRui0MP8Ma-Y5mAKYoJDU';
 
const result = schema.validate(token, { abortEarly: false });
console.log('result', result);

Sponsored by

Ralabs

Readme

Keywords

Package Sidebar

Install

npm i joi-jwt

Weekly Downloads

10

Version

1.0.1

License

MIT

Unpacked Size

2.55 kB

Total Files

4

Last publish

Collaborators

  • itspoma