RestoreCredentialClient

@DoNotMock(value = "Use canonical fakes instead")
public interface RestoreCredentialClient extends HasApiKey


The interface for clients to access Restore Credential API. If you are trying to use the Restore API in your apps, you should use the AndroidX equivalent API, instead of using this API directly.

  • When clients create a public key, the private key will be securely stored within the Block Store and the public key will be returned to the app.
  • When Clients pass the public key to authenticate credentials with the private key stored within Block Store, the signed credential will be returned to the app.

Summary

Public methods

abstract @NonNull Task<@NonNull Boolean>

Returns a Task which asynchronously deletes the restore credential, with a Boolean result representing whether credential was deleted.

abstract @NonNull Task<@NonNull CreateRestoreCredentialResponse>

Returns a Task which asynchronously creates a new public key credential with the provided CreateRestoreCredentialRequest and returns the public key.

abstract @NonNull Task<@NonNull GetRestoreCredentialResponse>

Returns a Task which asynchronously returns the restore credential by signing the previously-stored private key.

Public methods

clearRestoreCredential

abstract @NonNull Task<@NonNull BooleanclearRestoreCredential(@NonNull ClearRestoreCredentialRequest request)

Returns a Task which asynchronously deletes the restore credential, with a Boolean result representing whether credential was deleted.

If no credential were found to delete, the task succeeds with a true return value.

createRestoreCredential

abstract @NonNull Task<@NonNull CreateRestoreCredentialResponsecreateRestoreCredential(@NonNull CreateRestoreCredentialRequest request)

Returns a Task which asynchronously creates a new public key credential with the provided CreateRestoreCredentialRequest and returns the public key.

The private key is stored locally. It is transferred to a new device during the device-to-device restore if a google account is also transferred.

The data will be backed up to the cloud in the next periodic sync. Cloud backup data is transferred to a new device during the cloud restore using Google's Backup & Restore services.

Only a single restore credential will be stored at a time. Subsequent calls will override the existing restore credential.

If the restore credential creation is successful, the public key will be returned as a registration response json.

Throws
InvalidArgumentException

if request is null or invalid.

getRestoreCredential

abstract @NonNull Task<@NonNull GetRestoreCredentialResponsegetRestoreCredential(@NonNull GetRestoreCredentialRequest request)

Returns a Task which asynchronously returns the restore credential by signing the previously-stored private key.

The private key may have been written on the same device or may have been transferred during the device setup.

Use this API to seamlessly sign-in users to your app on a new device.

If no restore credential is found, returns an empty credential. Note that the data may be cleared by Google Play services on certain user actions (for example, if a user clears their app storage).

If a restore credential is found, it will be signed with the request data and returned as a registration response json.

Throws
InvalidArgumentException

if request is null or it contains invalid request.