Documentation
¶
Overview ¶
Package internal provides values, structures, and functions to operate FROST that are not part of the public API.
Index ¶
- Variables
- func ComputeLambda(g ecc.Group, id uint16, participants []*ecc.Scalar) *ecc.Scalar
- func Concatenate(input ...[]byte) []byte
- func H1(g ecc.Group, input []byte) *ecc.Scalar
- func H2(g ecc.Group, input []byte) *ecc.Scalar
- func H3(g ecc.Group, input []byte) *ecc.Scalar
- func H4(g ecc.Group, msg []byte) []byte
- func H5(g ecc.Group, msg []byte) []byte
- func RandomBytes(length int) []byte
- func UInt64LE(i uint64) []byte
- type Lambda
- type LambdaRegistry
- func (l LambdaRegistry) Decode(g ecc.Group, data []byte) error
- func (l LambdaRegistry) Delete(participants []uint16)
- func (l LambdaRegistry) Get(participants []uint16) *ecc.Scalar
- func (l LambdaRegistry) GetOrNew(g ecc.Group, id uint16, participants []uint16) *ecc.Scalar
- func (l LambdaRegistry) New(g ecc.Group, id uint16, participants []uint16) *ecc.Scalar
- func (l LambdaRegistry) Set(participants []uint16, value *ecc.Scalar)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidParameters indicates that wrong input has been provided. ErrInvalidParameters = errors.New("invalid parameters") // ErrInvalidCiphersuite indicates a non-supported ciphersuite is being used. ErrInvalidCiphersuite = errors.New("ciphersuite not available") // ErrInvalidLength indicates that a provided encoded data piece is not of the expected length. ErrInvalidLength = errors.New("invalid encoding length") // ErrIdentifierIs0 is returned when the invalid 0 identifier is encountered. ErrIdentifierIs0 = errors.New("identifier is 0") // ErrEncodingInvalidJSONEncoding is returned when invalid JSON is detected. ErrEncodingInvalidJSONEncoding = errors.New("invalid JSON encoding") )
Functions ¶
func ComputeLambda ¶
ComputeLambda derives the interpolating value for id in the polynomial made by the participant identifiers. This function is not public to protect its usage, as the following conditions MUST be met. - id is non-nil and != 0. - every scalar in participants is non-nil and != 0. - there are no duplicates in participants.
func Concatenate ¶
Concatenate returns the concatenation of all bytes composing the input elements.
func RandomBytes ¶
RandomBytes returns length random bytes (wrapper for crypto/rand).
Types ¶
type Lambda ¶
type Lambda struct { // Value is the actual Lambda value. Value *ecc.Scalar `json:"value"` // Group is necessary so the Value scalar can reliably be decoded in the right group. Group ecc.Group `json:"group"` }
A Lambda is the interpolating value for a given id in the polynomial made by the participant identifiers.
func (*Lambda) UnmarshalJSON ¶
UnmarshalJSON decodes data into l, or returns an error.
type LambdaRegistry ¶
LambdaRegistry holds a signers pre-computed Lambda values, indexed by the list of participants they are associated to. A sorted set of participants will yield the same Lambda.
func (LambdaRegistry) Decode ¶
func (l LambdaRegistry) Decode(g ecc.Group, data []byte) error
Decode populates the receiver from the byte encoded serialization in data.
func (LambdaRegistry) Delete ¶
func (l LambdaRegistry) Delete(participants []uint16)
Delete deletes the Lambda for the given set of participants.
func (LambdaRegistry) Get ¶
func (l LambdaRegistry) Get(participants []uint16) *ecc.Scalar
Get returns the recorded Lambda for the list of participants, or nil if it wasn't found.
func (LambdaRegistry) GetOrNew ¶
GetOrNew returns the recorded Lambda for the list of participants, or created, records, and returns a new one if it wasn't found. This function assumes that: - id is non-nil and != 0. - every scalar in participants is non-nil and != 0. - there are no duplicates in participants.