View Source WebAuthnLiveComponent (WebAuthnLiveComponent v0.2.0)
A LiveComponent for passwordless authentication via WebAuthn.
Link to this section Summary
Link to this section Functions
Handlers for server and client events.
server-side-events
Server-Side Events
The following events are triggered by the rendered form:
"update_changeset"- Form data has changed."start_registration"- The user wants to create a new account."start_authentication"- The user wants to sign in as an existing user.
While the update_changeset event handler extracts data from the params argument, start_registration and start_authentication ignore the params argument, pulling state from the socket assigns instead.
client-side-events
Client-Side Events
WebAuthnLiveComponent uses a Javascript (JS) hook to interact with the client-side WebAuthn API.
The following events are triggered by the WebAuthn JS hook:
"webauthn_supported"- The JS hook as reported whether webauthn is supported."user_token"- A token stored in the client'ssessionStorage."register_attestation"- A WebAuthn registration attestation created by the client."authenticate_attestation"- A WebAuthn authentication attestation created by the client.
Ensure required assigns are present, falling back to default values where necessary.
Render the WebAuthn form.
update/2 is used here to catch the found_user assign once it's placed by the parent LiveView.