🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@peac/jwks-cache

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peac/jwks-cache

Edge-safe JWKS fetch and cache with SSRF protection

next
latest
Source
npmnpm
Version
0.16.4
Version published
Maintainers
1
Created
Source

@peac/jwks-cache

Edge-safe JWKS fetch and cache with SSRF protection for PEAC receipt verification.

Installation

pnpm add @peac/jwks-cache

What It Does

@peac/jwks-cache provides a secure JWKS (JSON Web Key Set) resolver with built-in SSRF prevention, in-memory caching with Cache-Control awareness, and Ed25519 key import. It validates URLs against metadata IP ranges before fetching and caches resolved keys to minimize network requests during receipt verification.

How Do I Use It?

Create a JWKS resolver and look up a key

import { createResolver, resolveKey } from '@peac/jwks-cache';

const resolver = createResolver({
  cacheTtlMs: 300_000, // 5 minutes
});

const key = await resolveKey(resolver, {
  jwksUri: 'https://issuer.example.com/.well-known/jwks.json',
  kid: 'key-2026-03',
});

console.log(key.algorithm); // 'Ed25519'

Validate a URL for SSRF safety

import { validateUrl, isMetadataIp } from '@peac/jwks-cache';

validateUrl('https://issuer.example.com/.well-known/jwks.json'); // passes
validateUrl('http://169.254.169.254/latest/meta-data'); // throws: metadata IP

Use the in-memory cache directly

import { InMemoryCache, buildJwksCacheKey } from '@peac/jwks-cache';

const cache = new InMemoryCache({ maxEntries: 100 });

const cacheKey = buildJwksCacheKey('https://issuer.example.com/.well-known/jwks.json', 'key-1');
await cache.set(cacheKey, { jwk, expiresAt: Date.now() + 300_000 });

Integrates With

  • @peac/http-signatures: Key resolution for RFC 9421 signature verification
  • @peac/protocol (Layer 3): Receipt verification with remote key resolution
  • @peac/server (Layer 5): Verification server JWKS fetching with circuit breaker

For Agent Developers

If you are building an AI agent or MCP server that needs evidence receipts:

  • Start with @peac/mcp-server for a ready-to-use MCP tool server
  • Use @peac/protocol for programmatic receipt issuance and verification
  • See the llms.txt for a concise overview

License

Apache-2.0

PEAC Protocol is an open source project stewarded by Originary and community contributors.

Docs | GitHub | Originary

Keywords

peac

FAQs

Package last updated on 09 Aug 2026

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