{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package cauthdsl\n\n## Constants\n\n```go\nconst (\n\tGateAnd   = \"And\"\n\tGateOr    = \"Or\"\n\tGateOutOf = \"OutOf\"\n)\n```\nGate values\n\n```go\nconst (\n\tRoleAdmin   = \"admin\"\n\tRoleMember  = \"member\"\n\tRoleClient  = \"client\"\n\tRolePeer    = \"peer\"\n\tRoleOrderer = \"orderer\"\n)\n```\nRole values for principals\n\n## Variables\n\n```go\nvar AcceptAllPolicy *cb.SignaturePolicyEnvelope\n```\nAcceptAllPolicy always evaluates to true\n\n```go\nvar MarshaledAcceptAllPolicy []byte\n```\nMarshaledAcceptAllPolicy is the Marshaled version of AcceptAllPolicy\n\n```go\nvar MarshaledRejectAllPolicy []byte\n```\nMarshaledRejectAllPolicy is the Marshaled version of RejectAllPolicy\n\n```go\nvar RejectAllPolicy *cb.SignaturePolicyEnvelope\n```\nRejectAllPolicy always evaluates to false\n\n## Functions\n\n```go\nfunc And(lhs, rhs *cb.SignaturePolicy) *cb.SignaturePolicy\n```\nAnd is a convenience method which utilizes NOutOf to produce And equivalent behavior\n\n```go\nfunc Envelope(policy *cb.SignaturePolicy, identities [][]byte) *cb.SignaturePolicyEnvelope\n```\nEnvelope builds an envelope message embedding a SignaturePolicy\n\n```go\nfunc FromString(policy string) (*common.SignaturePolicyEnvelope, error)\n```\nFromString takes a string representation of the policy, parses it and returns a SignaturePolicyEnvelope that implements that policy. The supported language is as follows:\n\nGATE(P\\[, P])\n\nwhere:\n\n  - GATE is either \"and\" or \"or\"\n  - P is either a principal or another nested call to GATE\n\nA principal is defined as:\n\n### ORG.ROLE {#hdr-ORG_ROLE}\n\nwhere:\n\n  - ORG is a string (representing the MSP identifier)\n  - ROLE takes the value of any of the RoleXXX constants representing the required role\n\n```go\nfunc NOutOf(n int32, policies []*cb.SignaturePolicy) *cb.SignaturePolicy\n```\nNOutOf creates a policy which requires N out of the slice of policies to evaluate to true\n\n```go\nfunc NewPolicyProvider(deserializer msp.IdentityDeserializer) policies.Provider\n```\nNewProviderImpl provides a policy generator for cauthdsl type policies\n\n```go\nfunc Or(lhs, rhs *cb.SignaturePolicy) *cb.SignaturePolicy\n```\nOr is a convenience method which utilizes NOutOf to produce Or equivalent behavior\n\n```go\nfunc SignedBy(index int32) *cb.SignaturePolicy\n```\nSignedBy creates a SignaturePolicy requiring a given signer's signature\n\n```go\nfunc SignedByAnyAdmin(ids []string) *cb.SignaturePolicyEnvelope\n```\nSignedByAnyAdmin 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\n\n```go\nfunc SignedByAnyClient(ids []string) *cb.SignaturePolicyEnvelope\n```\nSignedByAnyClient 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\n\n```go\nfunc SignedByAnyMember(ids []string) *cb.SignaturePolicyEnvelope\n```\nSignedByAnyMember 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\n\n```go\nfunc SignedByAnyPeer(ids []string) *cb.SignaturePolicyEnvelope\n```\nSignedByAnyPeer 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\n\n```go\nfunc SignedByMspAdmin(mspId string) *cb.SignaturePolicyEnvelope\n```\nSignedByMspAdmin creates a SignaturePolicyEnvelope requiring 1 signature from any admin of the specified MSP\n\n```go\nfunc SignedByMspClient(mspId string) *cb.SignaturePolicyEnvelope\n```\nSignedByMspClient creates a SignaturePolicyEnvelope requiring 1 signature from any client of the specified MSP\n\n```go\nfunc SignedByMspMember(mspId string) *cb.SignaturePolicyEnvelope\n```\nSignedByMspMember creates a SignaturePolicyEnvelope requiring 1 signature from any member of the specified MSP\n\n```go\nfunc SignedByMspPeer(mspId string) *cb.SignaturePolicyEnvelope\n```\nSignedByMspPeer creates a SignaturePolicyEnvelope requiring 1 signature from any peer of the specified MSP\n\n## Types\n\n```go\ntype EnvelopeBasedPolicyProvider struct {\n\tDeserializer msp.IdentityDeserializer\n}\n```\nEnvelopeBasedPolicyProvider allows to create a new policy from SignaturePolicyEnvelope struct instead of \\[]byte\n\n```go\nfunc (pp *EnvelopeBasedPolicyProvider) NewPolicy(sigPolicy *cb.SignaturePolicyEnvelope) (policies.Policy, error)\n```\nNewPolicy creates a new policy from the policy envelope\n\n```go\ntype Identity interface {\n\t// SatisfiesPrincipal checks whether this instance matches\n\t// the description supplied in MSPPrincipal. The check may\n\t// involve a byte-by-byte comparison (if the principal is\n\t// a serialized identity) or may require MSP validation\n\tSatisfiesPrincipal(principal *mspp.MSPPrincipal) error\n\n\t// GetIdentifier returns the identifier of that identity\n\tGetIdentifier() *msp.IdentityIdentifier\n}\n```\n\n```go\ntype IdentityAndSignature interface {\n\t// Identity returns the identity associated to this instance\n\tIdentity() (Identity, error)\n\n\t// Verify returns the validity status of this identity's signature over the message\n\tVerify() error\n}\n```\n\n","path":"github.com/eric-erki/https-hyperledger.org/common/cauthdsl","name":"cauthdsl","synopsis":"","isRedistributable":true}
