OpenId4VciKtorClient

constructor(httpClient: HttpClient, oauth2Client: OAuth2Client, vciClient: OpenId4VciClient = OpenId4VciClient(proofCreators = listOf(JwtProofCreator(EphemeralKeyWithoutCert()))), clientAttestation: ClientAttestation? = null, dpopKeyMaterial: KeyMaterial = clientAttestation?.keyMaterial ?: EphemeralKeyWithoutCert(), issuerMetadataValidator: IssuerMetadataValidator = IssuerMetadataValidator())(source)

Parameters

httpClient

the app's ktor client, i.e. with its engine, cookie storage (advised to be persistent, to keep the session at the issuing service alive after receiving the auth code) and logging. The requests are sent with a copy that does not follow redirects, see OAuth2KtorClient for the plugins it must not have.

oauth2Client

implements OAuth 2.0, holding the client_id (also the issuer of credential proofs), the redirectUrl, which needs to be registered by the OS for this application, so redirection back from browser works, and the state of authorization requests

vciClient

implements OID4VCI protocol, i.e. creates credential requests with proofs of possession for the credential key material, and parses the credential responses

clientAttestation

authenticates the client with OAuth 2.0 Attestation-Based Client Authentication, e.g. with a Wallet Instance Attestation (WIA), or null to not use it

dpopKeyMaterial

the key material the access tokens and refresh tokens get bound to, by default the key of clientAttestation, else an ephemeral key, see OAuth2KtorClient

issuerMetadataValidator

validates signed issuer metadata, see loadIssuerMetadata: configure it with the anchors of the WRPAC providers, and of the WRPRC providers


constructor(engine: HttpClientEngine, cookiesStorage: CookiesStorage? = null, httpClientConfig: HttpClientConfig<*>.() -> Unit? = null, oid4vciClient: OpenId4VciClient = OpenId4VciClient(), oauth2InternalClient: OAuth2Client = OAuth2Client(clientId = oid4vciClient.clientId), oauth2Client: OAuth2KtorClient = OAuth2KtorClient( engine = engine, cookiesStorage = cookiesStorage, httpClientConfig = httpClientConfig, oAuth2Client = oauth2InternalClient, ))(source)

Deprecated

Pass the app's HttpClient instead of engine, cookiesStorage and httpClientConfig, the OAuth2Client, which holds the client ID for credential proofs too, and the client attestation as ClientAttestation

Parameters

engine

ktor engine to use to make requests to issuing service.

cookiesStorage

Callers are advised to implement a persistent cookie storage, to keep the session at the issuing service alive after receiving the auth code.

httpClientConfig

Additional configuration for building the HTTP client, e.g. callers may enable logging.

oid4vciClient

Implements OID4VCI protocol, cryptoService provides proof of possession for credential key material.

oauth2InternalClient

Internal OAuth 2.0 client passed on to oauth2Client, with the (deprecated) clientId from oid4vciClient. The client_id of the OAuth 2.0 client in oauth2Client is the issuer of credential proofs.

oauth2Client

OAuth 2.0 client to use during the protocol run.