Skip to content

feat(core): named verifiers#111

Merged
dogganidhal merged 2 commits into
mainfrom
add-named-verifiers
Jul 9, 2026
Merged

feat(core): named verifiers#111
dogganidhal merged 2 commits into
mainfrom
add-named-verifiers

Conversation

@dogganidhal

Copy link
Copy Markdown
Contributor

Summary

  • InboundSource.verify now accepts a named map — verify: { current: Secret(NEW), legacy: Secret(OLD) } — alongside the existing Verifier and ReadonlyArray<Verifier> forms.
  • The verified result gains matchedVerifier: string (the matched key) when the map form is used, in addition to the existing matchedVerifierIndex. The array and single-Verifier forms are unchanged — matchedVerifier is absent (not merely undefined) for those.
  • First-match-wins ordering, ConfigurationError/TimestampTooOld rethrow-not-swallow, and failure aggregation behave identically across all three forms — the composition loop normalizes them into one ordered list before iterating, so there's no per-form duplication.
  • Purely additive: no existing config or result shape changes.

Closes #96.

Capability

  • api-surface-typescript: MODIFIED "Verifier strategy composition" — adds the named-map form and the matchedVerifier result field (4 new scenarios; the 5 existing scenarios are untouched).

Test plan

  • New tests in postel-factory.test.ts: named-map reports matched name, named-map composes with cross-scheme migration, array/single forms carry no matchedVerifier key, named-map ConfigurationError rethrow
  • All existing "Verifier strategy composition" tests (array, single-verifier, no-match, ConfigurationError) pass unchanged
  • pnpm typecheck / pnpm test / pnpm lint / pnpm build green across all 27 packages
  • mise run check:all green after archiving
  • Docs: docs/content/docs/inbound/key-rotation.mdx gains a named-map example

Inbound sources' verify slot now accepts a named map (Record<string,
Verifier>) alongside the existing Verifier/array forms. The verified
result reports matchedVerifier (the matched key) in addition to
matchedVerifierIndex, so "which verifier matched" survives config
reordering instead of relying on a positional index. Purely additive:
existing array/single-verifier configs and result shapes are unchanged.

Copilot AI 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.

Pull request overview

Adds support for named verifier composition for TypeScript inbound verification, allowing configurations like verify: { current: Secret(...), legacy: Secret(...) } and returning a stable matchedVerifier key (in addition to matchedVerifierIndex) when the map form is used.

Changes:

  • Extend InboundSource.verify to accept a VerifierMap (Record<string, Verifier>) and normalize all verify-shapes through a shared ordered iteration path.
  • Add matchedVerifier?: string to ComposedVerifyResult, present only for the named-map form (absent for array/single forms).
  • Update the TypeScript API-surface spec and docs to describe the named-map form and matchedVerifier.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
typescript/packages/core/test/postel-factory.test.ts Adds scenarios/tests for named-map verifier composition and result shape behavior.
typescript/packages/core/src/index.ts Re-exports VerifierMap type from inbound types.
typescript/packages/core/src/inbound.ts Implements VerifierMap, verifier-shape normalization, and conditional matchedVerifier reporting.
openspec/specs/api-surface-typescript/spec.md Updates the “Verifier strategy composition” requirement and adds named-map scenarios.
openspec/changes/archive/2026-07-09-add-named-verifiers/tasks.md Archived OpenSpec task checklist for the change.
openspec/changes/archive/2026-07-09-add-named-verifiers/specs/api-surface-typescript/spec.md Archived delta spec capturing the modified requirement/scenarios.
openspec/changes/archive/2026-07-09-add-named-verifiers/proposal.md Archived proposal describing motivation, scope, and impact.
openspec/changes/archive/2026-07-09-add-named-verifiers/language-impact.md Archived per-language impact assessment.
openspec/changes/archive/2026-07-09-add-named-verifiers/.openspec.yaml Archived change metadata.
docs/content/docs/inbound/key-rotation.mdx Documents named-map verifier usage and matchedVerifier for key rotation metrics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread typescript/packages/core/test/postel-factory.test.ts
The test only asserted postel.inbound.api.verify was a function, so it
would still pass even if named-map normalization broke mixed-mode
composition or stopped setting matchedVerifier. Now performs a real
Ed25519/JWKS verification (mirroring verify-keyset.test.ts's fixture
pattern) and asserts matchedVerifier === "jwks" and
matchedVerifierIndex === 1.
@dogganidhal
dogganidhal merged commit 73d51f4 into main Jul 9, 2026
7 checks passed
@dogganidhal
dogganidhal deleted the add-named-verifiers branch July 9, 2026 14:18
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.

Named verifiers (report which verifier matched by name)

2 participants