Replicate the code for registerUser-BankA.js to registerUser-BankB.js. Save the code file in the Bankchain repository.
Make the following changes to the code so that it works for the Bank B organization:
- Change the ccpPath object to the connection profile for Bank B, like this:
const ccpPath = path.resolve(__dirname, 'connection-bankb.json');
- Change the walletPath object to the wallet for Bank B, like this:
const walletPath = path.join(process.cwd(), 'wallet-BankB');
- Change the affiliation to bankb.department1 at both places, like this:
let affiliation = 'bankb.department1'
const secret = await ca.register({ affiliation: 'banka.department1', enrollmentID: 'user1', role: 'client' }, adminIdentity);
- Change the MSP to bankbMSP, like this:
const userIdentity = X509WalletMixin.createIdentity('bankbMSP', enrollment.certificate, enrollment.key.toBytes());
After you've made the changes, save the files. Let's register both of the users.