New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@avanio/jwt-util

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avanio/jwt-util

NodeJS JWT utils

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-70%
Maintainers
0
Weekly downloads
 
Created
Source

@avanio/jwt-util

This JWT utility is a simple tool to help verify JWT symmetric and asymmetric tokens.

Main features

IssuerManager

Manages multiple JWT issuers (symmetric and asymmetric) and can be used to get issuer key string or buffer. This is easy to add if already have valdation in plave for JWT tokens. (requires iss and kid to exists in token)

JwtManager

Wraps IssuerManager and can be used to verify JWT tokens.

Examples

Simple symmetric issuer

const privateKeyIssuer = new SymmetricIssuer(['http://localhost:8080']);
privateKeyIssuer.add('01', 'some-very-long-secret');

const issuerManager = new IssuerManager();
issuerManager.add(privateKeyIssuer);

await issuerManager.get('http://localhost:8080', '01'); // returns 'some-very-long-secret'

Azure multitenant issuer with one allowed tenant and JwtManager

const jwt = new JwtManager(new IssuerManager([new JwtAzureMultitenantTokenIssuer({allowedIssuers: [`https://sts.windows.net/${process.env.AZ_TENANT_ID}/`]})]));
// validate with jwt manager
const {isCached, body} = await jwt.verify(token);

Keywords

FAQs

Package last updated on 02 Jan 2025

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc