Passkeys are public-key credentials created for a relying party and used through a browser or platform authenticator. During enrollment, the authenticator creates a key pair; the service stores the public key and related credential metadata, while the private key remains with the authenticator or synced credential provider. During login, the service sends a challenge and verifies a signed response. Because the credential is scoped to a relying party, WebAuthn can resist many phishing attacks that rely on a user entering a reusable password into an impostor site.
Passkeys change the credential mechanism, not the entire account security model. Enrollment, device change, recovery, session management, account linking, and administrator reset flows still need careful design. An account protected by a phishing-resistant login can be taken over through a weak recovery channel if that channel is not held to an appropriate standard.
The server should generate registration challenges with secure randomness, bind them to the account and session, expire them quickly, and accept each only once. The browser should invoke the WebAuthn API over a secure context and supply the expected relying-party identifier and origin. On the server, validate the challenge, origin, relying-party ID hash, credential type, public-key algorithm, and any user-verification requirements according to the protocol and library.
Store the credential ID, public key, user association, sign counter or relevant authenticator metadata, backup eligibility/state where supported, creation time, and a human-readable device label. Avoid storing attestation data that the service does not need. Attestation can support specific device trust policies, but collecting it can create privacy and operational complexity. Make the policy clear to users and avoid claiming that every passkey is hardware-bound when the authenticator may synchronize credentials.
For authentication, issue an unpredictable challenge tied to the current login attempt and expected account or discoverable-credential flow. Reject expired, reused, or mismatched challenges. Verify the signature against the registered public key, check origin and relying-party ID, and enforce user-presence or user-verification requirements appropriate to the account risk. Do not accept a client-side success flag without server verification.
Use a maintained WebAuthn library rather than implementing CBOR parsing, signature validation, or authenticator data handling from scratch. Keep the library updated and test malformed assertions, wrong origins, replayed challenges, unknown credential IDs, and invalid signatures. Treat any submitted credential metadata as untrusted until cryptographic verification succeeds.
Users lose devices, change platforms, and may not have access to a synced credential. Offer a recovery path that is secure, understandable, and proportional to account impact. Recovery codes should be high entropy, stored safely, shown only once, and invalidated when used. For higher-risk accounts, consider additional checks, notification, and a delay for sensitive changes. Do not let support staff bypass controls without strong identity verification and audit records.
Allow users to view and revoke registered credentials, with clear labels and last-used information. Notify them when a new credential is enrolled, removed, or used for a sensitive account change. If a user removes the last passkey, ensure another secure authentication method or recovery path remains. Device removal from an account should revoke server-side credential records when the user confirms it.
Successful passkey authentication should establish a session using the application's normal secure session controls: strong identifiers, secure cookie flags, appropriate expiration, rotation after privilege changes, and server-side revocation. A passkey assertion does not automatically make an existing session non-replayable or remove the need for CSRF protection where cookies are used.
For sensitive actions, consider step-up authentication or transaction confirmation. A login ceremony proves user presence and verifies a credential; it does not necessarily show that the user approved a particular payment, recovery email change, or permission grant. Present important transaction details clearly and bind approval to the action where the security model requires it.
Support multiple authenticators and platforms where possible, and provide a gradual migration path from passwords or other MFA. Clearly explain whether credentials synchronize and how a user can enroll a backup device. Avoid collecting more authenticator telemetry than the product needs. Define what happens when a credential is backed up, restored, or used on a new device according to the current WebAuthn and platform behavior.
Log credential enrollment, revocation, authentication outcomes, recovery use, and sensitive account changes. Never log private keys or full sensitive assertion material without a documented need. Monitor unusual recovery patterns and repeated failures, and ensure logs allow a responder to identify which account and credential were involved.
Use secure, single-use challenges; validate origin and relying-party binding; verify assertions server-side with a maintained library; store only required credential metadata; support user-visible credential management; secure recovery and support workflows; maintain hardened sessions; notify users of credential changes; test replay and malformed input; and document compatibility and synchronization behavior. Reassess controls for privileged and high-value accounts.
Passkeys can make phishing-resistant authentication more accessible, but the complete security benefit depends on the account lifecycle. Build enrollment, login, recovery, revocation, and session handling together. Test both successful ceremonies and the failure paths that an attacker or a locked-out user will encounter.