-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Bring back Replace Two Factor Device Flow #85134
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
Changes from all commits
368e9fc
e1d43d2
59b54fe
c87e539
915e54a
f1ed18d
d458ad7
00f8252
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| type ReplaceTwoFactorDeviceParams = { | ||
| step: 'verify_old' | 'verify_new'; | ||
| twoFactorAuthCode: string; | ||
| }; | ||
|
|
||
| export default ReplaceTwoFactorDeviceParams; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * Splits the two-factor auth secret key in 4 chunks of 4 characters each | ||
| */ | ||
| function splitSecretInChunks(secret: string): string { | ||
| if (secret.length !== 16) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ CONSISTENCY-2 (docs)The number Define a constant in const TOTP_SECRET_KEY_LENGTH = 16;
function splitSecretInChunks(secret: string): string {
if (secret.length !== TOTP_SECRET_KEY_LENGTH) {
return secret;
}
// ...
}Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency. |
||
| return secret; | ||
| } | ||
|
|
||
| return `${secret.slice(0, 4)} ${secret.slice(4, 8)} ${secret.slice(8, 12)} ${secret.slice(12, secret.length)}`; | ||
| } | ||
|
|
||
| /** | ||
| * Builds the URL string to generate the QRCode, using the otpauth:// protocol, | ||
| * so it can be detected by authenticator apps | ||
| */ | ||
| function buildAuthenticatorUrl(contactMethod: string, secretKey: string): string { | ||
| return `otpauth://totp/Expensify:${contactMethod}?secret=${secretKey}&issuer=Expensify`; | ||
| } | ||
|
|
||
| export {splitSecretInChunks, buildAuthenticatorUrl}; | ||
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.
❌ CONSISTENCY-3 (docs)
The
splitSecretInChunksandbuildAuthenticatorUrlfunctions extracted here are exact duplicates of the local functions already defined insrc/pages/settings/Security/TwoFactorAuth/VerifyPage.tsx(lines 61-75). The newTwoFactorAuthSecretDisplaycomponent correctly imports from this shared utility, butVerifyPage.tsxwas not updated to also use it, leaving duplicate implementations in the codebase.Update
VerifyPage.tsxto import from the new shared utility and remove its local copies:Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.