suspend fun registerRequest()

in Fido2/app/src/main/java/com/google/android/gms/identity/sample/fido2/api/AuthApi.kt [124:144]


    suspend fun registerRequest(sessionId: String): ApiResult<PublicKeyCredentialCreationOptions> {
        val call = client.newCall(
            Request.Builder()
                .url("$BASE_URL/registerRequest")
                .addHeader("Cookie", formatCookie(sessionId))
                .method("POST", jsonRequestBody {
                    name("attestation").value("none")
                    name("authenticatorSelection").objectValue {
                        name("authenticatorAttachment").value("platform")
                        name("userVerification").value("required")
                    }
                })
                .build()
        )
        val response = call.await()
        return response.result("Error calling /registerRequest") {
            parsePublicKeyCredentialCreationOptions(
                body ?: throw ApiException("Empty response from /registerRequest")
            )
        }
    }