π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Tweak
Manav Rathi002ef8ca5c11
diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsxindex 184098319c..5ebee75d47 100644--- a/web/packages/accounts/pages/credentials.tsx+++ b/web/packages/accounts/pages/credentials.tsx@@ -243,14 +243,14 @@ const Page: React.FC = () => {const handleVerifyMasterPassword: VerifyMasterPasswordFormProps["onVerify"] =(key, kek, keyAttributes, passphrase) => {void (async () => {- if (isFirstLogin()) {- await generateAndSaveInteractiveKeyAttributes(- passphrase,- keyAttributes,- key,- );- }- await postVerification(key, kek, keyAttributes);+ const updatedKeyAttributes = isFirstLogin()+ ? await generateAndSaveInteractiveKeyAttributes(+ passphrase,+ keyAttributes,+ key,+ )+ : keyAttributes;+ await postVerification(key, kek, updatedKeyAttributes);})();};diff --git a/web/packages/accounts/services/user.ts b/web/packages/accounts/services/user.tsindex 4149c33e3a..aa9574e8b0 100644--- a/web/packages/accounts/services/user.ts+++ b/web/packages/accounts/services/user.ts@@ -1,10 +1,10 @@import {decryptBox,+ deriveInteractiveKey,deriveSensitiveKey,encryptBox,generateKey,generateKeyPair,- sharedCryptoWorker,} from "ente-base/crypto";import {authenticatedRequestHeaders,@@ -601,26 +601,32 @@ export const remoteLogoutIfNeeded = async () => {** @returns the update key attributes.*/-export async function generateAndSaveInteractiveKeyAttributes(+export const generateAndSaveInteractiveKeyAttributes = async (passphrase: string,- existingKeyAttributes: KeyAttributes,+ keyAttributes: KeyAttributes,key: string,-): Promise<KeyAttributes> {- const cryptoWorker = await sharedCryptoWorker();- const intermediateKek = await cryptoWorker.deriveInteractiveKey(passphrase);+): Promise<KeyAttributes> => {+ const {+ key: interactiveKEK,+ salt: kekSalt,+ opsLimit,+ memLimit,+ } = await deriveInteractiveKey(passphrase);+const { encryptedData: encryptedKey, nonce: keyDecryptionNonce } =- await cryptoWorker.encryptBox(key, intermediateKek.key);+ await encryptBox(key, interactiveKEK);- const intermediateKeyAttributes = Object.assign(existingKeyAttributes, {+ const interactiveKeyAttributes = {+ ...keyAttributes,encryptedKey,keyDecryptionNonce,- kekSalt: intermediateKek.salt,- opsLimit: intermediateKek.opsLimit,- memLimit: intermediateKek.memLimit,- });- setData("keyAttributes", intermediateKeyAttributes);- return intermediateKeyAttributes;-}+ kekSalt,+ opsLimit,+ memLimit,+ };+ setData("keyAttributes", interactiveKeyAttributes);+ return interactiveKeyAttributes;+};/*** Change the email associated with the user's account on remote.