Documentation ¶
Index ¶
- Constants
- Variables
- func And(lhs, rhs *cb.SignaturePolicy) *cb.SignaturePolicy
- func Envelope(policy *cb.SignaturePolicy, identities [][]byte) *cb.SignaturePolicyEnvelope
- func FromString(policy string) (*cb.SignaturePolicyEnvelope, error)
- func NOutOf(n int32, policies []*cb.SignaturePolicy) *cb.SignaturePolicy
- func Or(lhs, rhs *cb.SignaturePolicy) *cb.SignaturePolicy
- func PolicyParseJava(yamlString string) (*cb.SignaturePolicyEnvelope, error)
- func PolicyParseNode(yamlString string) (*cb.SignaturePolicyEnvelope, error)
- func SignedBy(index int32) *cb.SignaturePolicy
- func SignedByAnyAdmin(ids []string) *cb.SignaturePolicyEnvelope
- func SignedByAnyClient(ids []string) *cb.SignaturePolicyEnvelope
- func SignedByAnyMember(ids []string) *cb.SignaturePolicyEnvelope
- func SignedByAnyPeer(ids []string) *cb.SignaturePolicyEnvelope
- func SignedByMspAdmin(mspId string) *cb.SignaturePolicyEnvelope
- func SignedByMspClient(mspId string) *cb.SignaturePolicyEnvelope
- func SignedByMspMember(mspId string) *cb.SignaturePolicyEnvelope
- func SignedByMspPeer(mspId string) *cb.SignaturePolicyEnvelope
- func SignedByNOutOfGivenRole(n int32, role mb.MSPRole_MSPRoleType, ids []string) *cb.SignaturePolicyEnvelope
Constants ¶
const ( GateAnd = "And" GateOr = "Or" GateOutOf = "OutOf" )
Gate values
const ( RoleAdmin = "admin" RoleMember = "member" RoleClient = "client" RolePeer = "peer" RoleOrderer = "orderer" )
Role values for principals
const ( Name = "name" MspID = "mspid" MspID2 = "mspId" Role = "role" SBy = "signed-by" )
Variables ¶
var AcceptAllPolicy *cb.SignaturePolicyEnvelope
AcceptAllPolicy always evaluates to true
var MarshaledAcceptAllPolicy []byte
MarshaledAcceptAllPolicy is the Marshaled version of AcceptAllPolicy
var MarshaledRejectAllPolicy []byte
MarshaledRejectAllPolicy is the Marshaled version of RejectAllPolicy
var RejectAllPolicy *cb.SignaturePolicyEnvelope
RejectAllPolicy always evaluates to false
Functions ¶
func And ¶
func And(lhs, rhs *cb.SignaturePolicy) *cb.SignaturePolicy
And is a convenience method which utilizes NOutOf to produce And equivalent behavior
func Envelope ¶
func Envelope(policy *cb.SignaturePolicy, identities [][]byte) *cb.SignaturePolicyEnvelope
Envelope builds an envelope message embedding a SignaturePolicy
func FromString ¶
func FromString(policy string) (*cb.SignaturePolicyEnvelope, error)
FromString takes a string representation of the policy, parses it and returns a SignaturePolicyEnvelope that implements that policy. The supported language is as follows:
GATE(P[, P])
where:
- GATE is either "and" or "or"
- P is either a principal or another nested call to GATE
A principal is defined as:
ORG.ROLE ¶
where:
- ORG is a string (representing the MSP identifier)
- ROLE takes the value of any of the RoleXXX constants representing the required role
func NOutOf ¶
func NOutOf(n int32, policies []*cb.SignaturePolicy) *cb.SignaturePolicy
NOutOf creates a policy which requires N out of the slice of policies to evaluate to true
func Or ¶
func Or(lhs, rhs *cb.SignaturePolicy) *cb.SignaturePolicy
Or is a convenience method which utilizes NOutOf to produce Or equivalent behavior
func PolicyParseJava ¶
func PolicyParseJava(yamlString string) (*cb.SignaturePolicyEnvelope, error)
func PolicyParseNode ¶
func PolicyParseNode(yamlString string) (*cb.SignaturePolicyEnvelope, error)
func SignedBy ¶
func SignedBy(index int32) *cb.SignaturePolicy
SignedBy creates a SignaturePolicy requiring a given signer's signature
func SignedByAnyAdmin ¶
func SignedByAnyAdmin(ids []string) *cb.SignaturePolicyEnvelope
SignedByAnyAdmin returns a policy that requires one valid signature from a admin of any of the orgs whose ids are listed in the supplied string array
func SignedByAnyClient ¶
func SignedByAnyClient(ids []string) *cb.SignaturePolicyEnvelope
SignedByAnyClient returns a policy that requires one valid signature from a client of any of the orgs whose ids are listed in the supplied string array
func SignedByAnyMember ¶
func SignedByAnyMember(ids []string) *cb.SignaturePolicyEnvelope
SignedByAnyMember returns a policy that requires one valid signature from a member of any of the orgs whose ids are listed in the supplied string array
func SignedByAnyPeer ¶
func SignedByAnyPeer(ids []string) *cb.SignaturePolicyEnvelope
SignedByAnyPeer returns a policy that requires one valid signature from an orderer of any of the orgs whose ids are listed in the supplied string array
func SignedByMspAdmin ¶
func SignedByMspAdmin(mspId string) *cb.SignaturePolicyEnvelope
SignedByMspAdmin creates a SignaturePolicyEnvelope requiring 1 signature from any admin of the specified MSP
func SignedByMspClient ¶
func SignedByMspClient(mspId string) *cb.SignaturePolicyEnvelope
SignedByMspClient creates a SignaturePolicyEnvelope requiring 1 signature from any client of the specified MSP
func SignedByMspMember ¶
func SignedByMspMember(mspId string) *cb.SignaturePolicyEnvelope
SignedByMspMember creates a SignaturePolicyEnvelope requiring 1 signature from any member of the specified MSP
func SignedByMspPeer ¶
func SignedByMspPeer(mspId string) *cb.SignaturePolicyEnvelope
SignedByMspPeer creates a SignaturePolicyEnvelope requiring 1 signature from any peer of the specified MSP
func SignedByNOutOfGivenRole ¶
func SignedByNOutOfGivenRole(n int32, role mb.MSPRole_MSPRoleType, ids []string) *cb.SignaturePolicyEnvelope
Types ¶
This section is empty.