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

@auditauth/node

v0.2.0-beta.8

Published

AuditAuth Node SDK - JWT verification

Downloads

45

Readme

@auditauth/node

@auditauth/node is the AuditAuth SDK for Node.js backends. It verifies AuditAuth access tokens with the AuditAuth public key and validates issuer and audience claims for your application.

Install

Install the package in your Node.js service.

npm install @auditauth/node

TypeScript import compatibility

@auditauth/node ships dual module output (ESM + CJS) with declaration files. You can import it in TypeScript projects with standard syntax:

import { verifyAccessToken } from '@auditauth/node'

You do not need to append .js in consumer imports.

Verify a bearer token

Use verifyAccessToken() when you already have a raw JWT string.

import { verifyAccessToken } from '@auditauth/node'

const payload = await verifyAccessToken({
  token: accessToken,
  appId: process.env.AUDITAUTH_APP_ID!,
})

console.log(payload.sub)
console.log(payload.email)

The SDK validates:

  • Signature (RS256)
  • Issuer (iss) against AuditAuth settings
  • Audience (aud) against the appId you pass

Verify an incoming HTTP request

Use verifyRequest() to extract and validate the Authorization header in one step.

import { verifyRequest } from '@auditauth/node'

export async function handler(request: Request) {
  const session = await verifyRequest({
    request,
    appId: process.env.AUDITAUTH_APP_ID!,
  })

  return Response.json({
    userId: session.sub,
    email: session.email,
  })
}

verifyRequest() accepts these request shapes:

  • Request
  • { headers: Headers }
  • { headers: Record<string, string> }

This makes it compatible with native Fetch handlers and common Node.js server adapters.

Express middleware example

Use verifyRequest() in middleware to protect private routes.

import express from 'express'
import { verifyRequest } from '@auditauth/node'

const app = express()

app.get('/private', async (req, res) => {
  try {
    const session = await verifyRequest({
      request: { headers: req.headers as Record<string, string> },
      appId: process.env.AUDITAUTH_APP_ID!,
    })

    res.json({ accountId: session.account_id, email: session.email })
  } catch {
    res.status(401).json({ error: 'Unauthorized' })
  }
})

Token payload type

The SDK returns AuditAuthTokenPayload, which extends JWTPayload and includes these AuditAuth claims:

  • sub: string
  • email: string
  • aud: string
  • account_id: string
  • app_id: string

API reference

Exports from @auditauth/node:

  • verifyAccessToken(input): Promise<AuditAuthTokenPayload>
  • verifyRequest(input): Promise<AuditAuthTokenPayload>
  • AuditAuthTokenPayload (type)
  • VerifyAccessTokenPayload (type)
  • VerifyRequestParams (type)

Errors

Verification throws an error when:

  • The token is missing.
  • The Authorization header is missing or not Bearer <token>.
  • The JWT signature is invalid.
  • iss or aud claims do not match expected values.

Handle these errors in your framework and return 401 Unauthorized for failed authentication.

Compatibility

This package requires Node.js >=18.18.0.

Resources

  • Repository: https://github.com/nimibyte/auditauth-sdk
  • Documentation: https://docs.auditauth.com

License

MIT