Help us shape the future of Go! Take the 2026 Go Developer Survey

statebased

package
v1.4.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RoleTypeMember identifies an org's member identity
	RoleTypeMember = RoleType("MEMBER")
	// RoleTypePeer identifies an org's peer identity
	RoleTypePeer = RoleType("PEER")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyEndorsementPolicy

type KeyEndorsementPolicy interface {
	// Policy returns the endorsement policy as bytes
	Policy() ([]byte, error)

	// AddOrgs adds the specified orgs to the list of orgs that are required
	// to endorse. All orgs MSP role types will be set to the role that is
	// specified in the first parameter. Among other aspects the desired role
	// depends on the channel's configuration: if it supports node OUs, it is
	// likely going to be the PEER role, while the MEMBER role is the suited
	// one if it does not.
	AddOrgs(roleType RoleType, organizations ...string) error

	// DelOrgs deletes the specified channel orgs from the existing key-level endorsement
	// policy for this KVS key.
	DelOrgs(organizations ...string)

	// ListOrgs returns an array of channel orgs that are required to endorse chnages
	ListOrgs() []string
}

KeyEndorsementPolicy provides a set of convenience methods to create and modify a state-based endorsement policy. Endorsement policies created by this convenience layer will always be a logical AND of "<ORG>.peer" principals for one or more ORGs specified by the caller.

func NewStateEP

func NewStateEP(policy []byte) (KeyEndorsementPolicy, error)

NewStateEP constructs a state-based endorsement policy from a given serialized EP byte array. If the byte array is empty, a new EP is created.

type RoleType

type RoleType string

RoleType of an endorsement policy's identity

type RoleTypeDoesNotExistError

type RoleTypeDoesNotExistError struct {
	RoleType RoleType
}

RoleTypeDoesNotExistError is returned by function AddOrgs of KeyEndorsementPolicy if a role type that does not match one specified above is passed as an argument.

func (*RoleTypeDoesNotExistError) Error

func (r *RoleTypeDoesNotExistError) Error() string

Source Files

  • interfaces.go
  • statebasedimpl.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL