@agenticprimitives/verifiable-credentials

中文文档
0.0.0-alpha.43发布于 2026/10/26MITTypeScriptES Module近 30 天下载 9031

W3C Verifiable Credentials envelope + Eip712Signature2026 proof + DOLCE+DnS Situation bases + ontology-shape schema registration. Substrate for layers 12–15 credential types.

原始使用文档
文档目录4 节
  1. What ships today
  2. How it's different
  3. Status
  4. Build

@agenticprimitives/verifiable-credentials

Part of Agentic Primitives — the open-source trust substrate for agentic applications: identity that can sign, authority checked at act time, evidence the owner carries. Developer kit · All packages

A credential is only as durable as the identity it points at. Most verifiable-credential stacks bind claims to a key — and when the key rotates, the trust graph quietly breaks. Here the issuer and subject of every credential is a Smart Agent address: a persistent ERC-4337 account whose keys are replaceable facets. Rotate a passkey, recover from a lost device, swap a signer — the address persists, and every credential issued by or about it stays verifiable.

This package is the W3C VC 2.0 envelope for that model: an Eip712Signature2026 proof signed by a smart account and verified with an ERC-1271 round-trip against the chain, plus the RFC 8785 (JCS) canonical hash that every downstream registry stores as the on-chain anchor. It is the substrate layer — specific credential types (associations, agreements, evidence, outcomes, receipts) are composed on top by consumer packages.

Part of agenticprimitives — the trust substrate for the agent economy: one canonical Smart Agent identity with custody, delegation, naming, credentials, and audit evidence designed as one system.

What ships today

  • W3C VC 2.0 envelope — @context, type, issuer, validFrom, credentialSubject, proof, credentialStatus (VerifiableCredential, UnsignedCredential types).
  • Eip712Signature2026 proof — signCredential(unsigned, signer) produces the proof; eip712Digest(...) matches the Solidity verifier byte-for-byte (cross-stack typehash equality, CI-gated per spec 242 §4.3).
  • Verifier — verifyCredential(vc, client) runs structural checks, recomputes the digest, and verifies the issuer signature via ERC-1271 against the issuer's Smart Agent. One mechanism, no silent fallbacks (ADR-0013). verifyCredentialStructural(vc) is the offline subset.
  • Canonical hash — credentialHash(vc) / canonicalHash(...) / jcsCanonicalize(...): the RFC 8785 JCS hash used as the credential anchor everywhere downstream (attestation registries, vault indexes, status lists).
  • DOLCE+DnS Situation pattern — buildSituation(...) and the Situation / DescriptionRef / RoleName shapes that all substrate credential subjects compose against.
  • Schema URIs — buildShapeUri / parseShapeUri / shapeHash for the did:shape:<name>:<version> convention that pairs with the on-chain ShapeRegistry.
import { credentialHash, verifyCredential } from '@agenticprimitives/verifiable-credentials';

const anchor = credentialHash(vc);                 // RFC 8785 JCS hash — what registries store
const result = await verifyCredential(vc, client); // ERC-1271 round-trip against the issuer Smart Agent

How it's different

Veramo, Trinsic, and the broader W3C VC tooling ecosystem resolve issuers through DID methods and key registries — so credential validity is coupled to key material. Here the issuer is a CAIP-10 smart-account address and verification is ERC-1271 against the chain: keys rotate, the address persists, credentials survive recovery (ADR-0011). And because the EIP-712 digest is locked to its Solidity counterpart by a CI gate, the contracts and the SDK are one artifact — the client cannot drift from the chain, which is precisely where stitched VC stacks decay.

The package is deliberately a leaf: it imports only types, ontology, viem, and @noble/hashes, and defines no specific credential types — attestations, agreements, fulfillment, and payments own those.

Status

W1 foundational — implemented and security-load-bearing. The envelope, proof, canonical hash, and verifier ship today and are exercised by downstream packages; verifier findings VC-1/VC-2 are closed (see AUDIT.md). Alternative proof types (BBS+ / SD-JWT / AnonCreds) have a reserved envelope slot and land in later waves per the W1 implementation wave plan.

Testnet/pilot-ready. Production launch is gated on the public checklist in the root README — including third-party contract audit and governance key rotation. Track every security finding live in docs/audits/findings.yaml.

Authoritative spec: specs/242-trust-credentials-and-public-assertions.md §4 — see spec.md for the symlink. Bounded surface: CLAUDE.md + capability.manifest.json.

Build

pnpm --filter @agenticprimitives/verifiable-credentials typecheck
pnpm --filter @agenticprimitives/verifiable-credentials test
pnpm --filter @agenticprimitives/verifiable-credentials build

版本与发布记录

@agenticprimitives/verifiable-credentials 共发布 42 个版本,首次发布于 2026/06/08;过去 12 个月发布了 42 个版本。

版本发布日期距今
0.0.0-alpha.43latest2026/10/2610 天前
0.0.0-alpha.422026/10/2610 天前
0.0.0-alpha.412026/10/1720 天前
0.0.0-alpha.402026/10/1720 天前
0.0.0-alpha.392026/10/1620 天前
0.0.0-alpha.382026/10/1620 天前

其他发布通道:alpha → 0.0.0-alpha.3。

关于 @agenticprimitives/verifiable-credentials 的常见问题

@agenticprimitives/verifiable-credentials 是什么?

W3C Verifiable Credentials envelope + Eip712Signature2026 proof + DOLCE+DnS Situation bases + ontology-shape schema registration. Substrate for layers 12–15 credential types.

如何安装 @agenticprimitives/verifiable-credentials?

在项目目录运行 npm install @agenticprimitives/verifiable-credentials,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:viem(^2.52.2)、@agenticprimitives/types(^1.0.0-alpha.46)、@agenticprimitives/ontology(^1.0.0-alpha.46)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@agenticprimitives/verifiable-credentials 支持 TypeScript 吗?

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

@agenticprimitives/verifiable-credentials 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agenticprimitives/verifiable-credentials 可以商用吗?

@agenticprimitives/verifiable-credentials 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agenticprimitives/verifiable-credentials 的下载量有多少?

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

@agenticprimitives/verifiable-credentials 还在维护吗?

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