Closed ebenissan closed 1 year ago
Upon the creation of an organization, a trusted certificate authority is defined. The CA issues credentials for users and registers them to the MSP. (The MSP is set up in the network configuration).
In order to connect to the gateway, you need to provide the wallet path (where the private key is stored), the user ID and the MSP (Membership Service Provider) that will verify registration and rights.
Then you specify the channel and chaincode ID and you can submit transactions.
const secret = await caClient.register({
affiliation,
enrollmentID: userId,
role: 'client',
}, adminUser);
const enrollment = await caClient.enroll({
enrollmentID: userId,
enrollmentSecret: secret,
});
const x509Identity = {
credentials: {
certificate: enrollment.certificate,
privateKey: enrollment.key.toBytes(),
},
mspId: orgMspId,
type: 'X.509',
};
await wallet.put(userId, x509Identity);
org1.department1
org1user
, konoikon
, danazhang
(Research different types of user IDs we can use, minimize the different identifiers per user).
const ccp = buildCCPOrg1(); // Loads the organization configuration
const gateway = new Gateway();
const gatewayOpts: GatewayOptions = {
wallet,
identity: org1UserId,
discovery: { enabled: true, asLocalhost: true },
};
await gateway.connect(ccp, gatewayOpts);
const network = await gateway.getNetwork(channelName);
const contract = network.getContract(chaincodeName);
To determine verifier registration process—user should be able to add verifier. Will need to generate artificial member IDs that have verifier permissions to test the code.