protocol

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Dkls18Dkg specifies the DKG protocol of the DKLs18 potocol.
	Dkls18Dkg = "DKLs18-DKG"

	// Dkls18Sign specifies the DKG protocol of the DKLs18 potocol.
	Dkls18Sign = "DKLs18-Sign"

	// Dkls18Refresh specifies the DKG protocol of the DKLs18 potocol.
	Dkls18Refresh = "DKLs18-Refresh"

	// Version0 is version 0!
	Version0 = 100

	// Version1 is version 2!
	Version1 = 200
)

Variables

View Source
var (
	ErrNotInitialized   = fmt.Errorf("object has not been initialized")
	ErrProtocolFinished = fmt.Errorf("the protocol has finished")
)

Functions

func EncodeMessage added in v1.31.0

func EncodeMessage(m *Message) (string, error)

EncodeMessage encodes the message to a string.

Types

type Iterator

type Iterator interface {
	// Next runs the next round of the protocol.
	// Returns `ErrProtocolFinished` when protocol has completed.
	Next(input *Message) (*Message, error)

	// Result returns the final result, if any, of the completed protocol.
	// Returns nil if the protocol has not yet terminated.
	// Returns an error if an error was encountered during protocol execution.
	Result(version uint) (*Message, error)
}

Iterator an interface for the DKLs18 protocols that follows the iterator pattern.

type Message

type Message struct {
	Payloads map[string][]byte //`json:"payloads"`
	Metadata map[string]string //`json:"metadata"`
	Protocol string            //`json:"protocol"`
	Version  uint              //`json:"version"`
}

Message provides serializers and deserializer for the inputs and outputs of each step of the protocol. Moreover, it adds some metadata and versioning around the serialized data.

func DecodeMessage added in v1.31.0

func DecodeMessage(s string) (*Message, error)

DecodeMessage decodes the message from a string.

func (*Message) MarshalJSON added in v1.31.0

func (m *Message) MarshalJSON() ([]byte, error)

MarshalJSON marshals the message to JSON.

func (*Message) UnmarshalJSON added in v1.31.0

func (m *Message) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the message from JSON.

Jump to

Keyboard shortcuts

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