proto

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcCertificateSHA256

func CalcCertificateSHA256(b *pem.Block) []byte

func ParseAnchorPeers

func ParseAnchorPeers(mspConfigGroup *common.ConfigGroup) ([]*peer.AnchorPeer, error)

func ParseAnchorPeersFromBytes

func ParseAnchorPeersFromBytes(b []byte) ([]*peer.AnchorPeer, error)

func ParseApplicationConfig

func ParseApplicationConfig(cfg common.Config) (map[string]ApplicationConfig, error)

func ParseBatchSizeFromBytes

func ParseBatchSizeFromBytes(b []byte) (*orderer.BatchSize, error)

func ParseBlockDataHashingStructure

func ParseBlockDataHashingStructure(cfg common.Config) (*common.BlockDataHashingStructure, error)

func ParseCapabilities

func ParseCapabilities(cfg common.Config) (*common.Capabilities, error)

func ParseChaincodeAction

func ParseChaincodeAction(txAction *peer.TransactionAction) (*peer.ChaincodeAction, error)

func ParseConsortium

func ParseConsortium(cfg common.Config) (string, error)

func ParseConsortiumFromBytes

func ParseConsortiumFromBytes(b []byte) (string, error)

func ParseHashingAlgorithm

func ParseHashingAlgorithm(cfg common.Config) (string, error)

func ParseHashingAlgorithmFromBytes

func ParseHashingAlgorithmFromBytes(b []byte) (string, error)

func ParseOrderer

func ParseOrderer(cfg common.Config) (map[string]OrdererConfig, error)

func ParseOrdererBatchSize

func ParseOrdererBatchSize(cfg common.Config) (*orderer.BatchSize, error)

func ParseOrdererBatchTimeout

func ParseOrdererBatchTimeout(cfg common.Config) (string, error)

func ParseOrdererBatchTimeoutFromBytes

func ParseOrdererBatchTimeoutFromBytes(b []byte) (string, error)

func ParseOrdererConsesusType

func ParseOrdererConsesusType(cfg common.Config) (*orderer.ConsensusType, error)

func ParseOrdererConsesusTypeFromBytes

func ParseOrdererConsesusTypeFromBytes(b []byte) (*orderer.ConsensusType, error)

func ParseOrdererEndpoints

func ParseOrdererEndpoints(b []byte) ([]string, error)

func ParseOrdererIdentity

func ParseOrdererIdentity(cb *common.Block) (*msp.SerializedIdentity, error)

func ParseParseBlockDataHashingStructureFromBytes

func ParseParseBlockDataHashingStructureFromBytes(b []byte) (*common.BlockDataHashingStructure, error)

func ParseParseCapabilitiesFromBytes

func ParseParseCapabilitiesFromBytes(b []byte) (*common.Capabilities, error)

func ParsePolicy

func ParsePolicy(policiesCfg map[string]*common.ConfigPolicy) (map[PolicyKey]Policy, error)

func ParseTransactionActionChaincode

func ParseTransactionActionChaincode(txAction *peer.TransactionAction) (*peer.ChaincodeInvocationSpec, error)

func ParseTransactionActionEndorsers

func ParseTransactionActionEndorsers(txAction *peer.TransactionAction) ([]*msp.SerializedIdentity, error)

func ParseTransactionActionEvents

func ParseTransactionActionEvents(chaincodeAction *peer.ChaincodeAction) (*peer.ChaincodeEvent, error)

func ParseTransactionActionReadWriteSet

func ParseTransactionActionReadWriteSet(chaincodeAction *peer.ChaincodeAction) ([]*kvrwset.KVRWSet, error)

Types

type ApplicationConfig

type ApplicationConfig struct {
	Name        string             `json:"name"`
	MSP         MSP                `json:"msp"`
	AnchorPeers []*peer.AnchorPeer `json:"anchor_peers"`
}

type Block

type Block struct {
	Header          *common.BlockHeader     `json:"header"`
	Envelopes       []*Envelope             `json:"envelopes"`
	OrdererIdentity *msp.SerializedIdentity `json:"orderer_identity"`
}

func ParseBlock

func ParseBlock(block *common.Block) (*Block, error)

func (*Block) ValidEnvelopes

func (b *Block) ValidEnvelopes() Envelopes

type CertType

type CertType string
const (
	RootCACertType       CertType = "ca"
	IntermediateCertType CertType = "intermediate"
	AdminCertType        CertType = "admin"
)

type Certificate

type Certificate struct {
	FingerprintSHA256 []byte
	Data              []byte
	MSPID             string
	Type              CertType
	MSPName           string
}

Certificate - describes certificate(can be ca, intermediate, admin) from msp

func NewCertificate

func NewCertificate(cert []byte, t CertType, mspID, mspName string) (Certificate, error)

type ChannelConfig

type ChannelConfig struct {
	Applications map[string]ApplicationConfig `json:"applications"`
	Orderers     map[string]OrdererConfig     `json:"orderers"`

	OrdererBatchSize    orderer.BatchSize     `json:"orderer_batch_size"`
	OrdererBatchTimeout string                `json:"orderer_batch_timeout"`
	OrdererConsesusType orderer.ConsensusType `json:"orderer_consensus_type"`

	Consortium                string                           `json:"consortium"`
	HashingAlgorithm          string                           `json:"hashing_algorithm"`
	BlockDataHashingStructure common.BlockDataHashingStructure `json:"block_data_hashing_structure"`
	Capabilities              common.Capabilities              `json:"capabilities"`

	Policy map[PolicyKey]Policy `json:"policy"`
}

func ParseChannelConfig

func ParseChannelConfig(cc common.Config) (*ChannelConfig, error)

func (ChannelConfig) GetAllCertificates

func (c ChannelConfig) GetAllCertificates() ([]Certificate, error)

GetAllCertificates - returns all(root, intermediate, admins) certificates from all MSP's

type Envelope

type Envelope struct {
	Signature      []byte                `json:"signature"`
	ChannelHeader  *common.ChannelHeader `json:"channel_header"`
	ValidationCode peer.TxValidationCode `json:"validation_code"`
	Transaction    *Transaction          `json:"transaction,omitempty"`
	ChannelConfig  *ChannelConfig        `json:"channel_config,omitempty"`
}

func ParseEnvelope

func ParseEnvelope(envelopeData []byte, validationCode peer.TxValidationCode) (*Envelope, error)

func ParseEnvelopes

func ParseEnvelopes(blockData [][]byte, txFilter txflags.ValidationFlags) ([]*Envelope, error)

type Envelopes

type Envelopes []*Envelope

type MSP

type MSP struct {
	Name   string
	Config msp.FabricMSPConfig  `json:"config"`
	Policy map[PolicyKey]Policy `json:"policy"`
}

func ParseMSP

func ParseMSP(mspConfigGroup *common.ConfigGroup, groupName string) (*MSP, error)

func (MSP) GetAllCertificates

func (c MSP) GetAllCertificates() ([]Certificate, error)

GetAllCertificates - returns all certificates from MSP

type OrdererConfig

type OrdererConfig struct {
	Name      string   `json:"name"`
	MSP       MSP      `json:"msp"`
	Endpoints []string `json:"endpoints"`
}

type Policy

type Policy struct {
	Type               common.Policy_PolicyType   `json:"-"`
	ImplicitMetaPolicy *common.ImplicitMetaPolicy `json:"implicit,omitempty"`
	// todo fix policy marshalling(or came with with new schema)
	// internally we have
	//	Type                 isSignaturePolicy_Type `protobuf_oneof:"Type"`
	// where  isSignaturePolicy_Type - interface and json unmarshalling be like "wtf?!"
	SignaturePolicy *common.SignaturePolicyEnvelope `json:"-"`
}

Policy - can contain different policies: implicit, signature check type and for 'nil' before usage

type PolicyKey

type PolicyKey string
const (
	ReadersPolicyKey PolicyKey = "Readers"
	WritersPolicyKey PolicyKey = "Writers"
	AdminsPolicyKey  PolicyKey = "Admins"

	LifecycleEndporsementPolicyKey PolicyKey = "LifecycleEndporsement"
	EndporsementPolicyKey          PolicyKey = "Endporsement"
)

type Transaction

type Transaction struct {
	Actions         TransactionsActions    `json:"transaction_actions"`
	CreatorIdentity msp.SerializedIdentity `json:"creator_identity"`
}

func ParseTransaction

func ParseTransaction(payload *common.Payload, transactionType common.HeaderType) (*Transaction, error)

func (*Transaction) Events

func (t *Transaction) Events() []*peer.ChaincodeEvent

type TransactionAction

type TransactionAction struct {
	Event                   *peer.ChaincodeEvent          `json:"event"`
	Endorsers               []*msp.SerializedIdentity     `json:"endorsers"`
	ReadWriteSets           []*kvrwset.KVRWSet            `json:"rw_sets"`
	ChaincodeInvocationSpec *peer.ChaincodeInvocationSpec `json:"cc_invocation_spec"`
	CreatorIdentity         msp.SerializedIdentity        `json:"creator_identity"`
}

func ParseTxAction

func ParseTxAction(txAction *peer.TransactionAction) (*TransactionAction, error)

func ParseTxActions

func ParseTxActions(txActions []*peer.TransactionAction) ([]*TransactionAction, error)

type Transactions

type Transactions []*Transaction

type TransactionsActions

type TransactionsActions []*TransactionAction

Jump to

Keyboard shortcuts

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