π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
reenable local logging
Abhinav9cfbc96fc7ea
diff --git a/packages/accounts/components/Login.tsx b/packages/accounts/components/Login.tsxindex 46dbe489d5..d17682614b 100644--- a/packages/accounts/components/Login.tsx+++ b/packages/accounts/components/Login.tsx@@ -7,7 +7,7 @@ import FormPaperTitle from '@ente/shared/components/Form/FormPaper/Title';import FormPaperFooter from '@ente/shared/components/Form/FormPaper/Footer';import LinkButton from '@ente/shared/components/LinkButton';import { t } from 'i18next';-// import { addLocalLog } from 'utils/logging';+import { addLocalLog } from '@ente/shared/logging';import { Input } from '@mui/material';import SingleInputForm, {SingleInputFormProps,@@ -28,9 +28,9 @@ export default function Login(props: LoginProps) {try {setData(LS_KEYS.USER, { email });const srpAttributes = await getSRPAttributes(email);- // addLocalLog(- // () => ` srpAttributes: ${JSON.stringify(srpAttributes)}`- // );+ addLocalLog(+ () => ` srpAttributes: ${JSON.stringify(srpAttributes)}`+ );if (!srpAttributes || srpAttributes.isEmailMFAEnabled) {await sendOtt(props.appName, email);router.push(PAGES.VERIFY);diff --git a/packages/accounts/pages/credentials.tsx b/packages/accounts/pages/credentials.tsxindex c46e3cc604..d687d6e5ea 100644--- a/packages/accounts/pages/credentials.tsx+++ b/packages/accounts/pages/credentials.tsx@@ -45,7 +45,7 @@ import VerifyMasterPasswordForm, {VerifyMasterPasswordFormProps,} from '@ente/shared/components/VerifyMasterPasswordForm';// import { APPS, getAppName } from '@ente/shared/apps';-// import { addLocalLog } from 'utils/logging';+import { addLocalLog } from '@ente/shared/logging';import ComlinkCryptoWorker from '@ente/shared/crypto';import { B64EncryptionResult } from '@ente/shared/crypto/types';import { CustomError } from '@ente/shared/error';@@ -219,7 +219,7 @@ export default function Credentials({setData(LS_KEYS.SRP_ATTRIBUTES, srpAttributes);}}- // addLocalLog(() => `userSRPSetupPending ${!srpAttributes}`);+ addLocalLog(() => `userSRPSetupPending ${!srpAttributes}`);if (!srpAttributes) {const loginSubKey = await generateLoginSubKey(kek);const srpSetupAttributes = await generateSRPSetupAttributes(diff --git a/packages/accounts/services/srp.ts b/packages/accounts/services/srp.tsindex 937e836b43..8da9072bbb 100644--- a/packages/accounts/services/srp.ts+++ b/packages/accounts/services/srp.ts@@ -14,6 +14,8 @@ import { v4 as uuidv4 } from 'uuid';import ComlinkCryptoWorker from '@ente/shared/crypto';import { generateLoginSubKey } from '@ente/shared/crypto/helpers';import { UserVerificationResponse } from '@ente/accounts/types/user';+import { logError } from '@ente/shared/sentry';+import { addLocalLog } from '@ente/shared/logging';const SRP_PARAMS = SRP.params['4096'];@@ -39,7 +41,7 @@ export const configureSRP = async ({const srpA = convertBufferToBase64(srpClient.computeA());- // addLocalLog(() => `srp a: ${srpA}`);+ addLocalLog(() => `srp a: ${srpA}`);const { setupID, srpB } = await startSRPSetup({srpA,srpUserID,@@ -57,11 +59,10 @@ export const configureSRP = async ({});srpClient.checkM2(convertBase64ToBuffer(srpM2));+ } catch (e) {+ logError(e, 'srp configure failed');+ throw e;} finally {- // catch (e) {- // logError(e, 'srp configure failed');- // throw e;- // }InMemoryStore.set(MS_KEYS.SRP_CONFIGURE_IN_PROGRESS, false);}};@@ -84,15 +85,15 @@ export const generateSRPSetupAttributes = async (const srpVerifier = convertBufferToBase64(srpVerifierBuffer);- // addLocalLog(- // () => `SRP setup attributes generated',- // ${JSON.stringify({- // srpSalt,- // srpUserID,- // srpVerifier,- // loginSubKey,- // })}`- // );+ addLocalLog(+ () => `SRP setup attributes generated',+ ${JSON.stringify({+ srpSalt,+ srpUserID,+ srpVerifier,+ loginSubKey,+ })}`+ );return {srpUserID,@@ -106,37 +107,37 @@ export const loginViaSRP = async (srpAttributes: SRPAttributes,kek: string): Promise<UserVerificationResponse> => {- // try {- const loginSubKey = await generateLoginSubKey(kek);- const srpClient = await generateSRPClient(- srpAttributes.srpSalt,- srpAttributes.srpUserID,- loginSubKey- );- const srpA = srpClient.computeA();- const { srpB, sessionID } = await createSRPSession(- srpAttributes.srpUserID,- convertBufferToBase64(srpA)- );- srpClient.setB(convertBase64ToBuffer(srpB));-- const m1 = srpClient.computeM1();- // addLocalLog(() => `srp m1: ${convertBufferToBase64(m1)}`);- const { srpM2, ...rest } = await verifySRPSession(- sessionID,- srpAttributes.srpUserID,- convertBufferToBase64(m1)- );- // addLocalLog(() => `srp verify session successful,srpM2: ${srpM2}`);+ try {+ const loginSubKey = await generateLoginSubKey(kek);+ const srpClient = await generateSRPClient(+ srpAttributes.srpSalt,+ srpAttributes.srpUserID,+ loginSubKey+ );+ const srpA = srpClient.computeA();+ const { srpB, sessionID } = await createSRPSession(+ srpAttributes.srpUserID,+ convertBufferToBase64(srpA)+ );+ srpClient.setB(convertBase64ToBuffer(srpB));- srpClient.checkM2(convertBase64ToBuffer(srpM2));+ const m1 = srpClient.computeM1();+ addLocalLog(() => `srp m1: ${convertBufferToBase64(m1)}`);+ const { srpM2, ...rest } = await verifySRPSession(+ sessionID,+ srpAttributes.srpUserID,+ convertBufferToBase64(m1)+ );+ addLocalLog(() => `srp verify session successful,srpM2: ${srpM2}`);++ srpClient.checkM2(convertBase64ToBuffer(srpM2));- // addLocalLog(() => `srp server verify successful`);- return rest;- // } catch (e) {- // logError(e, 'srp verify failed');- // throw e;- // }+ addLocalLog(() => `srp server verify successful`);+ return rest;+ } catch (e) {+ logError(e, 'srp verify failed');+ throw e;+ }};// ====================diff --git a/packages/shared/worker/comlinkWorker.ts b/packages/shared/worker/comlinkWorker.tsindex 3e3e8e3b99..a582bd00a6 100644--- a/packages/shared/worker/comlinkWorker.ts+++ b/packages/shared/worker/comlinkWorker.ts@@ -1,6 +1,6 @@import { Remote, wrap } from 'comlink';// import { WorkerElectronCacheStorageClient } from 'services/workerElectronCache/client';-// import { addLocalLog } from 'utils/logging';+import { addLocalLog } from '@ente/shared/logging';export class ComlinkWorker<T extends new () => InstanceType<T>> {public remote: Promise<Remote<InstanceType<T>>>;@@ -14,7 +14,7 @@ export class ComlinkWorker<T extends new () => InstanceType<T>> {this.worker.onerror = (errorEvent) => {console.error('Got error event from worker', errorEvent);};- // addLocalLog(() => `Initiated ${this.name}`);+ addLocalLog(() => `Initiated ${this.name}`);const comlink = wrap<T>(this.worker);this.remote = new comlink() as Promise<Remote<InstanceType<T>>>;// expose(WorkerElectronCacheStorageClient, this.worker);@@ -26,6 +26,6 @@ export class ComlinkWorker<T extends new () => InstanceType<T>> {public terminate() {this.worker.terminate();- // addLocalLog(() => `Terminated ${this.name}`);+ addLocalLog(() => `Terminated ${this.name}`);}}