Interfaces
WellknownIdApi
window.WellknownId, once the script has run.
Methods
askFor()
askFor(paths): Promise<ClaimsAnswer>;
Asks the signed-in holder what their persona says about them (prd.md §4.10): paths are OpenID Connect's standard
claims ([['email'], ['name'], ['address', 'locality']]). Their wallet asks them, and answers as the persona they
signed in with here, only with what you asked for, stated by them (not proven). Call it from a click; it needs a
browser with the Digital Credentials API. unchecked is what was disclosed, to show; before relying on it, send
response, nonce and query to your server and check them there with verifyPersonaClaims(response, query, origin, nonce, now, sub) (@wellknown-id/wallet), passing your server's time and the sub you signed them in as.
Parameters
| Parameter | Type |
|---|---|
paths | string[][] |
Returns
Promise<ClaimsAnswer>
linkKey()
linkKey(): Promise<LoginResult>;
Links another wellknown.id to the account the page is signed in to (prd.md §4.9): a second sign-in in a popup, in
which the holder picks the other one. Call it from a click. Resolves the other sign-in's result, whose sub your
site links to the current account; nothing changes at wellknown.id. Also emitted as wellknown-id-link-success.
Returns
Promise<LoginResult>
WellknownIdEvents
The events the script dispatches on window, and their detail.
Properties
| Property | Type |
|---|---|
wellknown-id-link-success | CustomEvent<LoginResult> |
wellknown-id-login-failure | CustomEvent<LoginFailure> |
wellknown-id-login-success | CustomEvent<LoginResult> |
Type Aliases
ClaimsAnswer
type ClaimsAnswer = object;
What askFor resolves: what was disclosed (unchecked), and the answer, nonce and query for the site's server to check.
Properties
LoginFailure
type LoginFailure = object;
The detail of wellknown-id-login-failure: how it was trying, and why it ended (a message starting try_again asks for another click).
Properties
LoginResult
type LoginResult = object;
How a sign-in ended well: the detail of wellknown-id-login-success, and what linkKey() resolves.
Properties
ScriptParams
type ScriptParams = object;
What the script's URL takes, as query parameters: clientId (your domain; this page's hostname by default), mode
(default, fedcm, popup, popin, navigate), redirectUri (this page by default), backend (your endpoint
that redeems codes, on this origin), selfIssued (1: take self-issued tokens yourself, where your config allows
them), and target (the id of an element to put the button in). The element takes mode and client-id as
attributes, over the script's.