File tree Expand file tree Collapse file tree 3 files changed +433
-369
lines changed
Expand file tree Collapse file tree 3 files changed +433
-369
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,18 @@ used with the Hyperledger Fabric version 2.0 SDK for Node.
77import { WalletStores } from " fabric-wallet-migration" ;
88import { Wallet , Wallets } from " fabric-network" ;
99
10- const walletStore = WalletStores .newFileSystemWalletStore (oldWalletDirectory);
11- const oldWallet = new Wallet (walletStore);
10+ async function migrateWallet (oldWalletDirectory : string , newWalletDirectory : string ) {
11+ const walletStore = WalletStores .newFileSystemWalletStore (oldWalletDirectory);
12+ const oldWallet = new Wallet (walletStore);
1213
13- const newWallet = await Wallets .newFileSystemWallet (newWalletDirectory);
14+ const newWallet = await Wallets .newFileSystemWallet (newWalletDirectory);
1415
15- const identityLabels = await oldWallet .list ();
16- for (const label of identityLabels) {
17- const identity = await oldWallet .get (label);
18- await newWallet .put (label, identity);
16+ const identityLabels = await oldWallet .list ();
17+ for (const label of identityLabels) {
18+ const identity = await oldWallet .get (label);
19+ if (identity) {
20+ await newWallet .put (label, identity);
21+ }
22+ }
1923}
2024```
You can’t perform that action at this time.
0 commit comments