encoding

package
v0.22.8-patch-7 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: AGPL-3.0 Imports: 1 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// RandomBeaconTag is used for threshold signatures in the random beacon
	RandomBeaconTag = tag("Random-Beacon")
	// ConsensusVoteTag is used for Consensus Hotstuff votes
	ConsensusVoteTag = tag("Consensus-Vote")
	// CollectorVoteTag is used for Collection Hotstuff votes
	CollectorVoteTag = tag("Collector-Vote")
	// ExecutionReceiptTag is used for execution receipts
	ExecutionReceiptTag = tag("Execution-Receipt")
	// ResultApprovalTag is used for result approvals
	ResultApprovalTag = tag("Result-Approval")
	// SPOCKTag is used to generate SPoCK proofs
	SPOCKTag = tag("SPoCK")
	// DKGMessageTag is used for DKG messages
	DKGMessageTag = tag("DKG-Message")
)

Functions

This section is empty.

Types

type Encodable

type Encodable interface {
	Encode() []byte
}

Encodable is a type that defines a canonical encoding.

type Encoder

type Encoder interface {
	// Encode encodes a value as bytes.
	//
	// This function returns an error if the value type is not supported by this encoder.
	Encode(interface{}) ([]byte, error)

	// Decode decodes bytes into a value.
	//
	// This functions returns an error if the bytes do not fit the provided value type.
	Decode([]byte, interface{}) error

	// MustEncode encodes a value as bytes.
	//
	// This functions panic if encoding fails.
	MustEncode(interface{}) []byte

	// MustDecode decodes bytes into a value.
	//
	// This functions panic if decoding fails.
	MustDecode([]byte, interface{})
}

Encoder encodes and decodes values to and from bytes.

var DefaultEncoder Encoder = json.NewEncoder()

DefaultEncoder is the default encoder used by Flow.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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