Skip to content

ugurcanalyuz/crypted-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypted JWT

This small library hashes the generated regular JWT keys with three different numbers and enables you to parse it later on. If you don't share these numbers with anyone, it becomes nearly impossible to crack.

Installation

npm install crypted-jwt
or
yarn add crypted-jwt

Usage

const CJWT = require('crypted-jwt')

// Firstly, we send settings in this way and create a Class.
// salt1, salt2, and salt3 determine your encryption keys. Do not share these with anyone!
const options = {
    salt1: 10,
    salt2: 20,
    salt3: 30,
    jsonSecretKey: 'string',
    expiresIn: '365d',
    cryptoSecretKey: 'only 32 character string'
}

// Create Class
const CJ = new CJWT(options)

// It generates a hashed token for you by sending the object as a payload.
const token = CJ.createToken({ id: 1 })

// You can query the generated token when it arrives at the service later on.
const bearerToken = 'testtoken'
const parse = CJ.parseToken(bearerToken)

Good Works.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published