Skip to content

Commit d6489ca

Browse files
committed
feat: enable encrypted wallet backup with updated authScheme flow
1 parent 49a0ef0 commit d6489ca

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/lib/miden/back/vault.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ export class Vault {
116116
name: 'Miden Account 1',
117117
isPublic: true,
118118
type: WalletType.OnChain,
119-
hdIndex: hdAccIndex
119+
hdIndex: hdAccIndex,
120+
authScheme
120121
};
121122
const newAccounts = [initialAccount];
122123

@@ -246,7 +247,8 @@ export class Vault {
246247
name: accName,
247248
publicKey: walletId,
248249
isPublic: walletType === WalletType.OnChain,
249-
hdIndex: hdAccIndex
250+
hdIndex: hdAccIndex,
251+
authScheme
250252
};
251253

252254
const newAllAcounts = concatAccount(allAccounts, newAccount);

src/lib/shared/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ export interface WalletAccount {
153153
isPublic: boolean;
154154
type: WalletType;
155155
hdIndex: number;
156+
// Optional here for backwards compatibility
157+
authScheme?: AuthScheme;
156158
}
157159

158160
export interface WalletNetwork {

src/screens/encrypted-file-flow/ExportFileComplete.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { Button, ButtonVariant } from 'components/Button';
1111
import { useMidenContext } from 'lib/miden/front';
1212
import { deriveKey, encrypt, encryptJson, generateKey, generateSalt } from 'lib/miden/passworder';
1313
import { exportDb } from 'lib/miden/repo';
14+
import { WalletAccount } from 'lib/shared/types';
15+
import { AuthScheme } from 'screens/onboarding/types';
1416
import { EncryptedWalletFile, ENCRYPTED_WALLET_FILE_PASSWORD_CHECK, DecryptedWalletFile } from 'screens/shared';
1517

1618
export interface ExportFileCompleteProps {
@@ -41,6 +43,11 @@ const ExportFileComplete: React.FC<ExportFileCompleteProps> = ({
4143
const midenClientDbDump = await midenClient.exportDb();
4244
const walletDbDump = await exportDb();
4345

46+
const accs = accounts.map(acc => ({
47+
...acc,
48+
authScheme: acc.authScheme ?? AuthScheme.Falcon
49+
}));
50+
4451
const seedPhrase = await revealMnemonic(walletPassword);
4552
const secretKeysForImportedAccounts: Record<string, string> = {};
4653

0 commit comments

Comments
 (0)