cauthdsl

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidSignature = []byte("badsigned")

InvalidSignature denotes a non-valid signature.

Functions

func NewPolicyProvider

func NewPolicyProvider(deserializer msp.IdentityDeserializer) policies.Provider

NewPolicyProvider provides a policy generator for cauthdsl type policies.

func ToIdentities

func ToIdentities(pIdentities []*msppb.Identity, deserializer msp.IdentityDeserializer) (
	[]msp.Identity, []bool,
)

ToIdentities convert serialized identities to msp Identity.

Types

type EnvelopeBasedPolicyProvider

type EnvelopeBasedPolicyProvider struct {
	Deserializer msp.IdentityDeserializer
}

EnvelopeBasedPolicyProvider allows to create a new policy from SignaturePolicyEnvelope struct instead of []byte.

func (*EnvelopeBasedPolicyProvider) NewPolicy

NewPolicy creates a new policy from the policy envelope.

type MockIdentity

type MockIdentity struct {
	MspID   string
	IDBytes []byte
}

MockIdentity interface defining operations associated to a "certificate".

func (*MockIdentity) Anonymous

func (*MockIdentity) Anonymous() bool

Anonymous returns true if this is an anonymous identity, false otherwise.

func (*MockIdentity) ExpiresAt

func (*MockIdentity) ExpiresAt() time.Time

ExpiresAt returns the time at which the Identity expires.

func (*MockIdentity) GetCertificatePEM

func (id *MockIdentity) GetCertificatePEM() ([]byte, error)

GetCertificatePEM returns the certificate in PEM format.

func (*MockIdentity) GetIdentifier

func (id *MockIdentity) GetIdentifier() *msp.IdentityIdentifier

GetIdentifier returns the identifier of that identity.

func (*MockIdentity) GetMSPIdentifier

func (*MockIdentity) GetMSPIdentifier() string

GetMSPIdentifier returns the MSP Id for this instance.

func (*MockIdentity) GetOrganizationalUnits

func (*MockIdentity) GetOrganizationalUnits() []*msp.OUIdentifier

GetOrganizationalUnits returns zero or more organization units or divisions this identity is related to as long as this is public information.

func (*MockIdentity) SatisfiesPrincipal

func (id *MockIdentity) SatisfiesPrincipal(p *mb.MSPPrincipal) error

SatisfiesPrincipal checks whether this instance matches the description supplied in MSPPrincipal.

func (*MockIdentity) Serialize

func (id *MockIdentity) Serialize() ([]byte, error)

Serialize converts an identity to bytes.

func (*MockIdentity) SerializeWithIDOfCert

func (id *MockIdentity) SerializeWithIDOfCert() ([]byte, error)

SerializeWithIDOfCert converts an identity to bytes.

func (*MockIdentity) Validate

func (*MockIdentity) Validate() error

Validate uses the rules that govern this identity to validate it.

func (*MockIdentity) Verify

func (*MockIdentity) Verify(_, sig []byte) error

Verify a signature over some message using this identity as reference.

type MockIdentityDeserializer

type MockIdentityDeserializer struct {
	Fail            error
	KnownIdentities map[msp.IdentityIdentifier]msp.Identity
}

MockIdentityDeserializer is implemented by both MSPManger and MSP.

func (*MockIdentityDeserializer) DeserializeIdentity

func (md *MockIdentityDeserializer) DeserializeIdentity(
	id *msppb.Identity,
) (msp.Identity, error)

DeserializeIdentity deserializes an identity.

func (*MockIdentityDeserializer) GetKnownDeserializedIdentity

func (md *MockIdentityDeserializer) GetKnownDeserializedIdentity(id msp.IdentityIdentifier) msp.Identity

GetKnownDeserializedIdentity returns a known identity matching the given IdentityIdentifier.

func (*MockIdentityDeserializer) IsWellFormed

func (*MockIdentityDeserializer) IsWellFormed(_ *msppb.Identity) error

IsWellFormed checks if the given identity can be deserialized into its provider-specific form.

Jump to

Keyboard shortcuts

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