Class PasskeyAuthenticator
Runs passkey (WebAuthn) operations for an app: signing in, confirming the signed-in user and creating passkeys. WebAssembly apps run them in their own page. Apps on iOS, Android and desktop (Uno Platform desktop and Windows App SDK) hand them off to the passkey page (PageUri) in the system browser, which returns the result to the app.
Implements
Namespace: Singulink.Net.Http.Api.Client.Passkeys
Assembly: Singulink.Net.Http.Api.Client.WinUI.dll
Syntax
public sealed class PasskeyAuthenticator : IPasskeyAuthenticator
Remarks
Options and credentials are WebAuthn JSON: the app gets the options from its API, passes them in, and posts the returned credential's Json back to its API.
When the passkey page is used, the credential travels through the app's callback address, which another app could intercept on mobile platforms. Sign-in ceremonies are therefore bound to a PKCE code challenge when they begin, which services require by default.
Constructors
| Name | Description |
|---|---|
| PasskeyAuthenticator() | Initializes a new instance of the PasskeyAuthenticator class with default options. Without a passkey page address (PageUri), it only runs passkey operations on WebAssembly. |
| PasskeyAuthenticator(PasskeyAuthenticatorOptions) | Initializes a new instance of the PasskeyAuthenticator class with the specified options. |
Properties
| Name | Description |
|---|---|
| IsSupported | Gets a value indicating whether passkeys can be used on this platform. On WebAssembly, this depends on the browser. |
| Options | Gets the options. |
| UsesPasskeyPage | Gets a value indicating whether operations are handed off to the passkey page in the system browser (iOS, Android and desktop) rather than run in the app's own page (WebAssembly). |
Methods
| Name | Description |
|---|---|
| CreateCredentialAsync(string, CancellationToken) | Creates a passkey (a WebAuthn attestation). |
| GetCredentialAsync(string, CancellationToken) | Gets a passkey credential (a WebAuthn assertion), to sign in or to confirm the signed-in user. |
| PrepareAsync(CancellationToken) | Loads what operations need ahead of time, so that the first operation does not wait for it: the passkeys script on WebAssembly. Does nothing on other platforms. |
| SignalUnknownCredentialAsync(PasskeyCredential, string, CancellationToken) | Tells the browser, and through it the password manager, that a passkey is not registered with the relying party, so that it can stop offering the passkey. On WebAssembly, this uses the WebAuthn Signal API in browsers that have it. Does nothing on other platforms or in other browsers, and ignores failures. |