Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Conv

Manav Rathi37775b9ee5a6
diff --git a/web/packages/accounts/pages/two-factor/setup.tsx b/web/packages/accounts/pages/two-factor/setup.tsx
index 36d7d27d8a..9f503f75fe 100644
--- a/web/packages/accounts/pages/two-factor/setup.tsx
+++ b/web/packages/accounts/pages/two-factor/setup.tsx
@@ -28,15 +28,14 @@ const Page: React.FC = () => {
}, []);
const handleSubmit = useCallback(async (otp: string) => {
- const recoveryEncryptedTwoFactorSecret = await encryptWithRecoveryKey(
- twoFactorSecret!.secretCode,
- );
+ const {
+ encryptedData: encryptedTwoFactorSecret,
+ nonce: twoFactorSecretDecryptionNonce,
+ } = await encryptWithRecoveryKey(twoFactorSecret!.secretCode);
await enableTwoFactor({
code: otp,
- encryptedTwoFactorSecret:
- recoveryEncryptedTwoFactorSecret.encryptedData,
- twoFactorSecretDecryptionNonce:
- recoveryEncryptedTwoFactorSecret.nonce,
+ encryptedTwoFactorSecret,
+ twoFactorSecretDecryptionNonce,
});
await setLSUser({
...getData(LS_KEYS.USER),
diff --git a/web/packages/shared/crypto/helpers.ts b/web/packages/shared/crypto/helpers.ts
index bde7224c9e..15abcad3e1 100644
--- a/web/packages/shared/crypto/helpers.ts
+++ b/web/packages/shared/crypto/helpers.ts
@@ -116,7 +116,7 @@ export const encryptWithRecoveryKey = async (data: string) => {
const cryptoWorker = await sharedCryptoWorker();
const hexRecoveryKey = await getRecoveryKey();
const recoveryKey = await cryptoWorker.fromHex(hexRecoveryKey);
- return cryptoWorker.encryptToB64(data, recoveryKey);
+ return cryptoWorker.encryptBoxB64(data, recoveryKey);
};
export const getRecoveryKey = async () => {