Search code examples
hyperledger-fabrichyperledger-fabric-sdk-js

Regarding How front end application access the wallet in hyperledger fabric


In Hyperledger fabric Is it Wallet will save in user device like mobile and laptop and how front end will use the wallet if it store user device?

Thanks in advance


Solution

  • Yes wallet you can store in user device like in fabcar example. If you go to registerUser.js, you will observe :

     // Create a new file system based wallet for managing identities.
            const walletPath = path.join(process.cwd(), 'wallet');
            const wallet = new FileSystemWallet(walletPath);
            console.log(`Wallet path: ${walletPath}`);
    
            // Check to see if we've already enrolled the user.
            const userExists = await wallet.exists('user1');
            if (userExists) {
                console.log('An identity for the user "user1" already exists in the wallet');
                return;
            }
    

    a walletPath is declared where you choose the directory to store identities and manage them. As you can see in userExists, it checks if user1's certificate exists in wallet directory or not.