AttestationClient

class AttestationClient(client: HttpClient, clock: Clock = Clock.System)(source)

Mobile client, fetching attestation challenges and posting CSRs containing attestation statements to an attestation verification endpoint.

Based on a Ktor client. Automatically installs JSON content negotiation. For testing, it is possible to provide a custom clock for high-level checks. Note that this clock does not affect generated attestation proofs, because those will always use the actual device clock!

Constructors

Link copied to clipboard
constructor(client: HttpClient, clock: Clock = Clock.System)

Functions

Link copied to clipboard
suspend fun attest(csr: Pkcs10CertificationRequest, destination: Url): AttestationResponse

Posts a csr containing an attestation challenge, as created by createAttestationProof.

Link copied to clipboard
suspend fun getChallenge(endpoint: Url): KmmResult<AttestationChallenge>

Fetches a challenge from an endpoint. This is the first step in an attestation ceremony. This will fail if the system time is off too much:

Link copied to clipboard
suspend fun AttestationClient.performAttestationFlow(alias: String, fetchChallengeEndpoint: Url, authPromptMessage: String? = null, authPromptCancelText: String? = null, additionalCsrExtensions: List<X509CertificateExtension> = listOf(), additionalCsrAttributes: List<Pkcs10CertificationRequestAttribute> = listOf()): AttestationResponse

Truly integrated attestation in a single call.