WalletService

class WalletService(clientId: String = "https://wallet.a-sit.at/app", redirectUrl: String = "/callback", cryptoService: CryptoService = DefaultCryptoService(RandomKeyPairAdapter()), jwsService: JwsService = DefaultJwsService(cryptoService), coseService: CoseService = DefaultCoseService(cryptoService), remoteResourceRetriever: RemoteResourceRetrieverFunction = { null })(source)

Client service to retrieve credentials using OpenID for Verifiable Credential Issuance. Implemented from Draft openid-4-verifiable-credential-issuance-1_0-11, 2023-02-03.

Constructors

Link copied to clipboard
constructor(clientId: String = "https://wallet.a-sit.at/app", redirectUrl: String = "/callback", cryptoService: CryptoService = DefaultCryptoService(RandomKeyPairAdapter()), jwsService: JwsService = DefaultJwsService(cryptoService), coseService: CoseService = DefaultCoseService(cryptoService), remoteResourceRetriever: RemoteResourceRetrieverFunction = { null })

Types

Link copied to clipboard
Link copied to clipboard
object Companion
Link copied to clipboard
data class RequestOptions(val credentialScheme: ConstantIndex.CredentialScheme, val representation: ConstantIndex.CredentialRepresentation = PLAIN_JWT, val requestedAttributes: Set<String>? = null, val state: String = uuid4().toString(), val clock: Clock = Clock.System)

Functions

Link copied to clipboard
suspend fun createAuthRequest(requestOptions: WalletService.RequestOptions, credentialIssuer: String? = null): AuthenticationRequestParameters
suspend fun createAuthRequest(state: String, credential: Pair<String, SupportedCredentialFormat>, credentialIssuer: String? = null, authorizationServers: Set<String>? = null): AuthenticationRequestParameters

Send the result as parameters (either POST or GET) to the server at /authorize (or more specific IssuerMetadata.authorizationEndpointUrl).

Link copied to clipboard
suspend fun createCredentialRequest(requestOptions: WalletService.RequestOptions, clientNonce: String?, credentialIssuer: String?): KmmResult<CredentialRequestParameters>
suspend fun createCredentialRequest(credential: SupportedCredentialFormat, requestedAttributes: Set<String>? = null, clientNonce: String?, credentialIssuer: String?): KmmResult<CredentialRequestParameters>

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

Link copied to clipboard
suspend fun createTokenRequestParameters(credential: SupportedCredentialFormat, requestedAttributes: Set<String>? = null, state: String? = null, authorization: WalletService.AuthorizationForToken): TokenRequestParameters

Request token with an authorization code, e.g. from createAuthRequest, or pre-auth code.

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.