Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ea4d7e7
feat: recover private keys when recovering account
jzunigax2 Mar 31, 2025
5b7bef9
chore: update sdk version
jzunigax2 Mar 31, 2025
9ddf983
chore: improve test coverage
jzunigax2 Mar 31, 2025
7daa3a9
Merge branch 'master' of https://github.com/internxt/drive-web into f…
jzunigax2 Apr 1, 2025
30511aa
chore: rename variable for clarity
jzunigax2 Apr 1, 2025
70360eb
Merge branch 'master' into feat/recover-private-keys
CandelR Apr 9, 2025
6966998
Merge branch 'master' into feat/recover-private-keys
CandelR Apr 30, 2025
c59dfe9
Added new legacy backup key recover flow and tests
CandelR Apr 30, 2025
17c6735
Merge branch 'master' into feature/PB-4236-recover-account-new-flow
CandelR May 29, 2025
394d631
Update sdk
CandelR May 29, 2025
dcba538
Merge branch 'master' of https://github.com/internxt/drive-web into f…
jzunigax2 Jun 2, 2025
eb1723b
Merge branch 'feat/recover-private-keys' into feature/PB-4236-recover…
CandelR Jun 2, 2025
8a2b977
Merge branch 'master' of https://github.com/internxt/drive-web into f…
jzunigax2 Jun 27, 2025
fadbee5
Merge branch 'master' into feat/recover-private-keys
CandelR Jun 30, 2025
12d70f8
Merge branch 'master' of https://github.com/internxt/drive-web into f…
jzunigax2 Jul 15, 2025
a7c465e
Merge branch 'feat/recover-private-keys' into feature/PB-4236-recover…
CandelR Jul 15, 2025
51a292d
fix: use changePasswordWithLinkV2 method in updateCredentialsWithToken
jzunigax2 Jul 15, 2025
95328d5
Merge pull request #1525 from internxt/feature/PB-4236-recover-accoun…
CandelR Jul 15, 2025
5dd0c9f
Merge branch 'master' into feat/recover-private-keys
CandelR Jul 18, 2025
48a75dc
Fix paths in index.html for favicon, apple-touch-icon, and manifest
CandelR Jul 22, 2025
b3d22f5
Merge branch 'master' into feat/recover-private-keys
CandelR Jul 23, 2025
154c001
chore: bump sdk version
jzunigax2 Jul 23, 2025
24f6f13
Merge branch 'master' into feat/recover-private-keys
CandelR Jul 28, 2025
68ecb56
Merge branch 'master' of https://github.com/internxt/drive-web into f…
jzunigax2 Jul 28, 2025
b2d998d
fix: encode ECC encrypted mnemonic to base64 format before including …
jzunigax2 Jul 28, 2025
db65fd9
Merge branch 'master' into feat/recover-private-keys
CandelR Jul 31, 2025
fd3e9c8
Merge branch 'master' into feat/recover-private-keys
CandelR Aug 7, 2025
87fcc7c
Merge branch 'master' into feat/recover-private-keys
CandelR Aug 8, 2025
41d3675
Merge branch 'master' into feat/recover-private-keys
CandelR Aug 12, 2025
17fd878
Adapt backupKeyUtils test to b64 ecc encrypted
CandelR Aug 12, 2025
059e63a
Merge branch 'master' into feat/recover-private-keys
CandelR Aug 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@
"prettier --write"
]
}
}
}
49 changes: 31 additions & 18 deletions src/app/auth/components/ChangePassword/ChangePassword.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Dispatch, SetStateAction, useState, RefObject, createRef, useEffect } from 'react';
import { Link } from 'react-router-dom';
import authService from 'app/auth/services/auth.service';
import notificationsService, { ToastType } from 'app/notifications/services/notifications.service';
import testPasswordStrength from '@internxt/lib/dist/src/auth/testPasswordStrength';
import { useTranslationContext } from 'app/i18n/provider/TranslationProvider';
import { Button, Input } from '@internxt/ui';
import { CaretLeft, CheckCircle, FileArrowUp, Warning, WarningCircle } from '@phosphor-icons/react';
import authService from 'app/auth/services/auth.service';
import errorService from 'app/core/services/error.service';
import localStorageService from 'app/core/services/local-storage.service';
import { useTranslationContext } from 'app/i18n/provider/TranslationProvider';
import notificationsService, { ToastType } from 'app/notifications/services/notifications.service';
import PasswordStrengthIndicator from 'app/shared/components/PasswordStrengthIndicator';
import { MAX_PASSWORD_LENGTH } from 'app/shared/components/ValidPassword';
import { CaretLeft, FileArrowUp, Warning, WarningCircle, CheckCircle } from '@phosphor-icons/react';
import { validateMnemonic } from 'bip39';
import errorService from 'app/core/services/error.service';
import localStorageService from 'app/core/services/local-storage.service';
import { Dispatch, RefObject, SetStateAction, createRef, useEffect, useState } from 'react';
import { Link } from 'react-router-dom';

interface ChangePasswordProps {
setHasBackupKey: Dispatch<SetStateAction<boolean | undefined>>;
Expand Down Expand Up @@ -64,15 +64,26 @@ export default function ChangePassword(props: Readonly<ChangePasswordProps>): JS

const onUploadBackupKeyInputChanged = async (e) => {
const file = e.target.files[0];
const backupKey = await file.text();
const isValidBackupKey = validateMnemonic(backupKey);
const uploadedBackupKeyContent = await file.text();

try {
const backupData = JSON.parse(uploadedBackupKeyContent);

isValidBackupKey
? setBackupKeyContent(backupKey)
: notificationsService.show({
text: translate('auth.recoverAccount.changePassword.backupKeyError'),
type: ToastType.Error,
});
if (backupData.mnemonic && validateMnemonic(backupData.mnemonic)) {
setBackupKeyContent(uploadedBackupKeyContent);
return;
}
} catch (err) {
if (validateMnemonic(uploadedBackupKeyContent)) {
setBackupKeyContent(uploadedBackupKeyContent);
return;
}
}

notificationsService.show({
text: translate('auth.recoverAccount.changePassword.backupKeyError'),
type: ToastType.Error,
});
};

const onChangeHandler = (input: string) => {
Expand Down Expand Up @@ -113,17 +124,19 @@ export default function ChangePassword(props: Readonly<ChangePasswordProps>): JS

const token = window.location.pathname.split('/').pop();
const password = newPassword;
const mnemonic = backupKeyContent;

if (!token) {
notificationsService.show({
text: translate('auth.recoverAccount.changePassword.tokenError'),
type: ToastType.Error,
});
setIsLoading(false);
return;
}

try {
await authService.updateCredentialsWithToken(token, password, mnemonic);
await authService.recoverAccountWithBackupKey(token, password, backupKeyContent);

localStorageService.clear();
setIsEmailSent(true);
} catch (error) {
Expand Down
Loading
Loading