Skip to content

feat: add OAuth client attestation support for OID4VCI flows - #11

Merged
leifj merged 5 commits into
mainfrom
feat/client-attestation
Jul 14, 2026
Merged

leifj merged 5 commits into
mainfrom
feat/client-attestation

Conversation

@leifj

@leifj leifj commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Adds typed interfaces and a provider abstraction for OAuth client attestation in OID4VCI flows per draft-ietf-oauth-attestation-based-client-auth-04 §3.1.

Design Principle

wmp-js is backend-agnostic. The library defines the protocol types and transport plumbing; the caller provides the implementation for obtaining attestation credentials from their specific wallet provider infrastructure.

New Types

  • ClientAttestationProvider — interface that callers implement to obtain WIA + PoP
  • ClientAttestation — the WIA + PoP pair returned by the provider
  • OID4VCIFlowParams — typed params blob for OID4VCI flows (includes attestation fields)
  • OID4VPFlowParams — typed params blob for OID4VP flows

New Helpers

  • buildVCIFlowStart() — builds FlowStartParams for an OID4VCI flow
  • withAttestation(provider, audience, params) — calls the provider and merges attestation into flow params

Architecture

The wallet instance key never resides on the backend. The ClientAttestationProvider abstraction ensures wmp-js has zero dependency on any specific backend API.

Add types and helper for passing WIA + PoP through WMP flow.start params
per draft-ietf-oauth-attestation-based-client-auth-04 §3.1:

- OID4VCIFlowParams: typed interface for OID4VCI flow start params,
  including client_attestation and client_attestation_pop fields
- OID4VPFlowParams: typed interface for OID4VP flow start params
- buildVCIFlowStart(): helper to construct FlowStartParams with attestation

Architecture: The instance key lives client-side in passkey-PRF-encrypted
private data. The client signs the PoP locally (aud = issuer AS URL) and
passes both WIA + PoP at flow start. The backend forwards them as HTTP
headers without modification.

Aligns with go-wallet-backend PR #221 (WIA service) and PR #163 (WMP
integration) which consume these fields via FlowStartMessage JSON
deserialization.

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 typed parameter objects for OpenID4x flows and a convenience helper for constructing wmp.flow.start params, enabling OAuth client attestation (WIA + PoP) to be forwarded through WMP OID4VCI flows.

Changes:

  • Introduce OID4VCIFlowParams and OID4VPFlowParams for the FlowStartParams.params payload.
  • Add buildVCIFlowStart() helper to construct FlowStartParams for OID4VCI.
  • Export the new helper and types from the package entrypoint.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/openid4x.ts Adds new OID4VCI/OID4VP flow param types and a helper to build OID4VCI flow start params (including attestation fields).
src/index.ts Re-exports the new helper and types for public consumption.

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

Comment thread src/openid4x.ts Outdated
Comment thread src/openid4x.ts Outdated
leifj added 4 commits July 14, 2026 12:11
…dence

Decouple WIA/PoP acquisition from any specific backend API:

- Add ClientAttestationProvider interface: callers implement getAttestation(audience)
  to obtain WIA + PoP JWTs using their own backend/provider
- Add ClientAttestation type for the WIA + PoP pair
- Add withAttestation() helper that calls the provider and merges
  attestation into OID4VCIFlowParams
- Remove references to go-wallet-backend-specific endpoints in docs

The library provides the types and protocol plumbing; the caller provides
the implementation for obtaining attestation credentials from their
specific wallet provider infrastructure.
- Replace hard-coded "1.0" with the library's VERSION constant ("0.1")
  in buildVCIFlowStart() to match the protocol version.
- Refactor OID4VCIFlowParams into a discriminated union requiring exactly
  one of offer or credential_offer_uri, preventing invalid payloads.

Addresses review comments on #11.
…cation types

Addresses SonarCloud quality gate failure (0% coverage on new code).
- Add 'types: ["node"]' to tsconfig.json (required by TypeScript 6)
- Add @vitest/coverage-v8 and configure lcov coverage output
- Update SonarCloud workflow to run tests with coverage before scan
- Add sonar-project.properties with lcov report path
- Add coverage/ to .gitignore
@sonarqubecloud

Copy link
Copy Markdown

@leifj
leifj merged commit 13ef932 into main Jul 14, 2026
12 checks passed
@leifj
leifj deleted the feat/client-attestation branch July 14, 2026 11:27
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