π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
feat: twoFactorType prop with default in recovery page
httpjamesm267bd5628504
diff --git a/web/packages/accounts/pages/two-factor/recover.tsx b/web/packages/accounts/pages/two-factor/recover.tsxindex 67bd709e10..fcaf05eab4 100644--- a/web/packages/accounts/pages/two-factor/recover.tsx+++ b/web/packages/accounts/pages/two-factor/recover.tsx@@ -8,6 +8,7 @@ import { useEffect, useState } from "react";import { recoverTwoFactor, removeTwoFactor } from "@ente/accounts/api/user";import { PAGES } from "@ente/accounts/constants/pages";+import { TwoFactorType } from "@ente/accounts/constants/twofactor";import { logoutUser } from "@ente/accounts/services/user";import { PageProps } from "@ente/shared/apps/types";import { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";@@ -28,7 +29,11 @@ const bip39 = require("bip39");// mobile client library only supports english.bip39.setDefaultWordlist("english");-export default function Recover({ router, appContext }: PageProps) {+export default function Recover({+ router,+ appContext,+ twoFactorType = TwoFactorType.TOTP,+}: PageProps) {const [encryptedTwoFactorSecret, setEncryptedTwoFactorSecret] =useState<B64EncryptionResult>(null);const [sessionID, setSessionID] = useState(null);@@ -49,7 +54,10 @@ export default function Recover({ router, appContext }: PageProps) {}const main = async () => {try {- const resp = await recoverTwoFactor(user.twoFactorSessionID);+ const resp = await recoverTwoFactor(+ user.twoFactorSessionID,+ twoFactorType,+ );setDoesHaveEncryptedRecoveryKey(!!resp.encryptedSecret);if (!resp.encryptedSecret) {showContactSupportDialog({@@ -106,7 +114,11 @@ export default function Recover({ router, appContext }: PageProps) {encryptedTwoFactorSecret.nonce,await cryptoWorker.fromHex(recoveryKey),);- const resp = await removeTwoFactor(sessionID, twoFactorSecret);+ const resp = await removeTwoFactor(+ sessionID,+ twoFactorSecret,+ twoFactorType,+ );const { keyAttributes, encryptedToken, token, id } = resp;setData(LS_KEYS.USER, {...getData(LS_KEYS.USER),diff --git a/web/packages/shared/apps/types.ts b/web/packages/shared/apps/types.tsindex da5451311e..364342516f 100644--- a/web/packages/shared/apps/types.ts+++ b/web/packages/shared/apps/types.ts@@ -1,4 +1,5 @@import { EmotionCache } from "@emotion/react";+import { TwoFactorType } from "@ente/accounts/constants/twofactor";import { SetDialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";import { AppProps } from "next/app";import { NextRouter } from "next/router";@@ -16,4 +17,5 @@ export interface PageProps {};router: NextRouter;appName: APPS;+ twoFactorType?: TwoFactorType;}