Package-level declarations

Types

Link copied to clipboard

Intermediate DTO to hold the response to be sent from an OpenId4VpHolder to an OpenId4VpVerifier or DcApiVerifier.

Link copied to clipboard

Possible outcomes of creating an OpenID Authentication Response, to be sent back to the verifier.

Link copied to clipboard

An authorization response of the wallet, processed by OpenId4VpVerifier.validateAuthnResponse or DcApiVerifier.validateAuthnResponse: correlated with its request, which processing it has consumed, so that the request can't be answered again.

Link copied to clipboard
data class AuthorizationRequestValidation(val validationReport: ValidationReport, val preparationState: AuthorizationResponsePreparationState, val relyingParty: RelyingPartyValidationResult? = null)

The validationReport of an authorization request, see at.asitplus.wallet.lib.validation.RequestObjectChecks, and the preparationState to answer it with, also if the request is rejected: either to answer the verifier with an error, or, where the policy of the wallet allows, after the user decided to proceed.

Link copied to clipboard
@Serializable
data class AuthorizationResponsePreparationState(val request: RequestParametersFrom<AuthenticationRequestParameters>, val credentialPresentationRequest: CredentialPresentationRequest?, val clientMetadata: RelyingPartyMetadata?, val jsonWebKeys: Collection<JsonWebKey>?, val verifierInfo: NonEmptyList<VerifierInfo>?, val audience: String)

Intermediate result class to display information about the authentication process to the user, i.e., to let them make an informed decision.

Link copied to clipboard
sealed class ClientIdScheme

Represents the OpenID client identifier scheme used to validate verifier identity. Use to select the client-id flavor (redirect URI, X.509, attestation) and derive IDs/URIs accordingly.

Link copied to clipboard

Sets x5chain to the certificate chain of clientIdScheme, e.g. for ISO mdoc reader authentication, falling back to the certificate of the key material for schemes without a chain.

Link copied to clipboard
data class CreatedRequest(val url: String, val loadRequestObject: suspend (RequestObjectParameters?) -> KmmResult<String>? = null)
Link copied to clipboard
sealed class CreationOptions

Options for creating authorization requests (query, by value, or by reference). Use to control how the verifier delivers the request to the wallet.

Link copied to clipboard

This is a helper class to build a CredentialPresentationRequest from a collection of RequestOptionsCredential to be used in OpenId4VpRequestOptions.

Link copied to clipboard

Options for creating requests for the W3C Digital Credentials API in DcApiVerifier.createAuthnRequest, reflecting the exchange protocols available over that API, see at.asitplus.dcapi.request.ExchangeProtocolIdentifier.

Link copied to clipboard
class DcApiHolder @JvmOverloads constructor(keyMaterial: KeyMaterial = EphemeralKeyWithoutCert(), holder: Holder = HolderAgent(keyMaterial), openId4VpHolder: OpenId4VpHolder = OpenId4VpHolder(holder = holder), iso180137AnnexCHolder: Iso180137AnnexCHolder = Iso180137AnnexCHolder( keyMaterial = keyMaterial, holder = holder, ), relyingPartyValidator: RelyingPartyValidator = RelyingPartyValidator())

Handles requests received through the W3C Digital Credentials API, similar to DcApiVerifier on the relying party side.

Link copied to clipboard

Opaque continuation state for a two-step DcApiHolder flow.

Link copied to clipboard
data class DcApiRequestValidation(val validationReport: ValidationReport, val preparationState: DcApiPreparationState, val relyingParty: RelyingPartyValidationResult? = null)

The validationReport of a request through the Digital Credentials API, and the preparationState to answer it with, also if the request is rejected, see DcApiHolder.startAuthorizationResponsePreparation.

Link copied to clipboard
sealed interface DcApiResponseResult

Result of validating a DCAPI response, see DcApiVerifier.validateAuthnResponse

Link copied to clipboard
class DcApiVerifier @JvmOverloads constructor(clientIdScheme: ClientIdScheme, keyMaterial: KeyMaterial = EphemeralKeyWithoutCert(), decryptionKeyMaterial: KeyMaterial? = null, ephemeralEncryptionKeyService: EphemeralEncryptionKeyService = EphemeralEncryptionKeyService(), signAuthnRequest: SignJwtFun<AuthenticationRequestParameters> = SignJwt(keyMaterial, JwsHeaderClientIdScheme(clientIdScheme)), verifyJwsObject: VerifyJwsObjectFun = VerifyJwsObject(), supportedAlgorithms: Set<SignatureAlgorithm> = setOf(SignatureAlgorithm.ECDSAwithSHA256), nonceService: NonceService = DefaultNonceService(), stateToAuthnRequestStore: MapStore<String, AuthenticationRequestParameters> = DefaultMapStore(), stateToIsoMdocRequestStore: MapStore<String, IsoMdocRequest> = DefaultMapStore(), supportedJweEncryptionAlgorithms: Set<JweEncryption> = JweEncryption.entries.toSet(), signReaderAuth: SignCoseDetachedFun<ByteArray> = SignCoseDetached( keyMaterial = keyMaterial, unprotectedHeaderModifier = CoseHeaderClientIdScheme(clientIdScheme), ), credentialValidator: CredentialValidator = CredentialValidator(), presentationPolicy: ValidationPolicy = defaultPresentationPolicy)

Implements a verifier for the Digital Credentials API, similar to OpenId4VpVerifier for OpenID4VP.

Link copied to clipboard

The wallet answered an ISO/IEC 18013-7 Annex C request with a device response carrying an error status instead of documents (ISO/IEC 18013-5, 10.3.6): 10 for a general error, 11 for a CBOR decoding error, 12 for a CBOR validation error. Annex C defines no other error, so this is the only one that reaches the verifier: declining or failing otherwise rejects the request in the browser. Like a presentation, it ends the request.

Link copied to clipboard
class Iso180137AnnexCHolder @JvmOverloads constructor(keyMaterial: KeyMaterial = EphemeralKeyWithoutCert(), holder: Holder = HolderAgent(keyMaterial))

Handles ISO/IEC 18013-7 Annex C requests received through the W3C Digital Credentials API.

Link copied to clipboard

Result of validating an ISO/IEC 18013-7 Annex C response, see DcApiVerifier.validateAuthnResponse and DcApiCreationOptions.Iso180137AnnexC: the documents, or the error status of the wallet's device response.

Link copied to clipboard
data class Iso180137AnnexCWrapper(val documents: Collection<IsoDocumentParsed>, val presentationValidations: List<PresentationValidationResult>, val validationReport: ValidationReport) : Iso180137AnnexCResult

Result of validating an ISO 18013-7 Annex C response, see DcApiVerifier.validateAuthnResponse and DcApiCreationOptions.Iso180137AnnexC

Link copied to clipboard

Low-level ISO/IEC 18013-7 Annex C device-response construction used by Iso180137AnnexCHolder.

Link copied to clipboard
Link copied to clipboard
class OpenId4VpHolder @JvmOverloads constructor(holder: Holder = HolderAgent(keyMaterial = EphemeralKeyWithoutCert()), encryptJarm: EncryptJweFun = EncryptJwe(), supportedAlgorithms: Set<SignatureAlgorithm> = setOf(SignatureAlgorithm.ECDSAwithSHA256), clientId: String = "https://wallet.a-sit.at/", authorizationEndpoint: String = "openid4vp:", remoteResourceRetriever: RemoteResourceRetrieverFunction = { null }, walletNonceMapStore: MapStore<String, String> = DefaultMapStore(), randomSource: RandomSource = RandomSource.Secure, lookupJsonWebKeysForClient: (OpenId4VpHolder.JsonWebKeyLookupInput) -> JsonWebKeySet? = { null }, allowedDcApiOriginSchemes: suspend () -> Set<String> = { DEFAULT_ALLOWED_DC_API_ORIGIN_SCHEMES }, ephemeralEncryptionKeyService: EphemeralEncryptionKeyService? = null, supportedJweEncryptionAlgorithms: Set<JweEncryption> = JweEncryption.entries.toSet(), requireEncryptedRequests: Boolean = false, relyingPartyValidator: RelyingPartyValidator = RelyingPartyValidator())

Combines Verifiable Presentations with OAuth 2.0. Implements OpenID4VP (1.0, 2025-07-09).

Link copied to clipboard
class OpenId4VpProtocolClient(val openId4VpHolder: OpenId4VpHolder)

Implements the wallet side of OpenID for Verifiable Presentations 1.0, without sending any HTTP request itself: every call returns an HttpExchange, whose requests the caller sends with any HTTP stack. The KDoc of each method lists the ProtocolRequests its exchange sends.

Link copied to clipboard
data class OpenId4VpRequestOptions(val presentationRequest: CredentialPresentationRequest?, val responseMode: OpenIdConstants.ResponseMode = ResponseMode.Fragment, val responseUrl: String? = null, val responseType: String = VP_TOKEN, val state: String = uuid4().toString(), val transactionData: List<TransactionData>? = null, val expectedOrigins: List<String>? = null, val verifierInfo: NonEmptyList<VerifierInfo>? = null, val populateClientId: Boolean = true, val verifierMetadataMode: VerifierMetadataMode = VerifierMetadataMode.AUTO, val euWrprc: ByteArray? = null) : RequestOptions
Link copied to clipboard
@Serializable
data class OpenId4VpSuccess(val redirectUri: String)

The verifier's answer to an authorization response posted with the response mode direct_post or direct_post.jwt, see OpenID4VP 1.0, 8.2.

Link copied to clipboard
class OpenId4VpVerifier @JvmOverloads constructor(clientIdScheme: ClientIdScheme, keyMaterial: KeyMaterial = EphemeralKeyWithoutCert(), decryptionKeyMaterial: KeyMaterial? = null, ephemeralEncryptionKeyService: EphemeralEncryptionKeyService = EphemeralEncryptionKeyService(), signAuthnRequest: SignJwtFun<AuthenticationRequestParameters> = SignJwt(keyMaterial, JwsHeaderClientIdScheme(clientIdScheme)), verifyJwsObject: VerifyJwsObjectFun = VerifyJwsObject(), supportedAlgorithms: Set<SignatureAlgorithm> = setOf(SignatureAlgorithm.ECDSAwithSHA256), nonceService: NonceService = DefaultNonceService(), stateToAuthnRequestStore: MapStore<String, AuthenticationRequestParameters> = DefaultMapStore(), supportedJweEncryptionAlgorithms: Set<JweEncryption> = JweEncryption.entries.toSet(), credentialValidator: CredentialValidator = CredentialValidator(), presentationPolicy: ValidationPolicy = defaultPresentationPolicy)

Combines Verifiable Presentations with OAuth 2.0. Implements OpenID4VP (1.0, 2025-07-09).

Link copied to clipboard
sealed interface RelyingPartyTrust

A single source of trust in the relying party sending an authorization request, for one client identifier scheme, see OpenID4VP, Client Identifier Prefixes.

Link copied to clipboard
class RequestParser(remoteResourceRetriever: RemoteResourceRetrieverFunction = { null }, ephemeralEncryptionKeyService: EphemeralEncryptionKeyService? = null, decryptRequestObject: DecryptJweFun? = ephemeralEncryptionKeyService?.let { DecryptJweWithEphemeralKey(it) }, requireEncryptedRequests: Boolean = false, buildRequestObjectParameters: suspend () -> RequestObjectParameters? = { null })
Link copied to clipboard
class ResponseParser @JvmOverloads constructor(decryptJwe: DecryptJweFun = DecryptJwe(EphemeralKeyWithoutCert()), verifyJwsObject: VerifyJwsObjectFun = VerifyJwsObject())

Parses authentication responses for OpenId4VpVerifier

Link copied to clipboard
sealed interface VpTokenValidationResult
Link copied to clipboard
data class VpTokenValidationResultDCQL(val credentialQueryResponseValidations: Map<DCQLCredentialQueryIdentifier, List<KmmResult<Verifier.VerifyPresentationResult>>>, val submissionRequirementsValidationResult: KmmResult<Unit>, val presentationValidations: Map<DCQLCredentialQueryIdentifier, List<PresentationValidationResult>> = emptyMap()) : VpTokenValidationResult

The legacy result of a vp_token, projected from presentationValidations under the presentation policy of the verifier: an accepted presentation becomes its VerifyPresentationResult, a rejected one fails with the cause of its first rejecting check.

Functions

Link copied to clipboard

The answer of the response endpoint, after it has processed an authorization response or authorization error response posted with the response mode direct_post or direct_post.jwt: status 200 with a JSON object, holding redirectUri as redirect_uri if present (OpenID4VP 1.0 8.2), see OpenId4VpSuccess. The header Cache-Control: no-store keeps the redirect_uri out of caches, as it should carry a fresh secret against session fixation (OpenID4VP 1.0 14.2), as in the example of 8.2.

Link copied to clipboard

Loads the request object with CreatedRequest.loadRequestObject, passing the params the wallet may have sent (wallet_metadata and wallet_nonce for request_uri_method=post), and converts it to the response of the request URI: status 200 with the signed, optionally encrypted, request object as application/oauth-authz-req+jwt (OpenID4VP 1.0 5.10.1, RFC 9101 5.2.3).

Link copied to clipboard

The RelyingPartyValidator establishing the trust these sources established, to migrate from relyingPartyTrust: RelyingPartyTrust.Certificates become the anchors of the access certificate providers, also if there are none, so that configured trust stays required; RelyingPartyTrust.PreRegisteredClients and the verifier attester sources map to theirs. RelyingPartyTrust.Custom no longer takes effect, as it decides opaquely instead of returning the keys of the relying party, see ClientIdentifierTrust.

Link copied to clipboard

Validates the relying party of this request with validator under policy, authenticating it over the DC API session transcript bound to this request and calling origin.

Link copied to clipboard

Validates reader authentication using the DC API session transcript bound to this request and calling origin.