Repository navigation
v4.0.0 Release: Case Normalization for Email Addresses (Breaking Change) #10
treeder
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We have released v4.0.0 of
passkeys. This release introduces a breaking change regarding how email addresses are handled.Summary
Historically, email addresses were stored and looked up using whatever casing the user entered (e.g.,
User@Example.comanduser@example.comwere treated as distinct). In v4.0.0, we now consistently trim whitespace and lowercase all email addresses on both the client and server side before saving, looking them up, or passing them to callbacks.Why this change was made
Without case normalization, users who registered an account or passkey with a specific casing (e.g.,
User@Example.com) would find that typinguser@example.comduring login would create a completely separate session, bypassing their existing registered passkeys. Lowercasing emails is standard practice to avoid these casing mismatch issues.Breaking Changes & Migration Risk
userIdlogic falls back to the email address if no customemailStartcallback is provided. Because Cloudflare KV is case-sensitive, looking upusers-user@example.com(lowercased) will not find an existing record stored underusers-User@Example.com(mixed case).userId: If youremailStartcallback returns a case-insensitive user identifier (like a UUID or database ID), your application will remain backwards-compatible. However, if your database user lookups by email are case-sensitive, you may need to update them or run a one-time migration to lowercase existing email fields.If you have existing production users with mixed-cased email records, please ensure you migrate their email keys/IDs to lowercase when upgrading to v4.x.
All reactions