Attest Providers
Attestation providers handle platform-specific device integrity verification. On Android, the Play Integrity is used, while on Huawei devices, the SysIntegrity provides device integrity verification. On iOS, App Attest provides secure hardware-backed attestation.
Please configure and implement the providers listed below in strict accordance with their official platform documentation.
Play Integrity (Android)
On Android, the Play Integrity API is used to verify app and device integrity. It generates an attestation token tied to a secure nonce provided by the backend.
class PlayIntegrityProvider(context: Context) : AttestProvider {
private val integrityManager = IntegrityManagerFactory.create(context)
override suspend fun getToken(nonce: String): String {
val integrityTokenResponse: Task<IntegrityTokenResponse> =
integrityManager.requestIntegrityToken(
IntegrityTokenRequest.builder()
.setNonce(nonce)
.build()
)
return suspendCancellableCoroutine { cont ->
integrityTokenResponse
.addOnSuccessListener {
cont.resume(it.token())
}
.addOnFailureListener { e ->
cont.resumeWithException(
AttestationException(
message = "Attestation failure: ${e.localizedMessage}",
code = AttestationErrorCode.ATTESTATION_FAILED
)
)
}
}
}
}App Attest (iOS)
On iOS, Apple’s App Attest service is used to generate and validate a device-bound cryptographic attestation. It ensures the app instance is legitimate and unmodified.
SysIntegrity (Huawei)
Last updated