v151 · identity · credentials.get

Compliant request builder

Assemble a presentation-only navigator.credentials.get({ digital: { requests } }) call, pre-flight each protocol with userAgentAllowsProtocol(), then explicitly send it. Issuance uses navigator.credentials.create() and a different protocol enum.

Request protocols
Shared illustrative request data (copied to each selected protocol)

This builder validates JSON and browser protocol policy, not protocol-specific payload semantics. Replace this illustrative object with valid request data for every selected presentation protocol before sending.

navigator.credentials.get() argument

Pre-flight the presentation protocols above, then send. Browser policy allowing a protocol does not prove that a provider, wallet, matching credential, or valid request payload is available.

How it works

const requests = protocols.map(p => ({ protocol: p, data }));
// pre-flight: skip protocols the UA won't broker
const allows = globalThis.DigitalCredential?.userAgentAllowsProtocol;
const ok = typeof allows === "function" &&
  requests.every(r => DigitalCredential.userAgentAllowsProtocol(r.protocol));

const controller = new AbortController();
const cred = await navigator.credentials.get({
  digital: { requests },
  signal: controller.signal,     // so it can't hang forever
});

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗