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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nowarajs/jwt

v1.2.4

Published

A JWT (JSON Web Token) utility, using the Jose library

Readme

🔐 NowaraJS JWT

There are already plenty of JWT libraries out there. I built this one mostly for myself—to learn, to experiment, and to have something lightweight that fits my workflow without extra bloat.

Why this package?

Honestly? I just wanted to try building one.

It wraps jose with sane defaults, handles expiration with human-readable strings like "2 hours", and auto-manages claims so I don't have to think about iat, nbf, or jti every time. Nothing revolutionary, just convenient.

📌 Table of Contents

✨ Features

  • ⏱️ Human-Readable Expiration: Write "15 minutes" or "2 days" instead of calculating seconds.
  • 🔍 UUID v7 for JTI: Every token gets a unique, time-sortable JWT ID automatically.
  • 📅 Auto-Managed Claims: iat, nbf, exp, jti are set by default—override only what you need.
  • 🔒 Built on Jose: Rock-solid cryptography under the hood with HS256 signing.
  • 🔑 Secret Validation: Enforces minimum 32-character secrets for HS256 security.
  • ⚠️ Typed Errors: Throws HttpError (401) with specific error keys for expired, invalid, or malformed tokens.
  • 📦 Bun-Optimized: Designed for Bun runtime, zero unnecessary dependencies.

🔧 Installation

bun add @nowarajs/jwt @nowarajs/error

⚙️ Usage

Sign a Token

Use signJWT to create a token. The third argument accepts numbers, Date objects, or human-readable strings.

import { signJWT } from '@nowarajs/jwt';

// Secret must be at least 32 characters
const secret = 'your-secret-key-at-least-32-chars!';

const token = await signJWT(secret, { userId: '123', role: 'admin' }, '2 hours');

Verify a Token

Returns the decoded payload or throws HttpError (401) if invalid/expired.

import { verifyJWT } from '@nowarajs/jwt';

try {
	const result = await verifyJWT(token, secret);
	console.log('User ID:', result.payload.userId);
} catch (error) {
	// HttpError with specific error key
	console.log('Token verification failed:', error.message);
}

Verify with Options

Validate issuer and audience claims:

import { verifyJWT } from '@nowarajs/jwt';

const result = await verifyJWT(token, secret, {
	issuer: 'Core-Issuer',
	audience: 'Core-Audience'
});

Expiration Formats

// Seconds from now
await signJWT(secret, payload, 900);

// Date object
await signJWT(secret, payload, new Date('2026-12-31'));

// Human-readable (my favorite)
await signJWT(secret, payload, '15 minutes');
await signJWT(secret, payload, '1 week');
await signJWT(secret, payload, '30 days');

Custom Claims

Override any default claim by including it in your payload:

const token = await signJWT(
	'secret',
	{
		userId: '123',
		iss: 'MyApp', // Override issuer
		aud: ['web', 'mobile'], // Override audience
		sub: 'user-123' // Override subject
	},
	'1 day'
);

📚 API Reference

Full docs: nowarajs.github.io/jwt

⚖️ License

MIT - Feel free to use it.

📧 Contact