policy

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidNamespaceID is returned when the namespace ID cannot be parsed.
	ErrInvalidNamespaceID = errors.New("invalid namespace ID")

	// SystemNamespacePolicies lists every system namespace whose authorization policy is
	// resolved directly from the config block bundle, rather than from ns__meta.
	SystemNamespacePolicies = []SystemNamespacePolicy{
		{NamespaceID: committerpb.MetaNamespaceID, PolicyPath: "/Channel/Application/LifecycleEndorsement"},
		{NamespaceID: committerpb.SnapshotNamespaceID, PolicyPath: "/Channel/Application/SnapshotEndorsement"},
		{NamespaceID: committerpb.CheckpointNamespaceID, PolicyPath: "/Channel/Application/CheckpointEndorsement"},
	}
)

Functions

func CreateNamespaceVerifier added in v0.1.8

func CreateNamespaceVerifier(
	pd *applicationpb.PolicyItem, idDeserializer msp.IdentityDeserializer,
) (*signature.NsVerifier, error)

CreateNamespaceVerifier parses policy item to a namespace policy.

func GetUpdatesFromNamespace

func GetUpdatesFromNamespace(nsTx *applicationpb.TxNamespace) *servicepb.VerifierUpdates

GetUpdatesFromNamespace translates a namespace TX to policy updates.

func MakeECDSAThresholdRuleNsPolicy added in v0.1.8

func MakeECDSAThresholdRuleNsPolicy(publicKey []byte) *applicationpb.NamespacePolicy

MakeECDSAThresholdRuleNsPolicy generates a namespace policy with threshold rule.

func MakePolicy

func MakePolicy(
	t *testing.T,
	ns string,
	nsPolicy *applicationpb.NamespacePolicy,
) *applicationpb.PolicyItem

MakePolicy generates a policy item from a namespace policy.

func MakePolicyAndNsEndorser added in v0.1.8

func MakePolicyAndNsEndorser(
	t *testing.T,
	ns string,
) (*applicationpb.PolicyItem, *testsig.NsEndorser)

MakePolicyAndNsEndorser generates a policyItem and NsEndorser.

func ParseChannelPolicy added in v1.0.5

func ParseChannelPolicy(bundle *channelconfig.Bundle, path string) (*signature.NsVerifier, error)

ParseChannelPolicy resolves a channel policy at the given PolicyManager path and wraps it as a namespace verifier. The path itself is used to identify the policy in error messages.

func UnmarshalNamespacePolicy added in v0.1.8

func UnmarshalNamespacePolicy(policyBytes []byte) (*applicationpb.NamespacePolicy, error)

UnmarshalNamespacePolicy unmarshals namespace policy bytes to a applicationpb.NamespacePolicy proto.

func ValidateConfigTx added in v0.1.9

func ValidateConfigTx(value []byte) error

ValidateConfigTx validates that a config transaction envelope can be parsed into a valid bundle with all the config-block channel policies the verifier depends on (see SystemNamespacePolicies).

func ValidateNamespaceID

func ValidateNamespaceID(nsID string) error

ValidateNamespaceID checkes that a given namespace has the required length and allowed characters.

Types

type SystemNamespacePolicy added in v1.0.5

type SystemNamespacePolicy struct {
	NamespaceID string
	PolicyPath  string
}

SystemNamespacePolicy pairs a system namespace ID with the channel policy path that authorizes transactions in that namespace, per the config block.

Jump to

Keyboard shortcuts

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