Skip to main content
Home

@gz/jwt@0.1.0
Built and signed on GitHub Actions

JSON Web Token (JWT)

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a year ago (0.1.0)

JSON Web Token (JWT)

A simple JSON Web Token (JWT) library for Deno and Node.js, partially compliant with the JWT specification.

Installation

To install the JWT library, run the following command:

# deno
deno add jsr:@gz/jwt

# npm (use any of npx, yarn dlx, pnpm dlx, or bunx)
npx jsr add @gz/jwt

Usage

To encode a payload, use the encode() function:

import { encode } from "@gz/jwt";

const payload = {userId: 123, name: "John Doe"};

const token = await encode(payload, "secret", {algorithm: "HS256"});

To decode a token, use the decode() function:

import { decode } from "@gz/jwt";

const decoded = await decode<User>(token, "secret", {algorithm: "HS256"});
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@gz/jwt

Import symbol

import * as jwt from "@gz/jwt";
or

Import directly with a jsr specifier

import * as jwt from "jsr:@gz/jwt";

Add Package

pnpm i jsr:@gz/jwt
or (using pnpm 10.8 or older)
pnpm dlx jsr add @gz/jwt

Import symbol

import * as jwt from "@gz/jwt";

Add Package

yarn add jsr:@gz/jwt
or (using Yarn 4.8 or older)
yarn dlx jsr add @gz/jwt

Import symbol

import * as jwt from "@gz/jwt";

Add Package

vlt install jsr:@gz/jwt

Import symbol

import * as jwt from "@gz/jwt";

Add Package

npx jsr add @gz/jwt

Import symbol

import * as jwt from "@gz/jwt";

Add Package

bunx jsr add @gz/jwt

Import symbol

import * as jwt from "@gz/jwt";