Package-level declarations

Types

Link copied to clipboard
class AttestationProofCreator(loadKeyAttestation: suspend (OpenId4VciClient.KeyAttestationInput) -> KmmResult<JwsCompactTyped<KeyAttestationJwt>>) : ProofCreator

Creates proofs of the attestation proof type (OpenID4VCI 1.0, Appendix F.3): exactly one key attestation in JWT format (Appendix D.1), loaded with loadKeyAttestation, without a proof of possession of the attested keys. The c_nonce is passed to loadKeyAttestation as KeyAttestationInput.clientNonce, as it has to be the nonce of the key attestation if the issuer has a Nonce Endpoint (Appendix F.3).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface CodeService

Provides generation and single-use validation of short-lived codes, e.g. authorization codes, pre-authorized codes, or issuer_state values.

Link copied to clipboard
class CredentialAuthorizationServiceStrategy @JvmOverloads constructor(credentialSchemes: Set<CredentialScheme>, mapper: CredentialSchemeMapper = DefaultCredentialSchemeMapper()) : AuthorizationServiceStrategy

Provide authentication and authorization for credential issuance.

Link copied to clipboard

Provides the actual data of the user as a credential that shall be issued

Link copied to clipboard
data class CredentialDataProviderInput(val userInfo: OidcUserInfoExtended, val subjectPublicKey: CryptoPublicKey, val credentialScheme: CredentialScheme, val credentialRepresentation: CredentialRepresentation)

Input for CredentialDataProviderFun to resolve the actual data of the user:

Link copied to clipboard
@Serializable
data class CredentialIdentifierInfo(val issuerMetadata: IssuerMetadata, val credentialIdentifier: String, val supportedCredentialFormat: SupportedCredentialFormat, val issuer: ValidatedCredentialIssuer? = null)

Gets parsed from the credential issuer's metadata, essentially an entry from IssuerMetadata.supportedCredentialConfigurations

Link copied to clipboard
Link copied to clipboard
class DefaultCodeService @JvmOverloads constructor(nonceService: NonceService = DefaultNonceService()) : CodeService

Holds valid codes in memory, delegating to nonceService, i.e. entries are protected with a mutex and expire after the lifetime of that service.

Link copied to clipboard
class IssuerEncryptionService @JvmOverloads constructor(encryptCredentialResponse: EncryptJweFun = EncryptJwe(), requireResponseEncryption: Boolean = false, supportedJweAlgorithms: Set<JweAlgorithm> = setOf(JweAlgorithm.ECDH_ES), supportedJweEncryptionAlgorithms: Set<JweEncryption> = setOf(JweEncryption.A256GCM), requireRequestEncryption: Boolean = false, decryptionKeyMaterial: KeyMaterial = EphemeralKeyWithoutCert(), decryptCredentialRequest: DecryptJweFun? = DecryptJwe(decryptionKeyMaterial))

Server implementation to handle credential request decryption and credential response encryption using OID4VCI.

Link copied to clipboard
class JwtProofCreator(keyMaterial: KeyMaterial, loadKeyAttestation: suspend (OpenId4VciClient.KeyAttestationInput) -> KmmResult<JwsCompactTyped<KeyAttestationJwt>>? = null, selectProofJwtKeyBinding: suspend (KeyMaterial) -> Pair<JsonWebKey?, String?> = { key -> Pair(key.jsonWebKey, null) }, clock: Clock = Clock.System) : ProofCreator

Creates proofs of the jwt proof type (OpenID4VCI 1.0, Appendix F.1): a JWT of type openid4vci-proof+jwt, signed with keyMaterial, the key the issued credential will be bound to, which the header references as jwk or kid, see selectProofJwtKeyBinding. Its payload carries the client_id as iss, the Credential Issuer Identifier as aud, the c_nonce as nonce, and as iat the time of clock three minutes ago, to tolerate the clock skew of the issuer.

Link copied to clipboard
sealed interface LoadedIssuerMetadata

The metadata of a credential issuer, as it serves them (OpenID4VCI 1.0, 12.2.2): signed and validated, or unsigned, see OpenId4VciProtocolClient.loadIssuerMetadata.

Link copied to clipboard

Used in OID4VCI by OpenId4VciServer to obtain user data when issuing credentials using OID4VCI.

Link copied to clipboard
@Serializable
data class OAuth2Error(val error: String, val errorDescription: String? = null, val description: String? = null, val errorUri: String? = null, val state: String? = null)

The OAuth 2.0 Authorization Framework: Error responses, see RFC 6749.

Link copied to clipboard
@Serializable
sealed class OAuth2Exception : Throwable

OAuth2/OIDC error representation for issuer and wallet flows. Use to model protocol errors and serialize them for responses.

Link copied to clipboard
object OAuth2ExceptionSerializer : JsonContentPolymorphicSerializer<OAuth2Exception>
Link copied to clipboard
fun interface OAuth2LoadUserFun

Interface used in at.asitplus.wallet.lib.oauth2.AuthorizationService to actually load user data during the OAuth 2.0 flow, after an authn request (see AuthenticationRequestParameters) has been validated.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class OpenId4VciClient @JvmOverloads constructor(clientId: String = "https://wallet.a-sit.at/app", remoteResourceRetriever: RemoteResourceRetrieverFunction = { null }, encryptionService: WalletEncryptionService = WalletEncryptionService(), proofCreators: List<ProofCreator>)

Client service to retrieve credentials using OID4VCI

Link copied to clipboard
class OpenId4VciProtocolClient @JvmOverloads constructor(val vciClient: OpenId4VciClient = OpenId4VciClient(proofCreators = listOf(JwtProofCreator(EphemeralKeyWithoutCert()))), val oauth2Client: OAuth2ProtocolClient = OAuth2ProtocolClient(oAuth2Client = OAuth2Client()), issuerMetadataValidator: IssuerMetadataValidator = IssuerMetadataValidator())

Implements the client side of OpenID for Verifiable Credential Issuance 1.0 from 2025-09-16, 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
class OpenId4VciServer @JvmOverloads constructor(statusListTokenResolver: StatusListTokenResolver? = null, authorizationService: OAuth2AuthorizationServerAdapter, issuer: Issuer, keyMaterial: Set<KeyMaterial> = setOf(issuer.keyMaterial), cryptoAlgorithms: Set<SignatureAlgorithm> = keyMaterial.map { it.signatureAlgorithm }.toSet(), credentialSchemes: Set<CredentialScheme>, publicContext: String = "https://wallet.a-sit.at/credential-issuer", credentialEndpointPath: String = "/credential", nonceEndpointPath: String = "/nonce", requireKeyAttestation: Boolean = false, proofValidator: ProofValidator = ProofValidator( publicContext = publicContext, requireKeyAttestation = requireKeyAttestation, keyAttestationValidator = KeyAttestationValidator(statusValidator = StatusValidator(statusListTokenResolver)), ), signMetadata: SignJwtFun<IssuerMetadata> = SignJwt(EphemeralKeyWithoutCert(), JwsHeaderCertOrJwk()), encryptionService: IssuerEncryptionService = IssuerEncryptionService(), credentialSchemeMapper: CredentialSchemeMapper = DefaultCredentialSchemeMapper(), preferredClientStatusPeriod: Duration? = 31.days, displayProperties: Set<DisplayProperties>? = null, clock: Clock = Clock.System, issuerInfo: List<IssuerInfo>? = null)

Server implementation to issue credentials using OID4VCI.

Link copied to clipboard
interface ProofCreator

Creates the proofs of a credential request (OpenID4VCI 1.0, 8.2) of one proof type (Appendix F), which provide the key material the issued credential will be bound to (8.1).

Link copied to clipboard
data class ProofsValidation(val proofs: List<ProofValidation>)

The validation of every proof of a credential request, see ProofValidator.validateProofs.

Link copied to clipboard
data class ProofValidation(val report: ValidationReport, val keys: Collection<CryptoPublicKey>?, nonces: Set<String>)

The report of one proof, see JwtProofChecks and KeyAttestationChecks, and the keys to bind credentials to, if it has been accepted.

Link copied to clipboard
class ProofValidator @JvmOverloads constructor(publicContext: String = "https://wallet.a-sit.at/credential-issuer", verifyJwsObject: VerifyJwsObjectFun = VerifyJwsObject(), verifyJwsSignatureWithKey: VerifyJwsSignatureWithKeyFun = VerifyJwsSignatureWithKey(), supportedAlgorithms: Collection<JwsAlgorithm.Signature> = SimpleAuthorizationService.DEFAULT_WALLET_ATTESTATION_ALGORITHMS, clock: Clock = Clock.System, timeLeeway: Duration = 5.minutes, requireKeyAttestation: Boolean = false, clientNonceService: NonceService = DefaultNonceService(), keyAttestationValidator: KeyAttestationValidator = KeyAttestationValidator())

Validates the proofs of possession in credential requests of OID4VCI, see validateProofs.

Link copied to clipboard
sealed interface ReceivedCredential

A credential of a credential response, see OpenId4VciClient.decodeCredentialResponse. It has not been validated: pass it to prepareCredentialStorage, which validates it with the holder's key and validator.

Link copied to clipboard
@Serializable
data class TokenInfo(val token: String, val authorizationDetails: Set<AuthorizationDetails>? = null, val scope: String? = null, val confirmationClaim: ConfirmationClaim? = null)

Internal data class for a token introspection result

Link copied to clipboard
class WalletEncryptionService @JvmOverloads constructor(requestResponseEncryption: Boolean = false, requireRequestEncryption: Boolean = false, encryptCredentialRequest: EncryptJweFun = EncryptJwe(), supportedJweAlgorithm: JweAlgorithm = JweAlgorithm.ECDH_ES, fallbackJweEncryptionAlgorithm: JweEncryption = JweEncryption.A256GCM, ephemeralEncryptionKeyService: EphemeralEncryptionKeyService = EphemeralEncryptionKeyService(), decryptCredentialResponse: DecryptJweFun? = DecryptJweWithEphemeralKey(ephemeralEncryptionKeyService))

Wallet implementation to handle credential request encryption and credential response decryption using OID4VCI.

Link copied to clipboard

Functions

Link copied to clipboard

Returns true if the other authorization detail is semantically the same, i.e., it has the same OpenIdAuthorizationDetails.credentialConfigurationId.

Link copied to clipboard

Converts the result of the credential endpoint to its response: status 200 with the credential response as application/json, or encrypted as application/jwt (OID4VCI 1.0 8.3, 10.), and Cache-Control: no-store, as in every credential response example of OID4VCI 1.0, since it contains credentials.

Converts the result of the nonce endpoint to its response: status 200 with the nonce as JSON, Cache-Control: no-store (OID4VCI 1.0 7.2), and the header DPoP-Nonce, if present (RFC 9449 8.2).