feat(mfa): add recovery codes status and generate endpoints - #2762
Open
fadymak wants to merge 5 commits into
Open
feat(mfa): add recovery codes status and generate endpoints#2762fadymak wants to merge 5 commits into
fadymak wants to merge 5 commits into
Conversation
annabkr
reviewed
Aug 28, 2026
xlgmokha
reviewed
Aug 28, 2026
annabkr
approved these changes
Aug 31, 2026
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.
Adds the recovery codes status and generation endpoints.
GET /factors/recovery-codesfor status and countsPOST /factors/recovery-codesfor creating the verified factor and returning the codesNote
The codes are returned unformatted (e.g.:
abcdefgh). We leave it up to the client to decide how to display the codes since the code lengths could vary and we shouldn't be enforcing any grouping or separators (e.g.:ABCD-EFGH)However, we normalize the accepted values (lower cased, hyphens and spaces stripped)
Status endpoint
Response (counts only, never codes):
{ "id": "b3f1c2a4-...", "type": "recovery_code", "total": 10, "remaining": 9 }Returns
404 mfa_factor_not_foundwhen no set is enrolled.Generate endpoint
The body is optional: a missing or blank
friendly_namedefaults to"Recovery codes".Response (plaintext codes shown once, in canonical form):
{ "id": "b3f1c2a4-...", "type": "recovery_code", "friendly_name": "My recovery codes", "total": 10, "codes": ["k4m9x7qp2ab8ht3z", "9wze6r5npd4cmq7v", "…8 more…"] }