WalletService

class WalletService(val clientId: String = "https://wallet.a-sit.at/app", redirectUrl: String = "/callback", keyMaterial: KeyMaterial = EphemeralKeyWithoutCert(), remoteResourceRetriever: RemoteResourceRetrieverFunction = { null }, loadKeyAttestation: suspend (WalletService.KeyAttestationInput) -> KmmResult<JwsSigned<KeyAttestationJwt>>? = null, requestEncryption: Boolean = false, decryptionKeyMaterial: KeyMaterial? = null, supportedJweAlgorithm: JweAlgorithm = JweAlgorithm.ECDH_ES, supportedJweEncryptionAlgorithm: JweEncryption = JweEncryption.A256GCM, val oauth2Client: OAuth2Client = OAuth2Client(clientId, redirectUrl))(source)

Client service to retrieve credentials using OID4VCI

Implemented from OpenID for Verifiable Credential Issuance , Draft 15, 2024-12-19.

Constructors

Link copied to clipboard
constructor(clientId: String = "https://wallet.a-sit.at/app", redirectUrl: String = "/callback", keyMaterial: KeyMaterial = EphemeralKeyWithoutCert(), remoteResourceRetriever: RemoteResourceRetrieverFunction = { null }, loadKeyAttestation: suspend (WalletService.KeyAttestationInput) -> KmmResult<JwsSigned<KeyAttestationJwt>>? = null, requestEncryption: Boolean = false, decryptionKeyMaterial: KeyMaterial? = null, supportedJweAlgorithm: JweAlgorithm = JweAlgorithm.ECDH_ES, supportedJweEncryptionAlgorithm: JweEncryption = JweEncryption.A256GCM, oauth2Client: OAuth2Client = OAuth2Client(clientId, redirectUrl))

Types

Link copied to clipboard
data class KeyAttestationInput(val clientNonce: String?, val supportedAlgorithms: Collection<String>?)
Link copied to clipboard
data class RequestOptions(val credentialScheme: ConstantIndex.CredentialScheme, val representation: ConstantIndex.CredentialRepresentation = PLAIN_JWT, val state: String = uuid4().toString())

Properties

Link copied to clipboard

Used to create request parameters, e.g. AuthenticationRequestParameters, typically a URI.

Link copied to clipboard

OAuth2 client to build authorization requests

Functions

Link copied to clipboard
fun buildAuthorizationDetails(credentialConfigurationId: String, authorizationServers: Set<String>? = null): Set<OpenIdAuthorizationDetails>
fun buildAuthorizationDetails(credentialConfigurationIds: Set<String>, authorizationServers: Set<String>? = null): Set<OpenIdAuthorizationDetails>

Build authorization details for use in OAuth2Client.createAuthRequest.

Link copied to clipboard
suspend fun createCredentialRequest(tokenResponse: TokenResponseParameters, metadata: IssuerMetadata, credentialFormat: SupportedCredentialFormat, clientNonce: String? = null, previouslyRequestedScope: String? = null, clock: Clock = Clock.System): KmmResult<Collection<CredentialRequestParameters>>

Send the result as JSON-serialized content to the server at /credential (or more specific IssuerMetadata.credentialEndpointUrl).

Link copied to clipboard
suspend fun parseCredentialOffer(input: String): KmmResult<CredentialOffer>

Pass in the URL provided by the Credential Issuer, which may contain a direct CredentialOffer or a URI pointing to it.