npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jwt-transform

v0.0.5

Published

transform your real jwt token into fake jwt token.

Downloads

85

Readme

JWT Transform

Build Status CodeFactor codebeat badge Codacy Badge node-current npm PRs Welcome

jwt-transform is a simple utility tool for your transforming a real jwt token into a fake jwt token, because if you store jwt token into a cookie or local storage very unsafe, your jwt token can be seen data using jwt.io website or chrome extension, if you use jwt-transform you real jwt token cannot seen using jwt.io website or chrome extension, because what you save is fake jwt token, you can get back real jwt token using decrypt method for parse fake jwt token.

Table Of Content

Installation

npm install jwt-transform -S or yarn add jwt-transform -S

API Reference

  • encrypt(secretKey: string, plainText: string, rotate: number): string

    encrypt jwt token using caesar cipher cryptography from real jwt token into fake jwt token

  • decrypt(secretKey: string, cipherText: string, rotate: number): string

    decrypt jwt token using caesar cipher cryptography from fake jwt token into real jwt token

Example Usage

Follow this express tutorial for example usage using express, make this as middleware for transform your fake jwt token to real token, because jwt .verify need real token, if you pass fake token jwt.verify identification your token is not valid and if you not using express, make this as middleware.

  • Example Usage Using CommonJs With JavaScript
     const { JwtTransform } = require('jwt-transform')
    
      const secretKey = 'ptLDDOU5ejqqLjlk4CpSNxvwZVxQFRmF'
     const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
    
     const resultEncrypt = JwtTransform.transform(secretKey, accessToken, secretKey.length)
     console.log(resultEncrypt)
    
     // fake jwt token
     // kePnhMioUoPOAfO1ToOyOtX5iIO6OqvDBIP9.kePfjCOoUoOdSpS0TZE3UJqcOocohsLzFYO6OqvbgM4mXM9rOocogCL0OpudTZK2SpS5SJOelWvzRJJUA5kpwwRprq4IvYTdbcFBdWLXsL.YlrQdcXPYSkQQL2WZ4lcvSkPl36VUq6ePB_gjWyyc5i
    
     const resultDecrypt = JwtTransform.untransform(secretKey, resultEncrypt, secretKey.length)
     console.log(resultDecrypt)
    
     // real jwt token
     // eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
  • Example Usage Using ESM With JavaScript / TypeScript
     import { JwtTransform } from 'jwt-transform'
    
      const secretKey = 'ptLDDOU5ejqqLjlk4CpSNxvwZVxQFRmF'
     const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
    
     const resultEncrypt = JwtTransform.transform(secretKey, accessToken, secretKey.length)
     console.log(resultEncrypt)
    
     // fake jwt token
     // kePnhMioUoPOAfO1ToOyOtX5iIO6OqvDBIP9.kePfjCOoUoOdSpS0TZE3UJqcOocohsLzFYO6OqvbgM4mXM9rOocogCL0OpudTZK2SpS5SJOelWvzRJJUA5kpwwRprq4IvYTdbcFBdWLXsL.YlrQdcXPYSkQQL2WZ4lcvSkPl36VUq6ePB_gjWyyc5i
    
     const resultDecrypt = JwtTransform.untransform(secretKey, resultEncrypt, secretKey.length)
     console.log(resultDecrypt)
    
     // real jwt token
     // eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

Testing

  • Testing Via Local

    npm test or make test
  • Testing Via Local And Build

    make build
  • Testing Via Docker

    docker build -t jwt-transform or make dkb tag=jwt-transform

Bugs

For information on bugs related to package libraries, please visit here

Contributing

Want to make jwt-transform more perfect ? Let's contribute and follow the contribution guide.

License