-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate Recovery Codes #501
Conversation
…ase/gotrue into j0_generate_recovery_codes
@@ -13,8 +13,12 @@ import ( | |||
) | |||
|
|||
// SecureToken creates a new random token | |||
func SecureToken() string { | |||
b := make([]byte, 16) | |||
func SecureToken(options ...int) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we take in a variable argument list here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh this is a way of taking in optional arguments. SecureToken()
is used to generate recovery codes which are of length 8 instead of the default of length 16, passing in an int (e.g. SecureToken(8)) will return a length 8 random string
Going to merge first to aid development of other branches, have addressed the comments but feel free to let me know if there are additional changes we should make -- will file a PR against the |
What kind of change does this PR introduce?
This PR should add the ability for a user signed in with a single factor(or more factors) to call
/mfa/%s/generate_recovery_codes
to produce recovery codes which will eventually be used toSignIn
, recover a factor.Given the all encompassing nature of this endpoint it should eventually move out of the
/mfa
route.There should also be a rate limiter on this but haven't decided on value.
What is the current behavior?
None
What is the new behavior?
Feel free to include screenshots if it includes visual changes.