feat: use encryption key for more entropy in reset secret

This commit is contained in:
httpjamesm 2024-03-12 13:56:34 -04:00
parent 438387a4cb
commit d4d2c68299
No known key found for this signature in database

View file

@ -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,