0.0.12-1 • Published 4 years ago

jwtea v0.0.12-1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Last commit types version NPM

⚠ The project is in development. Please don't use in production.

jwtea is an ultra-lightweight JWT implementation in TypeScript, compiled to Native ESM with minimum dependencies.

Some jwtea features are:

  • :heavy_check_mark: Native ESM and CommonJS support
  • :hammer: Types out of the box
  • :clamp: 2x smaller than jsonwebtoken
  • :zap: Faster than jsonwebtoken and jose, see benchmark for details.

Install

jwtea requires Node.js 12.4.0 or newer. It is recommended to use pnpm, but you can also use either npm or yarn.

# npm
npm i jwtea

# pnpm
pnpm i jwtea

# yarn
yarn add jwtea

Get Started

This library is pretty similiar to node-jsonwebtoken that we all already know. Just replace commonjs import to esm import and you're good to go.

Synchronous Sign with default algotrithm (HMAC SHA256)

import { sign } from "jwtea"

const token = sign({ foo: "bar" }, "verystrongsecret")

Sign asynchronously

import { sign } from "jwtea"

const token = sign({ foo: "bar" }, "verystrongsecret", (err, token) => {
  console.log(token)
})

Verify synchronously

import { verify } from "jwtea"

const decoded = verify(token, "verystrongsecret")

Verify asynchronously

import { verify } from "jwtea"

const decoded = verify(token, "verystrongsecret", (err, payload) => {
  console.log(payload)
})

Docs

You can see the documentation here. (WIP)

Benchmark

For benchmark detail, go to the benchmark folder

License

MIT © elianiva

0.0.12-1

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6-1

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago