Method RunAsync
RunAsync<TResult>(Func<string, CancellationToken, Task<PasskeyCredential>>, Func<TCeremony, PasskeyCredential, CancellationToken, Task<TResult>>, CancellationToken)
Shows the passkey prompt for the begun ceremony and sends the credential to the service. Begins the ceremony now if none was begun, it failed to begin or it is about to expire. Sends the credential of the last try again instead, without showing the prompt, if sending it failed for a reason that may not last (see IsTransient(Exception)) or was cancelled, and its ceremony is not about to expire.
Declaration
public Task<TResult> RunAsync<TResult>(Func<string, CancellationToken, Task<PasskeyCredential>> prompt, Func<TCeremony, PasskeyCredential, CancellationToken, Task<TResult>> finish, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<string, CancellationToken, Task<PasskeyCredential>> | prompt | Shows the passkey prompt with the WebAuthn options of the ceremony (OptionsJson) and returns the credential, such as GetCredentialAsync(string, CancellationToken). |
| Func<TCeremony, PasskeyCredential, CancellationToken, Task<TResult>> | finish | Sends the credential to the service to finish the ceremony. |
| CancellationToken | cancellationToken | A token to cancel the try, which is passed to the delegates. |
Returns
| Type | Description |
|---|---|
| Task<TResult> |
Type Parameters
| Name | Description |
|---|---|
| TResult | The type of the result of finishing the ceremony. |
Remarks
A ceremony whose prompt fails or is cancelled is kept for the next try, or begun again in the background if it is about to expire. A ceremony whose credential was sent is not used again: sending it ends the ceremony on the service. When sending fails for another reason, a new ceremony is begun in the background for the next try.
Exceptions
| Type | Condition |
|---|---|
| PasskeyAuthenticatorException | The prompt failed or the person cancelled it. |
| OperationCanceledException |
|
RunAsync(Func<string, CancellationToken, Task<PasskeyCredential>>, Func<TCeremony, PasskeyCredential, CancellationToken, Task>, CancellationToken)
Shows the passkey prompt for the begun ceremony and sends the credential to the service. Begins the ceremony now if none was begun, it failed to begin or it is about to expire. Sends the credential of the last try again instead, without showing the prompt, if sending it failed for a reason that may not last (see IsTransient(Exception)) or was cancelled, and its ceremony is not about to expire.
Declaration
public Task RunAsync(Func<string, CancellationToken, Task<PasskeyCredential>> prompt, Func<TCeremony, PasskeyCredential, CancellationToken, Task> finish, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<string, CancellationToken, Task<PasskeyCredential>> | prompt | Shows the passkey prompt with the WebAuthn options of the ceremony (OptionsJson) and returns the credential, such as GetCredentialAsync(string, CancellationToken). |
| Func<TCeremony, PasskeyCredential, CancellationToken, Task> | finish | Sends the credential to the service to finish the ceremony. |
| CancellationToken | cancellationToken | A token to cancel the try, which is passed to the delegates. |
Returns
| Type | Description |
|---|---|
| Task |
Remarks
A ceremony whose prompt fails or is cancelled is kept for the next try, or begun again in the background if it is about to expire. A ceremony whose credential was sent is not used again: sending it ends the ceremony on the service. When sending fails for another reason, a new ceremony is begun in the background for the next try.
Exceptions
| Type | Condition |
|---|---|
| PasskeyAuthenticatorException | The prompt failed or the person cancelled it. |
| OperationCanceledException |
|