Skip to content

feat!: adopt web-identity-schemas, drop zod v3#116

Merged
venables merged 3 commits into
mainfrom
feat/web-identity-schemas-adoption
Jun 23, 2026
Merged

feat!: adopt web-identity-schemas, drop zod v3#116
venables merged 3 commits into
mainfrom
feat/web-identity-schemas-adoption

Conversation

@venables

@venables venables commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Make web-identity-schemas (v0.3.0) the source of truth for DID/JWT/VC validation schemas and DID/JWT types, replacing ACK's hand-rolled definitions, and drop Zod v3 support (w-i-s ships Zod v4 only).

  • Zod v3 dropped + exports collapsed. Each package's ./schemas/zod/v3 + ./schemas/zod/v4 subpaths (and ./a2a/schemas/zod/*) collapse into a single ./schemas/zod (Zod v4). zod optional peer bumped to ^4.0.0; catalog zod4.4.3; web-identity-schemas added to the catalog.
  • DID (packages/did): didUriSchema → w-i-s DidSchema; isDidUri delegates to w-i-s isDid (full DID-core validation); DidUri re-exported from w-i-s Did.
  • JWT (packages/jwt): jwtPayloadSchema backed by w-i-s; JwtString re-exported from w-i-s. jwtStringSchema keeps ACK's non-empty-signature regex and jwtHeaderSchema keeps the narrow ES256/ES256K/EdDSA alg set.
  • VC (packages/vc): credentialSchema backed by w-i-s' unsigned CredentialV1Schema, preserving ACK's issuer string→{ id } normalization, type/@context array coercion, and JwtProof2020 passthrough. ACK's VC types (W3CCredential, Verifiable) stay local — did-jwt-vc remains the signing/verification engine.
  • CAIP, payment, A2A, controller-claim, and JwtProof2020 schemas remain hand-rolled (not covered by w-i-s).

Breaking changes

  • Dropped ./schemas/zod/v3 and ./schemas/zod/v4 exports → use ./schemas/zod. zod peer is now ^4.0.0.
  • didUriSchema/isDidUri and credentialSchema/isCredential validate more strictly (DID-core syntax; VC Data Model v1.1 shape). ACK-issued credentials are unaffected; the credential-verification path (parseJwtCredential/verifyParsedCredential) is unchanged. See the changeset for details.

Verification

pnpm run check is green (47/47 tasks: build + types + lint + format + test). publint clean for all published packages; knip clean. Includes a major changeset for the affected published packages.

AI usage disclosure

Per AI_POLICY.md: authored with Claude Code (Opus 4.8). The plan was hardened through a multi-agent panel-plan loop and the implementation through a panel-review loop (independent codex / claude / opencode CLI reviewers); all findings were triaged and addressed or documented by the author. A human is reviewing before merge.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Breaking Changes
    • Removed Zod v3 support; Zod v4 required (zod peer bumped to ^4.0.0), and versioned ./schemas/zod/v3 + ./schemas/zod/v4 entry points are gone in favor of a single ./schemas/zod.
    • DID and VC validation is stricter (now sourced from web-identity-schemas), with tighter schema/type validation and changed error details.
  • New Features
    • Centralized DID/JWT/VC schema definitions via web-identity-schemas, including updated type exports (e.g., DidUri, JwtString).
  • Documentation / Tests / Build
    • Updated schema import docs and adjusted validation test expectations; ensured additional build output is emitted for the secp256r1 curve.

Make `web-identity-schemas` (v0.3.0) the source of truth for DID/JWT/VC
validation schemas and DID/JWT types, and drop Zod v3 support.

- Collapse the `./schemas/zod/v3` + `./schemas/zod/v4` subpath exports into a
  single `./schemas/zod` (Zod v4) across every package (and `./a2a/schemas/zod`);
  bump the `zod` optional peer to `^4.0.0` and the catalog to `4.4.3`.
- `did`: `didUriSchema`/`isDidUri` now delegate to w-i-s `DidSchema`/`isDid`
  (full DID-core validation); `DidUri` re-exported from w-i-s `Did`.
- `jwt`: `jwtPayloadSchema` backed by w-i-s; `JwtString` re-exported from w-i-s;
  `jwtStringSchema` keeps ACK's non-empty-signature regex and `jwtHeaderSchema`
  keeps the narrow ES256/ES256K/EdDSA alg set.
- `vc`: `credentialSchema` backed by w-i-s `CredentialV1Schema`, preserving the
  issuer string->{id} normalization and `JwtProof2020` passthrough; ACK's VC
  types stay local (did-jwt-vc remains the signing engine).
- CAIP, payment, A2A, controller-claim, and JwtProof2020 schemas remain
  hand-rolled. Add `web-identity-schemas` as a dependency of did/jwt/vc.
- Update issuer route tests for the new DID validation error shape; update READMEs,
  AGENTS.md, and add a changeset.

AI usage: implemented by Claude Code (plan hardened via a multi-agent panel-plan
loop). See AI_POLICY.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3ba95936-c69b-411a-80cf-9f8274d9f695

📥 Commits

Reviewing files that changed from the base of the PR and between 14bd9ae and 6e4a3fe.

📒 Files selected for processing (2)
  • .changeset/keys-secp256r1-export.md
  • packages/keys/tsdown.config.ts
✅ Files skipped from review due to trivial changes (1)
  • .changeset/keys-secp256r1-export.md

Walkthrough

Adopts web-identity-schemas as the source of truth for DID, JWT, and VC validation schemas across @agentcommercekit/did, jwt, and vc. Drops Zod v3 support and removes all ./schemas/zod/v3 and ./schemas/zod/v4 split entry points, consolidating to a single ./schemas/zod (Zod v4) export per package. Bumps the zod peer dependency to ^4.0.0 across all packages. Also adds missing secp256r1 build entry to fix the keys package subpath export.

Changes

web-identity-schemas adoption and Zod v3 removal

Layer / File(s) Summary
Workspace catalog and changeset
pnpm-workspace.yaml, .changeset/web-identity-schemas-adoption.md
Adds web-identity-schemas and bumps zod to 4.4.3 in the workspace catalog; changeset documents all breaking changes including dropped Zod v3, stricter DID validation, tightened VC schema enforcement, and re-exported types.
DID: DidUri type, isDidUri guard, and schemas
packages/did/src/did-uri.ts, packages/did/src/schemas/valibot.ts, packages/did/src/schemas/zod.ts, packages/did/package.json, packages/did/tsdown.config.ts
Aliases DidUri to web-identity-schemas' Did type and delegates isDidUri to isDid; rewrites valibot schema and creates a new zod.ts both backed by DidSchema; removes zod/v3 and zod/v4 split files; updates package exports to ./dist/schemas/zod.* and build entry.
JWT: JwtString type, payload schema, and Zod entry
packages/jwt/src/jwt-string.ts, packages/jwt/src/schemas/valibot.ts, packages/jwt/src/schemas/zod.ts, packages/jwt/package.json, packages/jwt/tsdown.config.ts
Re-exports JwtString from web-identity-schemas; replaces local valibot jwtPayloadSchema with JwtPayloadSchema and removes its v.transform cast; creates new zod.ts with jwtPayloadSchema, jwtHeaderSchema, and jwtStringSchema; removes zod/v3 and zod/v4 split files; updates package exports and build entry.
VC: credentialSchema backed by CredentialV1Schema
packages/vc/src/schemas/valibot.ts, packages/vc/src/schemas/zod.ts, packages/vc/package.json, packages/vc/tsdown.config.ts
Replaces the local baseSchema in valibot with CredentialV1Schema while preserving issuer/type/@context normalization transforms; creates new zod.ts with credentialSchema, jwtProofSchema, and bitstringStatusListClaimSchema; removes zod/v3 and zod/v4 split files; updates package exports and build entry.
CAIP, ack-id, ack-pay: Zod v3/v4 removal and import updates
packages/caip/src/schemas/zod.ts, packages/caip/src/schemas/schemas.test.ts, packages/caip/package.json, packages/caip/tsdown.config.ts, packages/ack-id/src/schemas/zod.ts, packages/ack-id/src/a2a/schemas/zod.ts, packages/ack-id/package.json, packages/ack-id/tsdown.config.ts, packages/ack-pay/src/schemas/zod.ts, packages/ack-pay/package.json, packages/ack-pay/tsdown.config.ts
Removes zod/v3 and zod/v4 versioned schema files from caip, ack-id, and ack-pay; updates all Zod imports from zod/v3/zod/v4 to bare zod; updates package export maps to the consolidated ./schemas/zod entry; bumps peerDependencies.zod to ^4.0.0.
agentcommercekit barrel consolidation
packages/agentcommercekit/src/schemas/zod.ts, packages/agentcommercekit/src/a2a/schemas/zod.ts, packages/agentcommercekit/src/schemas/zod/v3.ts, packages/agentcommercekit/src/a2a/schemas/zod/v3.ts, packages/agentcommercekit/src/a2a/schemas/zod/v4.ts, packages/agentcommercekit/package.json, packages/agentcommercekit/tsdown.config.ts
Populates the root schemas/zod.ts barrel with re-exports from all sub-packages; wires a2a/schemas/zod.ts to re-export from ack-id; removes v3 and v4 barrel files; updates root package.json exports and tsdown build entries.
Docs, tests, demo, and AGENTS updates
AGENTS.md, packages/agentcommercekit/AGENTS.md, packages/caip/AGENTS.md, packages/ack-id/README.md, packages/ack-pay/README.md, packages/caip/README.md, packages/did/README.md, packages/jwt/README.md, packages/vc/README.md, demos/skyfire-kya/src/kya-token.ts, examples/issuer/src/routes/credentials.test.ts, examples/issuer/src/routes/receipts.test.ts, demos/e2e/src/index.ts
Updates all package READMEs and AGENTS files to show single ./schemas/zod imports and reflect Valibot-primary guidance; adjusts issuer example test assertions to match the changed DID validation error shape; updates the skyfire-kya demo to use .and(jwtPayloadSchema) composition and unversioned imports; minor demo output formatting.

keys package secp256r1 subpath export build

Layer / File(s) Summary
secp256r1 build entry
packages/keys/tsdown.config.ts, .changeset/keys-secp256r1-export.md
Adds src/curves/secp256r1.ts to the tsdown build entry list so the exported subpath emits compiled outputs and resolves correctly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat!: adopt web-identity-schemas, drop zod v3' accurately and concisely captures the primary objectives of the changeset—adopting web-identity-schemas and discontinuing Zod v3 support across the monorepo.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/web-identity-schemas-adoption

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 44-52: The fenced code block in AGENTS.md displaying the directory
structure (starting with `src/schemas/` and showing the valibot.ts and zod.ts
files) is missing a language identifier on the opening triple backticks, which
violates the MD040 markdownlint rule. Add an appropriate language tag such as
`text` or `bash` to the opening backticks of this code fence to resolve the
linting error.

In `@packages/did/package.json`:
- Line 67: The peerDependency for zod in packages/did/package.json uses a caret
version range (^4.0.0) which violates the exact version policy for
peerDependencies. Update the zod entry to use an exact version by removing the
caret prefix, changing it from "^4.0.0" to "4.0.0". Apply the same fix to
packages/vc/package.json and ensure all other peerDependencies (valibot,
`@a2a-js/sdk`) across the workspace follow the same exact version pattern to
maintain consistency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9001f656-a368-4cc4-89d2-5d3fd1d0e83c

📥 Commits

Reviewing files that changed from the base of the PR and between 9227943 and 87035ac.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (57)
  • .changeset/web-identity-schemas-adoption.md
  • AGENTS.md
  • demos/skyfire-kya/src/kya-token.ts
  • examples/issuer/src/routes/credentials.test.ts
  • examples/issuer/src/routes/receipts.test.ts
  • packages/ack-id/README.md
  • packages/ack-id/package.json
  • packages/ack-id/src/a2a/schemas/zod.ts
  • packages/ack-id/src/a2a/schemas/zod/v3.ts
  • packages/ack-id/src/schemas/zod.ts
  • packages/ack-id/src/schemas/zod/v4.ts
  • packages/ack-id/tsdown.config.ts
  • packages/ack-pay/README.md
  • packages/ack-pay/package.json
  • packages/ack-pay/src/schemas/zod.ts
  • packages/ack-pay/src/schemas/zod/v3.ts
  • packages/ack-pay/tsdown.config.ts
  • packages/agentcommercekit/AGENTS.md
  • packages/agentcommercekit/package.json
  • packages/agentcommercekit/src/a2a/schemas/zod.ts
  • packages/agentcommercekit/src/a2a/schemas/zod/v3.ts
  • packages/agentcommercekit/src/a2a/schemas/zod/v4.ts
  • packages/agentcommercekit/src/schemas/zod.ts
  • packages/agentcommercekit/src/schemas/zod/v3.ts
  • packages/agentcommercekit/src/schemas/zod/v4.ts
  • packages/agentcommercekit/tsdown.config.ts
  • packages/caip/AGENTS.md
  • packages/caip/README.md
  • packages/caip/package.json
  • packages/caip/src/schemas/schemas.test.ts
  • packages/caip/src/schemas/zod.ts
  • packages/caip/src/schemas/zod/v4.ts
  • packages/caip/tsdown.config.ts
  • packages/did/README.md
  • packages/did/package.json
  • packages/did/src/did-uri.ts
  • packages/did/src/schemas/valibot.ts
  • packages/did/src/schemas/zod.ts
  • packages/did/src/schemas/zod/v3.ts
  • packages/did/src/schemas/zod/v4.ts
  • packages/did/tsdown.config.ts
  • packages/jwt/README.md
  • packages/jwt/package.json
  • packages/jwt/src/jwt-string.ts
  • packages/jwt/src/schemas/valibot.ts
  • packages/jwt/src/schemas/zod.ts
  • packages/jwt/src/schemas/zod/v3.ts
  • packages/jwt/src/schemas/zod/v4.ts
  • packages/jwt/tsdown.config.ts
  • packages/vc/README.md
  • packages/vc/package.json
  • packages/vc/src/schemas/valibot.ts
  • packages/vc/src/schemas/zod.ts
  • packages/vc/src/schemas/zod/v3.ts
  • packages/vc/src/schemas/zod/v4.ts
  • packages/vc/tsdown.config.ts
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (16)
  • packages/jwt/src/schemas/zod/v3.ts
  • examples/issuer/src/routes/receipts.test.ts
  • packages/agentcommercekit/src/schemas/zod/v4.ts
  • packages/ack-id/src/a2a/schemas/zod/v3.ts
  • packages/ack-pay/src/schemas/zod/v3.ts
  • packages/ack-id/src/schemas/zod/v4.ts
  • packages/vc/src/schemas/zod/v4.ts
  • packages/vc/src/schemas/zod/v3.ts
  • packages/agentcommercekit/src/a2a/schemas/zod/v4.ts
  • packages/agentcommercekit/src/schemas/zod/v3.ts
  • packages/jwt/src/schemas/zod/v4.ts
  • packages/did/src/schemas/zod/v4.ts
  • packages/agentcommercekit/src/a2a/schemas/zod/v3.ts
  • packages/caip/src/schemas/zod/v4.ts
  • packages/did/src/schemas/zod/v3.ts
  • examples/issuer/src/routes/credentials.test.ts

Comment thread AGENTS.md
Comment on lines +44 to +52
Valibot is primary (runtime dependency); Zod (v4) is an optional peer everywhere. Standards-tracked DID/JWT/VC schemas come from the [`web-identity-schemas`](https://github.com/catena-labs/web-identity-schemas) package; ACK only hand-rolls the schemas w-i-s doesn't cover (CAIP, payment, A2A, controller-claim, JwtProof2020). Each package exposes schemas through two files / two export paths:

```
src/schemas/
├── valibot.ts → ./schemas/valibot
└── zod/
├── v3.ts → ./schemas/zod/v3 AND ./schemas/zod (alias)
└── v4.ts → ./schemas/zod/v4
└── zod.ts → ./schemas/zod (zod v4 only; zod v3 is not supported)
```

Adding a new type requires updating all three schema files **and** the `exports` map in `package.json` **and** the entry array in `tsdown.config.ts`. (`keys` is the exception — it exports curve-specific files and encoding, no schemas.)
Adding a new type requires updating both schema files **and** the `exports` map in `package.json` **and** the entry array in `tsdown.config.ts`. (`keys` is the exception — it exports curve-specific files and encoding, no schemas.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add a language tag to the example fence.

The fenced block at Line 46 is missing a language identifier, which triggers MD040 in markdownlint.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 46-46: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AGENTS.md` around lines 44 - 52, The fenced code block in AGENTS.md
displaying the directory structure (starting with `src/schemas/` and showing the
valibot.ts and zod.ts files) is missing a language identifier on the opening
triple backticks, which violates the MD040 markdownlint rule. Add an appropriate
language tag such as `text` or `bash` to the opening backticks of this code
fence to resolve the linting error.

Source: Linters/SAST tools

Comment thread packages/did/package.json
},
"peerDependencies": {
"zod": "^3.25.0"
"zod": "^4.0.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Checking exact-version policy signal:"
rg -n '^save-exact\s*=\s*true$' .npmrc || true

echo
echo "Current zod peerDependency specs across packages:"
fd -a '^package\.json$' packages --exec jq -r '
  .name as $name
  | (.peerDependencies.zod // empty) as $peer
  | if $peer == empty then empty else "\($name)\t\($peer)" end
' {}

Repository: agentcommercekit/ack

Length of output: 265


🏁 Script executed:

# Check the actual content at the specified lines
echo "=== packages/did/package.json around line 67 ==="
sed -n '60,75p' packages/did/package.json | cat -n

echo
echo "=== packages/vc/package.json around line 64 ==="
sed -n '57,72p' packages/vc/package.json | cat -n

Repository: agentcommercekit/ack

Length of output: 1016


🏁 Script executed:

# Check all peerDependencies across the workspace
echo "=== All peerDependencies in the workspace ==="
fd -a '^package\.json$' packages --exec jq -r '
  .name as $name
  | (.peerDependencies // {}) as $peers
  | if $peers | length > 0 then
      $peers | to_entries[] | "\($name)\t\(.key)\t\(.value)"
    else empty end
' {} | sort

Repository: agentcommercekit/ack

Length of output: 1993


🏁 Script executed:

# Check all peerDependencies in the workspace
echo "=== All peerDependencies in the workspace ==="
find packages -name 'package.json' -type f | while read file; do
  jq -r '.name as $name | (.peerDependencies // {}) as $peers | if $peers | length > 0 then $peers | to_entries[] | "\($name)\t\(.key)\t\(.value)" else empty end' "$file"
done | sort

Repository: agentcommercekit/ack

Length of output: 624


🏁 Script executed:

# Check for peerDependencies mentions in documentation or config
echo "=== Searching for peerDependencies references ==="
rg -i 'peerdepend' --type md --type txt --type json . 2>/dev/null | head -20

echo
echo "=== Check .npmrc for any peer-related settings ==="
cat .npmrc

Repository: agentcommercekit/ack

Length of output: 1072


🏁 Script executed:

# Check for any README or contributing guidelines that explain dependency versioning
echo "=== Checking for documentation about dependencies ==="
find . -maxdepth 2 -type f \( -name "README*" -o -name "CONTRIBUTING*" -o -name ".github" -type d \) | head -10

echo
echo "=== Check pnpm-workspace.yaml for catalog definitions ==="
cat pnpm-workspace.yaml | head -50

Repository: agentcommercekit/ack

Length of output: 850


Pin peerDependencies.zod to exact version or document exemption.

"zod": "^4.0.0" in both packages/did/package.json (line 67) and packages/vc/package.json (line 64) violates the exact version policy. This pattern is consistent across all peerDependencies in the workspace (zod, valibot, @a2a-js/sdk all use caret ranges). Either enforce exact versions for peerDependencies workspace-wide, or explicitly document this as an intentional exemption in coding guidelines.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/did/package.json` at line 67, The peerDependency for zod in
packages/did/package.json uses a caret version range (^4.0.0) which violates the
exact version policy for peerDependencies. Update the zod entry to use an exact
version by removing the caret prefix, changing it from "^4.0.0" to "4.0.0".
Apply the same fix to packages/vc/package.json and ensure all other
peerDependencies (valibot, `@a2a-js/sdk`) across the workspace follow the same
exact version pattern to maintain consistency.

Source: Coding guidelines

venables and others added 2 commits June 23, 2026 06:36
The `./secp256r1` export was declared in package.json but its entry was missing
from tsdown.config.ts, so dist/curves/secp256r1.{js,d.ts} were never emitted —
importing `@agentcommercekit/keys/secp256r1` failed and publint flagged the
missing files. Add the build entry so the export resolves.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@domleboss97 domleboss97 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@venables venables merged commit 8e9cf8e into main Jun 23, 2026
3 checks passed
@venables venables deleted the feat/web-identity-schemas-adoption branch June 23, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants