Socket
Book a DemoInstallSign in
Socket

zv-token

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zv-token

ZVT is more modern (as I think) alternative for JWT. It works with MsgPack instead of JSON, which makes it 1.5-2x smaller and 1.5x faster.

latest
npmnpm
Version
0.2.2
Version published
Maintainers
0
Created
Source

ZV Token

ZVT is more modern (as I think) alternative for JWT. It works with MsgPack instead of JSON, which makes it 1.5-2x smaller and 1.5x faster.

Important note

Works only with Bun.

Install

bun i zv-token

Usage

import ZVToken from 'zv-token'

const zv = new ZVToken({
    secret: 'jwt is gay',
    
    // keys that u use in payload.data
    structures: ['uid', 'sess'],
    
    // pass true if u want to get
    // error instead of { status: false, payload: undefined }
    throwErrors: false // default
})

const token = zv.sign({
    uid: 123,
    exp: 2147483647,
    sess: '471350b8-9fd4-42ae-98e6-a2255d9ec59a',
    // any other data
})

console.log('token:', token)

const data = zv.verify(token)
console.log(data) 

// { 
//    status: true,
//    payload: {
//        user_id: 123,
//        session_id: 123,
//        expires: Tue Jan 19 2038 06:14:07,
//        data: { your payload }
//    }
// }

Benchmark

ZV Token Benchmark

Goida

2024-04-0405 50 22-ezgif com-optimize

Keywords

jwt

FAQs

Package last updated on 23 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts