Skip to content
Wallet and Entity Collection draft updates
Documentation menu

16.3. Discover a Credential Issuer and its authorization servers

Feature guides / 16. Wallet workflows · Example context

Maya wants a Licensing Authority driving licence credential. Her wallet must find both the trusted issuer and an authorization server suitable for the issuance flow.

How to use it

CredentialIssuerRole.discover() validates the issuer and its advertised authorization servers. If authorization_servers is absent, the issuer itself must provide usable AS metadata. The default all policy fails on an unusable server; available permits selecting among usable servers and returns errors for the others. Wallet issuer discovery; VCI AS selection.

An AS supporting only the pre-authorized-code grant can omit response_types_supported; discovery recognizes that VCI metadata exception. Licensing Authority must still publish the correct credential_issuer identity wherever it supplies that field. A superior's later override cannot hide an incorrect declaration. Known credential and proof formats also retain their specified algorithm identifier types.

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

export async function discoverLicensingAuthority(engine: CryptoEngine, anchors: TrustAnchorSet) {
  const result = await CredentialIssuerRole.discover("https://licensing-authority.example", anchors, {
    engine,
    authorizationServerPolicy: "available",
  });
  if (!result.ok) return result;
  return result; // Host selects a returned authorization server suitable for its flow.
}

What your application owns

Match any Credential Offer server hint against the advertised list. Keep both issuer and selected server evidence current. Cancellation and exhausted budgets still stop discovery; available is not permission to ignore those failures. The wallet's OpenID4VCI engine performs authorization, token exchange, proof generation, encryption, and credential requests. Federation discovery does not implement those exchanges.

Check the issuer and its authorization servers

Licensing Authority can advertise an authorization server on the same entity or refer to another entity. Validate each server through the configured federation trust and OAuth metadata profile, and check that its issuer identifier matches the server being assessed.

Decide whether all advertised servers must be usable or whether the application may select from those that validate. This selection does not execute credential issuance or determine which grant Maya should use. Pass the trusted discovery result to the host's OpenID4VCI engine, which owns that exchange and its session state.

Authorization-server metadata and issuer identity

Credential-issuer discovery validates each authorization server's effective OAuth metadata with the shared core validator, whether the AS is the issuer itself or a separate entity. It still checks the issuer identifier against the discovered server. The default authorizationServerPolicy: "all" rejects an invalid server; "available" can skip one if another usable server remains. Cancellation and exhausted fetch budgets still stop discovery.

For independent AS checks, use core's parseOAuthAuthorizationServerMetadata(raw, { profile: "openid4vci" }) or parseOAuthAuthorizationServerPublicationMetadata(raw). The publication parser allows missing fields that a Superior can supply. Wallet discovery uses the VCI profile automatically: an AS advertising only the pre-authorized-code grant may omit both its authorization endpoint and response_types_supported, as permitted by VCI §12.2.4. The parser does not insert missing values or perform an issuance exchange.

Issuer discovery checks each available authenticated statement's supplied credential_issuer against its subject, as well as the final resolved value. A superior cannot hide an incorrect declaration by replacing it. Omitted fields can still be completed by superior metadata. Known credential and proof formats use their specified algorithm identifier types; extension formats and algorithm names remain open.

Next: 16.4. Issue a Wallet Attestation

View source on GitHub