Overview
Thewebauthn client manages FIDO2/WebAuthn passkey credentials for your end-users. Register passkeys, verify attestation responses, list credentials, and delete them.
Access the webauthn client via client.webauthn.
Register Options
Generate WebAuthn registration options for a principal. Returns aPublicKeyCredentialCreationOptions-compatible dict to pass to the browser’s navigator.credentials.create().
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
principal_id | str | Yes | The ID of the principal (end-user) to register a passkey for. |
WebAuthnRegisterOptions
| Field | Type | Description |
|---|---|---|
challenge | str | Base64url-encoded challenge for the registration ceremony. |
rp | dict | Relying party information (name, id). |
user | dict | User entity (id, name, display_name). |
pub_key_cred_params | list[dict] | Supported public key algorithms (e.g., ES256, RS256). |
timeout | int | Timeout in milliseconds for the registration ceremony. |
attestation | str | Attestation conveyance preference. |
exclude_credentials | list[dict] | Existing credential descriptors to prevent re-registration. |
Register Verify
Verify a WebAuthn registration response from the browser. On success, the credential is stored and associated with the principal.WebAuthnRegisterVerifyParams
| Parameter | Type | Required | Description |
|---|---|---|---|
principal_id | str | Yes | The principal ID that this credential belongs to. |
credential | dict | Yes | The WebAuthn attestation response from navigator.credentials.create(). |
WebAuthnCredential
| Field | Type | Description |
|---|---|---|
credential_id | str | Unique credential identifier. |
public_key | str | Base64url-encoded public key. |
sign_count | int | The signature counter value. |
created_at | str | ISO 8601 timestamp when the credential was registered. |
aaguid | str | The authenticator attestation GUID. |
last_used_at | str | None | ISO 8601 timestamp of last authentication, or None. |
List Credentials
List all WebAuthn credentials registered for a principal.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
principal_id | str | Yes | The principal ID to list credentials for. |
Response
Returns alist[WebAuthnCredential]. See above for field descriptions.
Delete Credential
Delete a WebAuthn credential by its ID. The credential is immediately invalidated.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
credential_id | str | Yes | The credential ID to delete. |
None. A GrantexApiError is raised if the credential does not exist.