Skip to content
Wallet and Entity Collection draft updates
Documentation menu

16.2. Discover a trusted wallet participant

Feature guides / 16. Wallet workflows · Example context

Before Maya shares driving licence information, Wallet Provider establishes whether Car Rental Company is a trusted verifier and obtains the effective metadata that governs its requests.

How to use it

Use the matching role's discover() method. It validates federation evidence and the selected role metadata, returning both metadata and a validated chain. WalletProviderRole and CredentialVerifierRole share this pattern; CredentialIssuerRole also resolves authorization servers. Trust discovery; Metadata verification.

If Wallet Provider supplies a custom chainSelection, discovery must finish within its configured limits before that selector runs. A truncated search returns an error instead of letting the application choose from an incomplete list.

import type { CryptoEngine } from "@oidfed/crypto";
import { CredentialVerifierRole } from "@oidfed/wallet";
import type { TrustAnchorSet } from "@oidfed/core";

export async function discoverCarRental(engine: CryptoEngine, anchors: TrustAnchorSet) {
  const result = await CredentialVerifierRole.discover("https://car-rental.example", anchors, { engine });
  if (!result.ok) return result;
  return result;
}

What your application owns

Configure accepted anchors independently of the request. Collection or listing results only identify candidates. Retain expiry with cached trust decisions and refresh when needed. Discovery authenticates the participant; the wallet still decides whether to release a credential and verifies the actual protocol request. Shared fetch limits cover the operation's related lookups.

Use the assessed participant for one purpose

When Maya's wallet discovers the Car Rental Company as a verifier, validate metadata for that role and retain the accepted path with its expiration. An accreditation issuer resolved along the way need not implement Car Rental Company's wallet role; its issuer trust has a separate purpose.

Apply any required Trust Marks to the verified results before using the participant. A candidate may be a valid federation entity yet unusable as this verifier under the selected policy. Return that distinction to the host's decision flow instead of silently using raw metadata from a rejected path.

Supplied chains and offline discovery

Wallet applications can use static methods without a federation identity:

import type { CryptoEngine } from "@oidfed/crypto";
import { CredentialIssuerRole, WalletProviderRole } from "@oidfed/wallet";
import { type TrustAnchorSet } from "@oidfed/core";

export async function discoverParticipants(
  engine: CryptoEngine,
  issuerId: string,
  providerId: string,
  trustAnchors: TrustAnchorSet,
) {
  const issuer = await CredentialIssuerRole.discover(issuerId, trustAnchors, { engine });
  if (!issuer.ok) throw new Error(issuer.error.description);

  const provider = await WalletProviderRole.discover(providerId, trustAnchors, { engine });
  if (!provider.ok) throw new Error(provider.error.description);
  return { issuer: issuer.value, provider: provider.value };
}

Discovery returns effective role metadata and a validated trust chain. Issuer discovery also validates the federation identities of the listed authorization servers. When authorization_servers is absent, it uses the issuer itself and requires its oauth_authorization_server metadata. If any credential configuration omits scope, at least one discovered server must advertise openid_credential in authorization_details_types_supported, following OpenID4VCI §12.2.4.

Issuer discovery uses authorizationServerPolicy: "all" by default. Set it to "available" to receive usable federation-validated servers in authorizationServers and failures in authorizationServerErrors. Discovery still fails if none are usable, the operation is cancelled, or its shared fetch budget is exhausted. OpenID4VCI §12.2.4 allows the wallet to select a listed server; the application selects one suitable for its flow and checks any Credential Offer server hint against the advertised list. Cached use requires both the issuer's trustChain.expiresAt and the selected server's trustChain.expiresAt to remain current.

The application dispatches supported client identifier prefixes and keeps its wallet metadata consistent with that support. OpenID4VP §10.1 defines client_id_prefixes_supported; omission advertises pre-registered. Include openid_federation when offering the federation request flow. Unknown metadata remains available for application-defined extensions; the schemas validate recognized fields in their specified locations.

Use existing List or Entity Collection APIs to find candidates, then discover each selected issuer independently. Collection data is informational. Applications choose when to repeat provider discovery to check current federation standing.

Discovery, verification, and signed-object creation accept core's HTTP client, clock, cancellation signal, cache, timeout, response-size limit, and fetch limits. Each operation shares its fetch budget across participant discovery, authorization-server discovery, and protocol-key retrieval. The default is 50 network calls.

trustChain supplies a preconstructed chain for the target. entityChains supplies additional chains keyed by subject. Every supplied chain is checked against the caller's pinned anchors. Explicit trustChain takes precedence over the matching entityChains entry; either is authoritative for that operation.

Inline Request Objects use the header chain when present, otherwise the payload trust_chain permitted by OpenID4VP §5.9.3. Completion removes this discovery hint from request and returns validated evidence through trustChain. Embedded attestation and inline Request Object chains are hints: when caller evidence is absent, the library tries the hint, then uses bounded online discovery if it cannot establish trust. Invalid header shapes, empty chains, and chains exceeding configured limits fail before discovery. Chains containing malformed statements can fall back to online discovery. Attestation signature failure after provider trust succeeds does not trigger fresh provider discovery. Request Object completion can fall back from an embedded hinted path when signature or contextual checks leave no eligible candidate, within the same budget. A replacement path must independently pass every request check; caller-supplied chains never trigger that fallback.

offline: true blocks library network requests during discovery, verification, and creation of Wallet Attestations and Request Objects. Keep application verification callbacks and custom signers offline too.

For multi-hop chains, validation also needs each intermediate's signed Entity Configuration to check its authority_hints. Discovery retains these ECs with each candidate, so validation reuses them even when the configured cache does not retain entries. For supplied chains, pass entityConfigurations, a map from exact Entity Identifier to signed EC JWT, or preload the ECs in the configured core cache. These inputs still undergo identity, signature, and claim validation.

Offline multi-hop integrations need supporting EC evidence: trustChain and entityChains contain the serialized statements, which omit intermediate ECs. A supplied chain without the required local ECs fails validation without making HTTP calls. Supply the protocol keys needed by the selected operation as well. These options also apply to external authorization-server chains.

import type { CryptoEngine } from "@oidfed/crypto";
import { WalletProviderRole } from "@oidfed/wallet";
import { type TrustAnchorSet, type ValidatedTrustChain } from "@oidfed/core";

export async function discoverOfflineProvider(
  engine: CryptoEngine,
  providerId: string,
  trustAnchors: TrustAnchorSet,
  providerTrustChain: readonly string[],
  intermediateId: string,
  intermediateEcJwt: string,
) {
  const provider = await WalletProviderRole.discover(providerId, trustAnchors, {
    engine,
    offline: true,
    trustChain: providerTrustChain,
    entityConfigurations: new Map([
      [intermediateId, intermediateEcJwt],
    ]),
  });
  return provider;
}

maxTotalFetches accepts non-negative safe integers. Set it to 0 to use supplied or cached evidence without transport; missing evidence produces an error. Discovery, candidate validation, external AS discovery, and protocol-key retrieval share one allowance. offline: true also blocks network calls.

Instance signing methods use an attached chain from the merged host, role, and per-call options. Anchor precedence is per-call trustAnchors, the role's dedicated trustAnchors, role.options.trustAnchors, then the host's anchors. You do not need to repeat a role-configured chain in each signing call.

Apply accreditation requirements

Wallet role discovery forwards the shared FederationOptions, including trustMarkVerification, trustMarkProfiles, and offline controls. Use trustMarkVerification: { mode: "resolve", trustAnchors: accreditationAnchors } when the issuer's accreditation framework has its own anchors, or supply authenticated issuer evidence for offline operation.

Apply checkTrustMarkRequirements() to the operation's validated chain when your application requires accreditation. Signature verification and current revocation status are separate decisions. Wallet §7.4 includes a Status endpoint check in its Trust Mark verification process. Wallet discovery does not perform that check automatically: call fetchTrustMarkStatus() as part of your integration when relying on accreditation. Offline operation cannot promise a live revocation answer; the framework must define which previously obtained evidence and lifetimes it permits. Type-only listing reduces disclosure of which subject is being checked, with the driving licence-versus-exact-JWT distinction described in core.

Choose local evidence or a resolver assessment

Role configuration accepts options for federation defaults, including chainSelection and trustResolution. Per-call options override role options, which override host options. Existing calls keep their default behavior when these settings are omitted.

Each role exposes static and instance assessEntity(target, entityType, ...) methods. Static calls take explicit anchors before options; instance calls use configured anchors or options.trustAnchors. The role validates metadata for the requested entity type. Local assessments select only among chains with usable protocol metadata. The protocol filter applies to the requested subject. Nested Trust Mark issuer discovery uses the issuer's accreditation rules, without requiring it to publish the subject's protocol metadata. If supplied, your chainSelection callback also receives eligible issuer chains, so it should handle each candidate's entityId. See Federation §17.5. Explicit resolver assessments authenticate the resolver's assertion and keep that provenance separate from local chain validation.

Wallet discovery, attestation verification, and presentation processing retain their profile-required chain and key checks. A resolver can supply the chain, but it cannot skip those checks. Presentation-request selection occurs after signature, endpoint, and contextual DCQL policy validation; an ineligible path is never offered to the selector. Supplied chains and offline supporting ECs keep their existing precedence.

See core trust establishment for configuration examples and the distinction between resolver acquisition and delegation.

Next: 16.3. Discover a Credential Issuer and its authorization servers

View source on GitHub