SafetyNetApi

public interface SafetyNetApi

The main entry point for interacting with SafetyNet.

Nested Class Summary

interface SafetyNetApi.AttestationResult Result that contains a Compatibility Test Suite attestation result. 

Public Method Summary

abstract PendingResult<SafetyNetApi.AttestationResult>
attest(GoogleApiClient client, byte[] nonce)
Provides attestation results for the device.

Public Methods

public abstract PendingResult<SafetyNetApi.AttestationResult> attest (GoogleApiClient client, byte[] nonce)

Provides attestation results for the device.

An attestation result states whether the device where it is running matches the profile of a device that has passed Android compatibility testing.

When you request a compatibility check, you must provide a nonce, which is a random token generated in a cryptographically secure manner. You can obtain a nonce by generating one within your app each time you make a compatibility check request. As a more secure option, you can obtain a nonce from your own server, using a secure connection.

A nonce used with an attesation request should be at least 16 bytes in length. After you make a request, the response from the SafetyNetApi.AttestationResult includes your nonce, so you can verify it against the one you sent. You should only use a nonce value once, for a single request. Use a different nonce for any subsequent attestation requests. For tips on using cryptography functions, see Security Tips.

Parameters
client The GoogleApiClient to service the call. The client must be connected using connect() before invoking this method.
nonce A cryptographic nonce used for anti-replay and tracking of requests.