Skip to content

Commit

Permalink
FAB-8806 NodeSDK - Discovery part 2
Browse files Browse the repository at this point in the history
Add discovery to the initialization of the channel.
Refactor NodeSDK to allow for a plugin based endorsement.
Continue with the code clean up.

Change-Id: I6283c94eb1519777a8eebb2456a748588fb90294
Signed-off-by: Bret Harrison <[email protected]>
  • Loading branch information
harrisob committed Jun 5, 2018
1 parent acce409 commit c0913d2
Show file tree
Hide file tree
Showing 36 changed files with 1,306 additions and 613 deletions.
2 changes: 1 addition & 1 deletion docs/tutorials/network-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ var fabric_ca_client = client.getCertificateAuthority();
```
Then once we have a fabric-ca-client, we will be able to register new users. We could also use the fabric-ca-client to enroll users and make a few calls to the fabric client to create a user object and then assign that user object to the fabric client, but it will be much easier to just use the convenience method of the fabric client instance. Notice how we have to use the 'admin' user object returned from the client.setUserContext() to do the register. The admin user object has the credentials needed to the register. Then notice we called the same setUserContext method as we did with the admin above, this will have the fabric client object assigned with the 'user1' user context thus providing the credentials to interact with the fabric network. Note that the setUserContext also stores the user context which contains the signed certificate from the certificate authority and newly created public and private keys of the now enrolled user.
```
ca.fabric_ca_client({enrollmentID: 'user1', affiliation: 'org1'}, admin)
fabric_ca_client.register({enrollmentID: 'user1', affiliation: 'org1'}, admin)
.then((secret) => {
return client.setUserContext({username:'user1', password:secret});
}).then((user)=> {
Expand Down
6 changes: 5 additions & 1 deletion fabric-client/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
"network-config-schema" : {
"1.0": "./impl/NetworkConfig_1_0.js"
},
"grpc-wait-for-ready-timeout": 3000
"grpc-wait-for-ready-timeout": 3000,
"initialize-with-discovery": false,
"discovery-cache-life": 300000,
"discovery-protocol": "grpcs",
"endorsement-handler-path": "fabric-client/lib/impl/DiscoveryEndorsementHandler.js"
}
Loading

0 comments on commit c0913d2

Please sign in to comment.