π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
inline hop
Manav Rathi851fd08d5d40
diff --git a/web/packages/accounts/components/SignUpContents.tsx b/web/packages/accounts/components/SignUpContents.tsxindex 2b288e85eb..381122ac64 100644--- a/web/packages/accounts/components/SignUpContents.tsx+++ b/web/packages/accounts/components/SignUpContents.tsx@@ -13,10 +13,7 @@ import {Tooltip,Typography,} from "@mui/material";-import {- deriveSRPPassword,- generateSRPSetupAttributes,-} from "ente-accounts/services/srp";+import { generateSRPSetupAttributes } from "ente-accounts/services/srp";import {generateAndSaveInteractiveKeyAttributes,generateKeysAndAttributes,@@ -146,9 +143,8 @@ export const SignUpContents: React.FC<SignUpContentsProps> = ({const { masterKey, kek, keyAttributes } = gkResult;- const srpSetupAttributes = await generateSRPSetupAttributes(- await deriveSRPPassword(kek),- );+ const srpSetupAttributes =+ await generateSRPSetupAttributes(kek);setData("originalKeyAttributes", keyAttributes);setData("srpSetupAttributes", srpSetupAttributes);diff --git a/web/packages/accounts/pages/change-password.tsx b/web/packages/accounts/pages/change-password.tsxindex 42bded9e74..80638af96e 100644--- a/web/packages/accounts/pages/change-password.tsx+++ b/web/packages/accounts/pages/change-password.tsx@@ -8,7 +8,6 @@ import SetPasswordForm, {} from "ente-accounts/components/SetPasswordForm";import { appHomeRoute, stashRedirect } from "ente-accounts/services/redirect";import {- deriveSRPPassword,generateSRPSetupAttributes,getSRPAttributes,srpSetupOrReconfigure,@@ -105,13 +104,8 @@ const PageContents: React.FC<PageContentsProps> = ({ user }) => {memLimit,};- const loginSubKey = await deriveSRPPassword(kek);-- const { srpUserID, srpSalt, srpVerifier } =- await generateSRPSetupAttributes(loginSubKey);-await srpSetupOrReconfigure(- { srpSalt, srpUserID, srpVerifier, loginSubKey },+ await generateSRPSetupAttributes(kek),({ setupID, srpM1 }) =>updateSRPAndKeys(token, { setupID, srpM1, updatedKeyAttr }),);diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsxindex 26138c480d..34cfadc3d5 100644--- a/web/packages/accounts/pages/credentials.tsx+++ b/web/packages/accounts/pages/credentials.tsx@@ -24,7 +24,6 @@ import { checkSessionValidity } from "ente-accounts/services/session";import type { SRPAttributes } from "ente-accounts/services/srp";import {configureSRP,- deriveSRPPassword,generateSRPSetupAttributes,getSRPAttributes,loginViaSRP,@@ -272,10 +271,7 @@ const Page: React.FC = () => {}log.debug(() => `userSRPSetupPending ${!srpAttributes}`);if (!srpAttributes) {- const loginSubKey = await deriveSRPPassword(kek);- const srpSetupAttributes =- await generateSRPSetupAttributes(loginSubKey);- await configureSRP(srpSetupAttributes);+ await configureSRP(await generateSRPSetupAttributes(kek));}} catch (e) {log.error("migrate to srp failed", e);diff --git a/web/packages/accounts/pages/generate.tsx b/web/packages/accounts/pages/generate.tsxindex 1b6f0ec2f0..6ea72c51dd 100644--- a/web/packages/accounts/pages/generate.tsx+++ b/web/packages/accounts/pages/generate.tsx@@ -10,7 +10,6 @@ import SetPasswordForm, {import { appHomeRoute } from "ente-accounts/services/redirect";import {configureSRP,- deriveSRPPassword,generateSRPSetupAttributes,} from "ente-accounts/services/srp";import type { KeyAttributes, User } from "ente-accounts/services/user";@@ -74,12 +73,8 @@ const Page: React.FC = () => {const { masterKey, kek, keyAttributes } =await generateKeysAndAttributes(passphrase);- const srpSetupAttributes = await generateSRPSetupAttributes(- await deriveSRPPassword(kek),- );-await putUserKeyAttributes(keyAttributes);- await configureSRP(srpSetupAttributes);+ await configureSRP(await generateSRPSetupAttributes(kek));await generateAndSaveInteractiveKeyAttributes(passphrase,keyAttributes,diff --git a/web/packages/accounts/services/srp.ts b/web/packages/accounts/services/srp.tsindex f93ece600b..668094280b 100644--- a/web/packages/accounts/services/srp.ts+++ b/web/packages/accounts/services/srp.ts@@ -252,6 +252,8 @@ export const deriveSRPPassword = async (kek: string) => {};/**+ * A local-only structure holding information required for SRP setup.+ ** [Note: SRP setup attributes]** In some cases, there might be a step between the client having access to the@@ -281,17 +283,17 @@ const SRPSetupAttributes = z.object({export type SRPSetupAttributes = z.infer<typeof SRPSetupAttributes>;/**+ * Generate {@link SRPSetupAttributes} from the provided {@link kek}.*- * @param loginSubKey The user's SRP password (autogenerated, derived- * deterministically from their KEK by {@link deriveSRPPassword}).- *- * @returns+ * @param kek The designated key encryption key (base64 encoded) for the user.+ * This will be used to (deterministically) derive a SRP password.*/export const generateSRPSetupAttributes = async (- loginSubKey: string,+ kek: string,): Promise<SRPSetupAttributes> => {const cryptoWorker = await sharedCryptoWorker();+ const loginSubKey = await deriveSRPPassword(kek);const srpSalt = await cryptoWorker.generateDeriveKeySalt();// Museum schema requires this to be a UUID.