🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

@dalisoft/jwt

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dalisoft/jwt

JWT Helper for Auth building from scratch

Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

JWT

Greenkeeper badge

JWT Helper for Auth building from scratch

Features

  • Fast
  • No duplication
  • Almost zero-config
  • Flexible
  • Memory-effecient
  • Promise-based
  • Async/Await support
  • Types declaration for IDE/Editor

Import

// ES6
import {
  sign,
  verify,
  decode,
  generateToken,
  refreshToken
} from "@dalisoft/jwt";

// or

// CommonJS
const { JWT } = require("@dalisoft/jwt");

Example

const { sign, verify, decode, generateToken, refreshToken } = JWT;

const token = await sign(payload | object, secret: string | any, options: object, isSecure: boolean);

For more info see tests.

Methods

#sign(payload | object, secret: string | any, options: object, isSecure: boolean): string

Returns value of signed (+ maybe secured) token

#verify(token: string, secret: string | any, options: object): object | null

Returns value of signed (+ maybe secured) token

#decode(token: string, secret: string | any, options: object): object | null

Decodes value of signed (+ maybe secured) token without needing verifying signature

#generateToken(payload: string | object, secretOrPrivate: string | any, options?: object, secure?: boolean, salt?: string)

Generates token and returns accessToken and refreshToken

#refreshToken({ accessToken, publicKey, salt refreshToken, privateKey,}: OKS)

Generates new token by refreshing token and returns accessToken and refreshToken

License

MIT

Keywords

auth

FAQs

Package last updated on 04 May 2019

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