@dnsid-ai/jose

中文文档
0.37.0发布于 2026/11/12Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 1993

DNSid JOSE JWT and JWS profile helpers.

原始使用文档
文档目录3 节
  1. Install
  2. Example
  3. Verification

@dnsid-ai/jose

DNSid JOSE profile helpers for JWT and JWS workflows.

This package builds on @dnsid-ai/protocol contracts and does not perform DNS or HTTPS transport itself. Provide an identity resolver and key provider directly, or construct the profile from a signing IdentityManager.

Install

npm install @dnsid-ai/jose @dnsid-ai/protocol

Example

import { createJoseProfile } from '@dnsid-ai/jose';

const joseProfile = createJoseProfile({
  domain: 'agent.example',
  keyProvider,
  identityResolver,
});

Verification

A verification-only profile may omit domain and keyProvider:

const verifier = createJoseProfile({ identityResolver });
await verifier.verifyJWT(token, {
  expectedAudience: 'service.example', // trusted configuration, never token-derived
  peerCert, // trusted current application peer; required for fl=mtls
  timeoutMs: 5000,
  signal,
});
await verifier.verifyJWS(jws, { peerCert, signal });

Both helpers default to a 30-second overall deadline and pass cancellation to identity discovery. Compact tokens are limited to 1 MiB and encoded headers to 16 KiB before decoding. Duplicate JSON members, unsupported critical/unencoded headers, and incorrectly typed claims are rejected before discovery. Expiration has no skew grace and is checked again after verification; fractional NumericDates and explicit zero clock skew are supported. Explicit invalid lifetimes are errors. fl=logchk remains caller-owned operation policy.

@dnsid-ai/sdk also re-exports this package as jose and exports JoseProfile / createJoseProfile directly.

版本与发布记录

@dnsid-ai/jose 共发布 22 个版本,首次发布于 2026/09/22;过去 12 个月发布了 22 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.37.0latest2026/11/122 天前
0.36.02026/11/113 天前
0.35.02026/11/068 天前
0.34.02026/10/3015 天前
0.33.02026/10/2817 天前
0.32.02026/10/2718 天前

关于 @dnsid-ai/jose 的常见问题

@dnsid-ai/jose 是什么?

DNSid JOSE JWT and JWS profile helpers.

如何安装 @dnsid-ai/jose?

在项目目录运行 npm install @dnsid-ai/jose,或使用 pnpm add / yarn add / bun add。

@dnsid-ai/jose 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dnsid-ai/jose 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@dnsid-ai/jose 可以商用吗?

@dnsid-ai/jose 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@dnsid-ai/jose 的下载量有多少?

根据 npm 官方下载统计,@dnsid-ai/jose 在 2026/10/13 – 2026/11/11 这 30 天内被下载 1,993 次,日均约 66 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dnsid-ai/jose 还在维护吗?

最新版本 0.37.0 发布于 2026/11/12(2 天前);至今共发布 22 个版本,其中过去 12 个月发布了 22 个;首次发布于 2026/09/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。