liveshowy/webauthn_components
关于
Passkey authentication for Phoenix LiveView applications.
安全与隐私实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文WebauthnComponents
Passkey authentication for Phoenix LiveView applications.
Scope
WebauthnComponents wraps the client-server coordination of the WebAuthn ceremonies so that implementers can focus on the data model, business logic, and user experience. It provides:
WebauthnComponents.ClientCapabilitiesComponent— detect Passkey support in the browser.WebauthnComponents.RegistrationComponent— create a new credential.WebauthnComponents.AuthenticationComponent— authenticate with an existing credential.
Credential persistence, user lookup, and session management are the host application's responsibility. Persist at least the credential id, public key, and a reference to the user, then use them to verify future visits. See WebauthnComponents.RegistrationComponent and WebauthnComponents.AuthenticationComponent for details.
The
wac.installMix task and the bundled code generators were removed in v0.10. Implementers are free to follow CRUD, Event Sourcing, or other patterns for user and credential management.
Installation
Add the dependency to your mix.exs:
# my_app/mix.exs
def deps do
[
...
{:webauthn_components, "~> 0.11"}
]
end
Install and compile the dependency:
mix deps.get
mix compile
Register the package's JavaScript hooks with your LiveSocket. They are exported from priv/static/main.ts:
ClientCapabilitiesHookRegistrationHookAuthenticationHook
Each component sets a matching phx-hook attribute, so the hook names must be registered globally with LiveSocket.
Usage
The components are designed to support a variety of user-facing flows: separate registration and authentication pages, a consolidated page, or features rendered in a global navbar. Credential management commonly lives on a user settings page.
See the component module documentation for assigns, events, and the messages each component sends to its parent LiveView. Sequence diagrams are available in Webauthn Flows.
The CRUD Integration guide provides step-by-step instructions for adding Passkey support to a Phoenix application, extending code generated by mix phx.gen.auth.
Support & Limitations
WebAuthn vs. Passkeys
WebAuthn is the browser API; a Passkey is a credential created with that API. A Passkey may be stored on a single device or synchronized through a credential provider such as iCloud Keychain, Google Password Manager, or 1Password.
Benefits
Passkeys eliminate password reuse, mitigate credential-stuffing attacks, and resist phishing.
Browser support
Passkey support is broad across modern browsers; see caniuse. While this package targets browser-based WebAuthn, credentials may also be usable in native applications with appropriate configuration.
Limitations
Cloud-synced credentials are only reachable from devices signed in to the same credential provider.
Additional Resources
探索相关项目
加载中…