party

package
v0.6.0-alpha-20...-5109cf1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID string

ID represents a unique identifier for a participant in our scheme.

You should think of this as a 32 byte slice. We represent it as a string to have a comparable type, but using more than 32 bytes will lead to inconsistencies because of how we use this ID numerically later.

This ID is used as an interpolation point of a polynomial sharing of the secret key.

func (ID) Domain

func (ID) Domain() string

Domain implements hash.WriterToWithDomain, and separates this type within hash.Hash.

func (ID) Scalar

func (id ID) Scalar(group curve.Curve) curve.Scalar

Scalar converts this ID into a scalar.

All of the IDs of our participants form a polynomial sharing of the secret scalar value used for ECDSA.

func (ID) WriteTo

func (id ID) WriteTo(w io.Writer) (int64, error)

WriteTo makes ID implement the io.WriterTo interface.

This writes out the content of this ID, in a domain separated way.

type IDSlice

type IDSlice []ID

func NewIDSlice

func NewIDSlice(partyIDs []ID) IDSlice

NewIDSlice returns a sorted slice from partyIDs.

func (IDSlice) Contains

func (partyIDs IDSlice) Contains(ids ...ID) bool

Contains returns true if partyIDs contains id. Assumes that the IDSlice is valid.

func (IDSlice) Copy

func (partyIDs IDSlice) Copy() IDSlice

Copy returns an identical copy of the received.

func (IDSlice) Domain

func (IDSlice) Domain() string

Domain implements hash.WriterToWithDomain, and separates this type within hash.Hash.

func (IDSlice) Len

func (partyIDs IDSlice) Len() int

Len Less and Swap implement sort.Interface.

func (IDSlice) Less

func (partyIDs IDSlice) Less(i, j int) bool

func (IDSlice) Remove

func (partyIDs IDSlice) Remove(id ID) IDSlice

Remove finds id in partyIDs and returns a copy of the slice if it was found.

func (IDSlice) String

func (partyIDs IDSlice) String() string

String implements fmt.Stringer.

func (IDSlice) Swap

func (partyIDs IDSlice) Swap(i, j int)

func (IDSlice) Valid

func (partyIDs IDSlice) Valid() bool

Valid returns true if the IDSlice is sorted and does not contain any duplicates.

func (IDSlice) WriteTo

func (partyIDs IDSlice) WriteTo(w io.Writer) (int64, error)

WriteTo implements io.WriterTo and should be used within the hash.Hash function. It writes the full uncompressed point to w, ie 64 bytes.

type PointMap

type PointMap struct {
	Points map[ID]curve.Point
	// contains filtered or unexported fields
}

PointMap is a map from party ID's to points, to be easy to marshal.

When unmarshalling, EmptyPointMap must be called first, to provide a group to use to unmarshal the points.

func EmptyPointMap

func EmptyPointMap(group curve.Curve) *PointMap

EmptyPointMap creates an empty PointMap with a fixed group, ready to be unmarshalled.

This needs to be used before unmarshalling, so that we have a group to unmarshal the points inside of the map.

func NewPointMap

func NewPointMap(points map[ID]curve.Point) *PointMap

NewPointMap creates a PointMap from a map of points.

func (*PointMap) MarshalBinary

func (m *PointMap) MarshalBinary() ([]byte, error)

func (*PointMap) UnmarshalBinary

func (m *PointMap) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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