Skip to content

Instantly share code, notes, and snippets.

@emshan
Created July 19, 2019 07:32
Show Gist options
  • Save emshan/ae7aa0e94402a76399347d173878b715 to your computer and use it in GitHub Desktop.
Save emshan/ae7aa0e94402a76399347d173878b715 to your computer and use it in GitHub Desktop.
create user using fabric-ca-client/ verifying id through client identity chaincode(CID)
# for attribute based access control, insert :ecert options in the attibutes
fabric-ca-client register \
--id.name user \
--id.secret password \
--id.type user \
--id.affiliation Org1 \
--id.attrs 'attr=true:ecert, hf.Affiliation=Org1:ecert'
# for enrollment.attrs, attributes named gets copied to ecert
# opt means the attributes can be optional
fabric-ca-client enroll -u http://user@localhost:7054 --enrollment.attrs "some,thing:opt"
# github.com/hyperledger/fabric/core/chaincode/lib/cid
# golang
stub shim.ChaincodeStubInterface
# get msp id from the cert
cid.GetMSPID(stub)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment