Parcourir la source

feat: use encryption key for more entropy in reset secret

httpjamesm il y a 1 an
Parent
commit
d4d2c68299
1 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 5 3
      web/apps/photos/src/components/Sidebar/UtilitySection.tsx

+ 5 - 3
web/apps/photos/src/components/Sidebar/UtilitySection.tsx

@@ -18,7 +18,10 @@ import {
 import { APPS, CLIENT_PACKAGE_NAMES } from "@ente/shared/apps/constants";
 import ThemeSwitcher from "@ente/shared/components/ThemeSwitcher";
 import { getRecoveryKey } from "@ente/shared/crypto/helpers";
-import { encryptToB64 } from "@ente/shared/crypto/internal/libsodium";
+import {
+    encryptToB64,
+    generateEncryptionKey,
+} from "@ente/shared/crypto/internal/libsodium";
 import { getAccountsURL } from "@ente/shared/network/api";
 import { logError } from "@ente/shared/sentry";
 import { THEME_COLOR } from "@ente/shared/themes/constants";
@@ -28,7 +31,6 @@ import isElectron from "is-electron";
 import { getAccountsToken } from "services/userService";
 import { getDownloadAppMessage } from "utils/ui";
 import { isInternalUser } from "utils/user";
-import { v4 as uuidv4 } from "uuid";
 import Preferences from "./Preferences";
 
 export default function UtilitySection({ closeSidebar }) {
@@ -85,7 +87,7 @@ export default function UtilitySection({ closeSidebar }) {
                 // let's create the necessary recovery information
                 const recoveryKey = await getRecoveryKey();
 
-                const resetSecret = uuidv4();
+                const resetSecret = await generateEncryptionKey();
 
                 const encryptionResult = await encryptToB64(
                     resetSecret,