Add WebAuthn.generate_user_handle as an alias for generate_user_id#503
Merged
santiagorodriguez96 merged 2 commits intoJul 3, 2026
Merged
Conversation
Follow-up to cedarcode#502 The value returned by `WebAuthn.generate_user_id` is actually a [user handle](https://www.w3.org/TR/webauthn-2/#user-handle), not a user id — it's an opaque, randomly generated value that the spec recommends to *not* contain any personally identifying information. The name `generate_user_id` is misleading because it suggests using an application's own user identifier. This PR adds `WebAuthn.generate_user_handle` as a clearer, spec-aligned name and updates the README to use it. `WebAuthn.generate_user_id` is kept as an alias, so this is fully backwards compatible.
Contributor
|
Looks good! Thanks for your contribution ❤️ Just one minor styling comment 🙂 |
| configuration.encoder.encode(SecureRandom.random_bytes(64)) | ||
| end | ||
|
|
||
| singleton_class.send(:alias_method, :generate_user_handle, :generate_user_id) |
Contributor
There was a problem hiding this comment.
I think I'd prefer to do:
class << self
def generate_user_id
configuration.encoder.encode(SecureRandom.random_bytes(64))
end
alias_method :generate_user_handle, :generate_user_id
end🙂
santiagorodriguez96
approved these changes
Jul 3, 2026
Contributor
|
Looks good! Thank you so much @ttanimichi ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #502
The value returned by
WebAuthn.generate_user_idis actually a user handle, not a user id — it's an opaque, randomly generated value that the spec recommends not to contain any personally identifying information. The namegenerate_user_idis misleading because it suggests using an application's own user identifier.This PR adds
WebAuthn.generate_user_handleas a clearer, spec-aligned name and updates the README to use it.WebAuthn.generate_user_idis kept as an alias, so this is fully backwards compatible.