Documentation ¶
Index ¶
- func CartesianProduct(s1, s2 ComparablePrincipalSets) comparablePrincipalSetPairs
- func NewInquireableSignaturePolicy(sigPol *common.SignaturePolicyEnvelope) policies.InquireablePolicy
- type ComparablePrincipal
- type ComparablePrincipalSet
- func (cps ComparablePrincipalSet) Clone() ComparablePrincipalSet
- func (cps ComparablePrincipalSet) Contains(s *ComparablePrincipal) bool
- func (cps ComparablePrincipalSet) IsContainedIn(set ComparablePrincipalSet) bool
- func (cps ComparablePrincipalSet) IsSubset(sets ComparablePrincipalSet) bool
- func (cps ComparablePrincipalSet) String() string
- func (cps ComparablePrincipalSet) ToPrincipalSet() policies.PrincipalSet
- type ComparablePrincipalSets
- func (cps ComparablePrincipalSets) ExcludeIndices(mapping map[int][]int) ComparablePrincipalSets
- func (cps ComparablePrincipalSets) OfMapping(mapping map[int][]int, sets2 ComparablePrincipalSets) comparablePrincipalSetPairs
- func (cps ComparablePrincipalSets) Reduce() ComparablePrincipalSets
- func (cps ComparablePrincipalSets) ToPrincipalSets() policies.PrincipalSets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CartesianProduct ¶
func CartesianProduct(s1, s2 ComparablePrincipalSets) comparablePrincipalSetPairs
CartesianProduct returns a comparablePrincipalSetPairs that is comprised of the combination of every possible pair of ComparablePrincipalSet such that the first element is in s1, and the second element is in s2.
func NewInquireableSignaturePolicy ¶
func NewInquireableSignaturePolicy(sigPol *common.SignaturePolicyEnvelope) policies.InquireablePolicy
NewInquireableSignaturePolicy creates a signature policy that can be inquired, from a policy and a signature policy.
Types ¶
type ComparablePrincipal ¶
type ComparablePrincipal struct {
// contains filtered or unexported fields
}
ComparablePrincipal defines an MSPPrincipal that can be compared to other principals
func NewComparablePrincipal ¶
func NewComparablePrincipal(principal *msp.MSPPrincipal) *ComparablePrincipal
NewComparablePrincipal creates a ComparablePrincipal out of the given MSPPrincipal. Returns nil if a failure occurs.
func (*ComparablePrincipal) IsA ¶
func (cp *ComparablePrincipal) IsA(other *ComparablePrincipal) bool
IsA determines whether all identities that satisfy this ComparablePrincipal also satisfy the other ComparablePrincipal. Example: if this ComparablePrincipal is a Peer role, and the other ComparablePrincipal is a Member role, then all identities that satisfy this ComparablePrincipal (are peers) also satisfy the other principal (are members).
func (*ComparablePrincipal) IsFound ¶
func (cp *ComparablePrincipal) IsFound(set ...*ComparablePrincipal) bool
IsFound returns whether the ComparablePrincipal is found among the given set of ComparablePrincipals For the ComparablePrincipal x to be found, there needs to be some ComparablePrincipal y in the set such that x.IsA(y) will be true.
func (*ComparablePrincipal) ToOURole ¶
func (cp *ComparablePrincipal) ToOURole() *ComparablePrincipal
ToOURole converts this ComparablePrincipal to OU principal, and returns nil on failure
func (*ComparablePrincipal) ToRole ¶
func (cp *ComparablePrincipal) ToRole() *ComparablePrincipal
ToRole converts this ComparablePrincipal to MSP Role, and returns nil if the conversion failed
type ComparablePrincipalSet ¶
type ComparablePrincipalSet []*ComparablePrincipal
ComparablePrincipalSet aggregates ComparablePrincipals
func NewComparablePrincipalSet ¶
func NewComparablePrincipalSet(set policies.PrincipalSet) ComparablePrincipalSet
NewComparablePrincipalSet constructs a ComparablePrincipalSet out of the given PrincipalSet
func (ComparablePrincipalSet) Clone ¶
func (cps ComparablePrincipalSet) Clone() ComparablePrincipalSet
Clone returns a copy of this ComparablePrincipalSet
func (ComparablePrincipalSet) Contains ¶
func (cps ComparablePrincipalSet) Contains(s *ComparablePrincipal) bool
Contains returns whether this ComparablePrincipalSet contains the given ComparablePrincipal. A ComparablePrincipalSet X contains a ComparablePrincipal y if there is a ComparablePrincipal x in X such that x.IsA(y). From here it follows that every signature set that satisfies X, also satisfies y.
func (ComparablePrincipalSet) IsContainedIn ¶
func (cps ComparablePrincipalSet) IsContainedIn(set ComparablePrincipalSet) bool
IsContainedIn returns whether this ComparablePrincipalSet is contained in the given ComparablePrincipalSet. More formally- a ComparablePrincipalSet X is said to be contained in ComparablePrincipalSet Y if for each ComparablePrincipalSet x in X there is a ComparablePrincipalSet y in Y such that y.IsA(x) is true. If a ComparablePrincipalSet X is contained by a ComparablePrincipalSet Y then if a signature set satisfies Y, it also satisfies X, because for each x in X there is a y in Y such that there exists a signature of a corresponding identity such that the identity satisfies y, and therefore satisfies x too.
func (ComparablePrincipalSet) IsSubset ¶
func (cps ComparablePrincipalSet) IsSubset(sets ComparablePrincipalSet) bool
IsSubset returns whether this ComparablePrincipalSet is a subset of the given ComparablePrincipalSet
func (ComparablePrincipalSet) String ¶
func (cps ComparablePrincipalSet) String() string
String returns a string representation of this ComparablePrincipalSet
func (ComparablePrincipalSet) ToPrincipalSet ¶
func (cps ComparablePrincipalSet) ToPrincipalSet() policies.PrincipalSet
ToPrincipalSet converts this ComparablePrincipalSet to a PrincipalSet
type ComparablePrincipalSets ¶
type ComparablePrincipalSets []ComparablePrincipalSet
ComparablePrincipalSets aggregate ComparablePrincipalSets
func Merge ¶
func Merge(s1, s2 ComparablePrincipalSets) ComparablePrincipalSets
Merge returns ComparablePrincipalSets that the underlying PrincipalSets consist of PrincipalSets that satisfy the endorsement policies that both ComparablePrincipalSets were derived of. More formally speaking, let EP1 and EP2 be endorsement policies, and P1 and P2 be the principal sets that each principal set p in P1 satisfies EP1, and each principal set p in P2 satisfies EP2. Denote as S1 and S2 the ComparablePrincipalSets derived from EP1 and EP2 respectively. Then, S = Merge(S1, S2) wields ComparablePrincipalSets such that every ComparablePrincipalSet s in S, satisfies both EP1 and EP2.
func (ComparablePrincipalSets) ExcludeIndices ¶
func (cps ComparablePrincipalSets) ExcludeIndices(mapping map[int][]int) ComparablePrincipalSets
ExcludeIndices returns a ComparablePrincipalSets without the given indices found in the keys
func (ComparablePrincipalSets) OfMapping ¶
func (cps ComparablePrincipalSets) OfMapping(mapping map[int][]int, sets2 ComparablePrincipalSets) comparablePrincipalSetPairs
OfMapping returns comparablePrincipalSetPairs comprising only of the indices found in the given keys
func (ComparablePrincipalSets) Reduce ¶
func (cps ComparablePrincipalSets) Reduce() ComparablePrincipalSets
Reduce returns the ComparablePrincipalSets in a form such that no element contains another element. Every element that contains some other element is omitted from the result.
func (ComparablePrincipalSets) ToPrincipalSets ¶
func (cps ComparablePrincipalSets) ToPrincipalSets() policies.PrincipalSets
ToPrincipalSets converts this ComparablePrincipalSets to a PrincipalSets