Interface IRestoreCredentialProvider
- Namespace
- VpnHood.AppLib.Abstractions.Accounts
- Assembly
- VpnHood.AppLib.Abstractions.dll
The device side of zero-tap sign-in restoration (Android "Restore Credentials", a Play requirement for sign-in apps from April 2027): a platform-held key pair that follows the person through device-to-device transfer and cloud restore. The portal is the relying party and OWNS every options document — implementations pass the JSON through to the platform credential API verbatim and hand its response back verbatim, composing nothing themselves.
Each call takes the window, null where none is open; a platform API that needs one fails then.
public interface IRestoreCredentialProvider : IDisposable
- Inherited Members
Methods
Clear(IUiContext?, CancellationToken)
Clear this device's restore credential (sign-out). Idempotent.
Task Clear(IUiContext? uiContext, CancellationToken cancellationToken)
Parameters
uiContextIUiContextThe window, or null where none is open.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- UiContextNotAvailableException
uiContextis 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.
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.
Task<string> Create(IUiContext? uiContext, string requestJson, CancellationToken cancellationToken)
Parameters
uiContextIUiContextThe window, or null where none is open.
requestJsonstringThe portal's WebAuthn creation options, as JSON.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- UiContextNotAvailableException
uiContextis null, and the platform needs a window.- InvalidOperationException
The platform answered with a response of another type.
- OperationCanceledException
cancellationTokenwas canceled.
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).
Task<string?> TryGet(IUiContext? uiContext, string requestJson, CancellationToken cancellationToken)
Parameters
uiContextIUiContextThe window, or null where none is open.
requestJsonstringThe portal's WebAuthn request options, as JSON.
cancellationTokenCancellationTokenThe 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
uiContextis null, and the platform needs a window.- InvalidOperationException
The platform answered with a credential of another type.
- OperationCanceledException
cancellationTokenwas canceled.