Registry / storage / fabric-wallet-migration

fabric-wallet-migration

JSON →
library0.3.0jsnpmunverified

Library for migrating Hyperledger Fabric wallets from version 1.4 to version 2.0, published as v0.3.0. It provides a custom WalletStore for the Fabric v2 Node SDK (fabric-network v2) to read v1.4 wallets, and a wallet API for the Fabric Gateway client API. Unlike manual migration scripts, it supports both SDK-based and Gateway-based consumption. Ships TypeScript types.

npm install fabric-wallet-migration
INSTALL
IMPORT
SIG · FABRIC-WALLET-MIGR
F
fabric-wallet-migration
storagejavascriptv0.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

* as WalletMigration
✓ import * as WalletMigration from 'fabric-wallet-migration'
✗ const WalletMigration = require('fabric-wallet-migration')
Library is ESM-only; no CommonJS support.
wallets
✓ import { wallets } from 'fabric-wallet-migration'
✗ import { wallets } from 'fabric-wallet-migration/src/index.js'
wallets is a named export; don't import from internal paths.
newFileSystemWalletStoreV1
✓ import { newFileSystemWalletStoreV1 } from 'fabric-wallet-migration'
✗ import { newFileSystemWalletStoreV1 } from 'fabric-wallet-migration/lib/fsWalletStore'
This is a named export at the package root.

Migrates all identities from a v1.4 wallet directory to a v2 wallet directory using fabric-wallet-migration and fabric-network.

import * as WalletMigration from 'fabric-wallet-migration'; import { Wallet, Wallets } from 'fabric-network'; async function migrate(oldDir, newDir) { const store = await WalletMigration.newFileSystemWalletStoreV1(oldDir); const oldWallet = new Wallet(store); const newWallet = await Wallets.newFileSystemWallet(newDir); const labels = await oldWallet.list(); for (const label of labels) { const identity = await oldWallet.get(label); if (identity) await newWallet.put(label, identity); } }
Debug
Known issues
breakingRequires Node.js >=20
fix
Use Node.js 20 or later.
affects: >=0.3.0
breakingESM-only; no CJS support
fix
Use import syntax instead of require().
affects: >=0.3.0
gotchanewFileSystemWalletStoreV1 returns a store object, not a wallet. Must wrap in new Wallet(store)
fix
Instantiate Wallet with the store.
affects: >=0.3.0
deprecatedFabric Network SDK usage is being replaced by Fabric Gateway client API
fix
Consider using the wallets module for Gateway integration.
affects: >=0.3.0
gotchaGateway wallet entry has identity and privateKey fields; privateKey is a CryptoKey, not a string
fix
Use signers.newPrivateKeySigner(entry.privateKey) correctly.
affects: >=0.3.0
Errors
Common errors & fixes
Error: Cannot find module 'fabric-network'
Missing peer dependency fabric-network.
fix
npm install fabric-network@^2.0.0
TypeError: Cannot read properties of undefined (reading 'identity')
Using Gateway wallet entry incorrectly; entry may be undefined.
fix
Check if entry is defined before accessing properties.
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using CommonJS require() with ESM-only package.
fix
Use import syntax or set type: module in package.json.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies
fabric-networkoptionalProvides Wallet class used for migration (v2 SDK)
@hyperledger/fabric-gatewayoptionalRequired for using Gateway wallet API
Agent activity
15 hits · last 30 days
node
14
Resources
fabric-wallet-migration — npm install fabric-wallet-migration · libregistry