Table of Contents

Class GoogleRestoreCredentialProvider

Namespace
VpnHood.AppLib.Stores.GooglePlay
Assembly
VpnHood.AppLib.Stores.GooglePlay.dll

Android Restore Credentials (zero-tap sign-in restoration, a Play requirement for sign-in apps from April 2027): a Credential Manager key pair that follows the person through device-to-device transfer and cloud restore. Every options/response JSON passes through VERBATIM — the portal is the relying party and owns the ceremony; this class only drives the platform API.

public class GoogleRestoreCredentialProvider : IRestoreCredentialProvider, IDisposable
Inheritance
GoogleRestoreCredentialProvider
Implements
Inherited Members

Methods

Clear(IUiContext?, CancellationToken)

Clear this device's restore credential (sign-out). Idempotent.

public Task Clear(IUiContext? uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The window, or null where none is open.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

Exceptions

UiContextNotAvailableException

uiContext is null, and the platform needs a window.

ApiException

The platform failed to clear it, as Google's credential manager reports a failure or a cancel.

InvalidOperationException

The activity has no main executor.

Create(IUiContext?, string, CancellationToken)

Create (or silently replace) this device's restore credential for the portal's WebAuthn creation options. Returns the platform's registration response JSON, to be posted back to the portal verbatim.

public Task<string> Create(IUiContext? uiContext, string requestJson, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The window, or null where none is open.

requestJson string

The portal's WebAuthn creation options, as JSON.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<string>

A task whose result is the platform's registration response, as JSON.

Exceptions

UiContextNotAvailableException

uiContext is null, and the platform needs a window.

InvalidOperationException

The platform answered with a response of another type.

OperationCanceledException

cancellationToken was canceled.

ApiException

The Credential Manager failed.

InvalidOperationException

The activity has no main executor, or the platform gave no response, or one of another type.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

TryGet(IUiContext?, string, CancellationToken)

Sign the portal's WebAuthn request options with the restored credential — the zero-tap moment on a new device. Returns the assertion response JSON verbatim, or null when this device holds no restore credential (a fresh install that was never restored).

public Task<string?> TryGet(IUiContext? uiContext, string requestJson, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The window, or null where none is open.

requestJson string

The portal's WebAuthn request options, as JSON.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<string>

A task whose result is the assertion response, as JSON, or null where the device holds no restore credential.

Exceptions

UiContextNotAvailableException

uiContext is null, and the platform needs a window.

InvalidOperationException

The platform answered with a credential of another type.

OperationCanceledException

cancellationToken was canceled.

ApiException

The Credential Manager failed.

AuthenticationException

Google's restore failed.

InvalidOperationException

The activity has no main executor, or the platform gave no credential, or one of another type.