Documentation ¶
Index ¶
- Variables
- func EC() elliptic.Curve
- func SetCurve(curve elliptic.Curve)
- type BaseParty
- type Error
- type Message
- type MessageContent
- type MessageImpl
- func (mm *MessageImpl) Content() MessageContent
- func (mm *MessageImpl) GetFrom() *PartyID
- func (mm *MessageImpl) GetTo() []*PartyID
- func (mm *MessageImpl) IsBroadcast() bool
- func (mm *MessageImpl) IsToOldAndNewCommittees() bool
- func (mm *MessageImpl) IsToOldCommittee() bool
- func (mm *MessageImpl) String() string
- func (mm *MessageImpl) Type() string
- func (mm *MessageImpl) ValidateBasic() bool
- func (mm *MessageImpl) WireBytes() ([]byte, *MessageRouting, error)
- func (mm *MessageImpl) WireMsg() *MessageWrapper
- type MessageRouting
- type MessageWrapper
- func (*MessageWrapper) Descriptor() ([]byte, []int)deprecated
- func (x *MessageWrapper) GetFrom() *MessageWrapper_PartyID
- func (x *MessageWrapper) GetIsBroadcast() bool
- func (x *MessageWrapper) GetIsToOldAndNewCommittees() bool
- func (x *MessageWrapper) GetIsToOldCommittee() bool
- func (x *MessageWrapper) GetMessage() *any.Any
- func (x *MessageWrapper) GetTo() []*MessageWrapper_PartyID
- func (*MessageWrapper) ProtoMessage()
- func (x *MessageWrapper) ProtoReflect() protoreflect.Message
- func (x *MessageWrapper) Reset()
- func (x *MessageWrapper) String() string
- type MessageWrapper_PartyID
- func (*MessageWrapper_PartyID) Descriptor() ([]byte, []int)deprecated
- func (x *MessageWrapper_PartyID) GetId() string
- func (x *MessageWrapper_PartyID) GetKey() []byte
- func (x *MessageWrapper_PartyID) GetMoniker() string
- func (mpid *MessageWrapper_PartyID) KeyInt() *big.Int
- func (*MessageWrapper_PartyID) ProtoMessage()
- func (x *MessageWrapper_PartyID) ProtoReflect() protoreflect.Message
- func (x *MessageWrapper_PartyID) Reset()
- func (x *MessageWrapper_PartyID) String() string
- type Parameters
- func (params *Parameters) Parties() *PeerContext
- func (params *Parameters) PartyCount() int
- func (params *Parameters) PartyID() *PartyID
- func (params *Parameters) SafePrimeGenTimeout() time.Duration
- func (params *Parameters) Threshold() int
- func (params *Parameters) UNSAFE_KGIgnoreH1H2Dupes() bool
- func (params *Parameters) UNSAFE_setKGIgnoreH1H2Dupes(unsafeKGIgnoreH1H2Dupes bool)
- type ParsedMessage
- type Party
- type PartyID
- type PeerContext
- type ReSharingParameters
- func (rgParams *ReSharingParameters) IsNewCommittee() bool
- func (rgParams *ReSharingParameters) IsOldCommittee() bool
- func (rgParams *ReSharingParameters) NewParties() *PeerContext
- func (rgParams *ReSharingParameters) NewPartyCount() int
- func (rgParams *ReSharingParameters) NewThreshold() int
- func (rgParams *ReSharingParameters) OldAndNewParties() []*PartyID
- func (rgParams *ReSharingParameters) OldAndNewPartyCount() int
- func (rgParams *ReSharingParameters) OldParties() *PeerContext
- func (rgParams *ReSharingParameters) OldPartyCount() int
- type Round
- type SortedPartyIDs
- func (spids SortedPartyIDs) Exclude(exclude *PartyID) SortedPartyIDs
- func (spids SortedPartyIDs) FindByKey(key *big.Int) *PartyID
- func (spids SortedPartyIDs) Keys() []*big.Int
- func (spids SortedPartyIDs) Len() int
- func (spids SortedPartyIDs) Less(a, b int) bool
- func (spids SortedPartyIDs) Swap(a, b int)
- func (spids SortedPartyIDs) ToUnSorted() UnSortedPartyIDs
- type UnSortedPartyIDs
Constants ¶
This section is empty.
Variables ¶
var File_protob_message_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type BaseParty ¶
type BaseParty struct { FirstRound Round // contains filtered or unexported fields }
func (*BaseParty) ValidateMessage ¶
func (p *BaseParty) ValidateMessage(msg ParsedMessage) (bool, *Error)
an implementation of ValidateMessage that is shared across the different types of parties (keygen, signing, dynamic groups)
func (*BaseParty) WaitingFor ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Represents an error that occurred during execution of the TSS protocol rounds.
func BaseUpdate ¶
func BaseUpdate(p Party, msg ParsedMessage, task string) (ok bool, err *Error)
an implementation of Update that is shared across the different types of parties (keygen, signing, dynamic groups)
func (*Error) SelfCaused ¶
type Message ¶
type Message interface { // Type is encoded in the protobuf Any structure Type() string // The set of parties that this message should be sent to GetTo() []*PartyID // The party that this message is from GetFrom() *PartyID // Indicates whether the message should be broadcast to other participants IsBroadcast() bool // Indicates whether the message is to the old committee during re-sharing; used mainly in tests IsToOldCommittee() bool // Indicates whether the message is to both committees during re-sharing; used mainly in tests IsToOldAndNewCommittees() bool // Returns the encoded inner message bytes to send over the wire along with metadata about how the message should be delivered WireBytes() ([]byte, *MessageRouting, error) // Returns the protobuf message wrapper struct // Only its inner content should be sent over the wire, not this struct itself WireMsg() *MessageWrapper String() string }
Message describes the interface of the TSS Message for all protocols
type MessageContent ¶
MessageContent represents a ProtoBuf message with validation logic
type MessageImpl ¶
type MessageImpl struct { MessageRouting // contains filtered or unexported fields }
Implements ParsedMessage; this is a concrete implementation of what messages produced by a LocalParty look like
func (*MessageImpl) Content ¶
func (mm *MessageImpl) Content() MessageContent
func (*MessageImpl) GetFrom ¶
func (mm *MessageImpl) GetFrom() *PartyID
func (*MessageImpl) GetTo ¶
func (mm *MessageImpl) GetTo() []*PartyID
func (*MessageImpl) IsBroadcast ¶
func (mm *MessageImpl) IsBroadcast() bool
func (*MessageImpl) IsToOldAndNewCommittees ¶
func (mm *MessageImpl) IsToOldAndNewCommittees() bool
only `true` in DGRound4Message (resharing)
func (*MessageImpl) IsToOldCommittee ¶
func (mm *MessageImpl) IsToOldCommittee() bool
only `true` in DGRound2Message (resharing)
func (*MessageImpl) String ¶
func (mm *MessageImpl) String() string
func (*MessageImpl) Type ¶
func (mm *MessageImpl) Type() string
func (*MessageImpl) ValidateBasic ¶
func (mm *MessageImpl) ValidateBasic() bool
func (*MessageImpl) WireBytes ¶
func (mm *MessageImpl) WireBytes() ([]byte, *MessageRouting, error)
func (*MessageImpl) WireMsg ¶
func (mm *MessageImpl) WireMsg() *MessageWrapper
type MessageRouting ¶
type MessageRouting struct { // which participant this message came from From *PartyID // when `nil` the message should be broadcast to all parties To []*PartyID // whether the message should be broadcast to other participants IsBroadcast bool // whether the message should be sent to old committee participants rather than the new committee IsToOldCommittee bool // whether the message should be sent to both old and new committee participants IsToOldAndNewCommittees bool }
MessageRouting holds the full routing information for the message, consumed by the transport
type MessageWrapper ¶
type MessageWrapper struct { // Metadata optionally un-marshalled and used by the transport to route this message. IsBroadcast bool `protobuf:"varint,1,opt,name=is_broadcast,json=isBroadcast,proto3" json:"is_broadcast,omitempty"` // Metadata optionally un-marshalled and used by the transport to route this message. IsToOldCommittee bool `protobuf:"varint,2,opt,name=is_to_old_committee,json=isToOldCommittee,proto3" json:"is_to_old_committee,omitempty"` // used only in certain resharing messages // Metadata optionally un-marshalled and used by the transport to route this message. IsToOldAndNewCommittees bool `` // used only in certain resharing messages /* 139-byte string literal not displayed */ // Metadata optionally un-marshalled and used by the transport to route this message. From *MessageWrapper_PartyID `protobuf:"bytes,3,opt,name=from,proto3" json:"from,omitempty"` // Metadata optionally un-marshalled and used by the transport to route this message. To []*MessageWrapper_PartyID `protobuf:"bytes,4,rep,name=to,proto3" json:"to,omitempty"` // This field is actually what is sent through the wire and consumed on the other end by UpdateFromBytes. // An Any contains an arbitrary serialized message as bytes, along with a URL that // acts as a globally unique identifier for and resolves to that message's type. Message *any.Any `protobuf:"bytes,10,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
Wrapper for TSS messages, often read by the transport layer and not itself sent over the wire
func NewMessageWrapper ¶
func NewMessageWrapper(routing MessageRouting, content MessageContent) *MessageWrapper
NewMessageWrapper constructs a MessageWrapper from routing metadata and content
func (*MessageWrapper) Descriptor
deprecated
func (*MessageWrapper) Descriptor() ([]byte, []int)
Deprecated: Use MessageWrapper.ProtoReflect.Descriptor instead.
func (*MessageWrapper) GetFrom ¶
func (x *MessageWrapper) GetFrom() *MessageWrapper_PartyID
func (*MessageWrapper) GetIsBroadcast ¶
func (x *MessageWrapper) GetIsBroadcast() bool
func (*MessageWrapper) GetIsToOldAndNewCommittees ¶
func (x *MessageWrapper) GetIsToOldAndNewCommittees() bool
func (*MessageWrapper) GetIsToOldCommittee ¶
func (x *MessageWrapper) GetIsToOldCommittee() bool
func (*MessageWrapper) GetMessage ¶
func (x *MessageWrapper) GetMessage() *any.Any
func (*MessageWrapper) GetTo ¶
func (x *MessageWrapper) GetTo() []*MessageWrapper_PartyID
func (*MessageWrapper) ProtoMessage ¶
func (*MessageWrapper) ProtoMessage()
func (*MessageWrapper) ProtoReflect ¶
func (x *MessageWrapper) ProtoReflect() protoreflect.Message
func (*MessageWrapper) Reset ¶
func (x *MessageWrapper) Reset()
func (*MessageWrapper) String ¶
func (x *MessageWrapper) String() string
type MessageWrapper_PartyID ¶
type MessageWrapper_PartyID struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
PartyID represents a participant in the TSS protocol rounds. Note: The `id` and `moniker` are provided for convenience to allow you to track participants easier. The `id` is intended to be a unique string representation of `key` and `moniker` can be anything (even left blank).
func (*MessageWrapper_PartyID) Descriptor
deprecated
func (*MessageWrapper_PartyID) Descriptor() ([]byte, []int)
Deprecated: Use MessageWrapper_PartyID.ProtoReflect.Descriptor instead.
func (*MessageWrapper_PartyID) GetId ¶
func (x *MessageWrapper_PartyID) GetId() string
func (*MessageWrapper_PartyID) GetKey ¶
func (x *MessageWrapper_PartyID) GetKey() []byte
func (*MessageWrapper_PartyID) GetMoniker ¶
func (x *MessageWrapper_PartyID) GetMoniker() string
func (*MessageWrapper_PartyID) KeyInt ¶
func (mpid *MessageWrapper_PartyID) KeyInt() *big.Int
func (*MessageWrapper_PartyID) ProtoMessage ¶
func (*MessageWrapper_PartyID) ProtoMessage()
func (*MessageWrapper_PartyID) ProtoReflect ¶
func (x *MessageWrapper_PartyID) ProtoReflect() protoreflect.Message
func (*MessageWrapper_PartyID) Reset ¶
func (x *MessageWrapper_PartyID) Reset()
func (*MessageWrapper_PartyID) String ¶
func (x *MessageWrapper_PartyID) String() string
type Parameters ¶
type Parameters struct {
// contains filtered or unexported fields
}
func NewParameters ¶
func NewParameters(ctx *PeerContext, partyID *PartyID, partyCount, threshold int, optionalSafePrimeGenTimeout ...time.Duration) *Parameters
Exported, used in `tss` client
func (*Parameters) Parties ¶
func (params *Parameters) Parties() *PeerContext
func (*Parameters) PartyCount ¶
func (params *Parameters) PartyCount() int
func (*Parameters) PartyID ¶
func (params *Parameters) PartyID() *PartyID
func (*Parameters) SafePrimeGenTimeout ¶
func (params *Parameters) SafePrimeGenTimeout() time.Duration
func (*Parameters) Threshold ¶
func (params *Parameters) Threshold() int
func (*Parameters) UNSAFE_KGIgnoreH1H2Dupes ¶
func (params *Parameters) UNSAFE_KGIgnoreH1H2Dupes() bool
Getter. The H1, H2 dupe check is disabled during some benchmarking scenarios to allow reuse of pre-params.
func (*Parameters) UNSAFE_setKGIgnoreH1H2Dupes ¶
func (params *Parameters) UNSAFE_setKGIgnoreH1H2Dupes(unsafeKGIgnoreH1H2Dupes bool)
Setter. The H1, H2 dupe check is disabled during some benchmarking scenarios to allow reuse of pre-params.
type ParsedMessage ¶
type ParsedMessage interface { Message Content() MessageContent ValidateBasic() bool }
ParsedMessage represents a message with inner ProtoBuf message content
func NewMessage ¶
func NewMessage(meta MessageRouting, content MessageContent, wire *MessageWrapper) ParsedMessage
func ParseWireMessage ¶
func ParseWireMessage(wireBytes []byte, from *PartyID, isBroadcast bool) (ParsedMessage, error)
Used externally to update a LocalParty with a valid ParsedMessage
type Party ¶
type Party interface { Start() *Error // The main entry point when updating a party's state from the wire. // isBroadcast should represent whether the message was received via a reliable broadcast UpdateFromBytes(wireBytes []byte, from *PartyID, isBroadcast bool) (ok bool, err *Error) // You may use this entry point to update a party's state when running locally or in tests Update(msg ParsedMessage) (ok bool, err *Error) Running() bool WaitingFor() []*PartyID ValidateMessage(msg ParsedMessage) (bool, *Error) StoreMessage(msg ParsedMessage) (bool, *Error) FirstRound() Round WrapError(err error, culprits ...*PartyID) *Error PartyID() *PartyID String() string // contains filtered or unexported methods }
type PartyID ¶
type PartyID struct { *MessageWrapper_PartyID Index int `json:"index"` }
PartyID represents a participant in the TSS protocol rounds. Note: The `id` and `moniker` are provided for convenience to allow you to track participants easier. The `id` is intended to be a unique string representation of `key` and `moniker` can be anything (even left blank).
func NewPartyID ¶
NewPartyID constructs a new PartyID Exported, used in `tss` client. `key` should remain consistent between runs for each party.
func (*PartyID) ValidateBasic ¶
type PeerContext ¶
type PeerContext struct {
// contains filtered or unexported fields
}
func NewPeerContext ¶
func NewPeerContext(parties SortedPartyIDs) *PeerContext
func (*PeerContext) IDs ¶
func (p2pCtx *PeerContext) IDs() SortedPartyIDs
func (*PeerContext) SetIDs ¶
func (p2pCtx *PeerContext) SetIDs(ids SortedPartyIDs)
type ReSharingParameters ¶
type ReSharingParameters struct { *Parameters // contains filtered or unexported fields }
func NewReSharingParameters ¶
func NewReSharingParameters(ctx, newCtx *PeerContext, partyID *PartyID, partyCount, threshold, newPartyCount, newThreshold int) *ReSharingParameters
Exported, used in `tss` client
func (*ReSharingParameters) IsNewCommittee ¶
func (rgParams *ReSharingParameters) IsNewCommittee() bool
func (*ReSharingParameters) IsOldCommittee ¶
func (rgParams *ReSharingParameters) IsOldCommittee() bool
func (*ReSharingParameters) NewParties ¶
func (rgParams *ReSharingParameters) NewParties() *PeerContext
func (*ReSharingParameters) NewPartyCount ¶
func (rgParams *ReSharingParameters) NewPartyCount() int
func (*ReSharingParameters) NewThreshold ¶
func (rgParams *ReSharingParameters) NewThreshold() int
func (*ReSharingParameters) OldAndNewParties ¶
func (rgParams *ReSharingParameters) OldAndNewParties() []*PartyID
func (*ReSharingParameters) OldAndNewPartyCount ¶
func (rgParams *ReSharingParameters) OldAndNewPartyCount() int
func (*ReSharingParameters) OldParties ¶
func (rgParams *ReSharingParameters) OldParties() *PeerContext
func (*ReSharingParameters) OldPartyCount ¶
func (rgParams *ReSharingParameters) OldPartyCount() int
type SortedPartyIDs ¶
type SortedPartyIDs []*PartyID
func GenerateTestPartyIDs ¶
func GenerateTestPartyIDs(count int, startAt ...int) SortedPartyIDs
GenerateTestPartyIDs generates a list of mock PartyIDs for tests
func SortPartyIDs ¶
func SortPartyIDs(ids UnSortedPartyIDs, startAt ...int) SortedPartyIDs
SortPartyIDs sorts a list of []*PartyID by their keys in ascending order Exported, used in `tss` client
func (SortedPartyIDs) Exclude ¶
func (spids SortedPartyIDs) Exclude(exclude *PartyID) SortedPartyIDs
func (SortedPartyIDs) Keys ¶
func (spids SortedPartyIDs) Keys() []*big.Int
func (SortedPartyIDs) Len ¶
func (spids SortedPartyIDs) Len() int
func (SortedPartyIDs) Less ¶
func (spids SortedPartyIDs) Less(a, b int) bool
func (SortedPartyIDs) Swap ¶
func (spids SortedPartyIDs) Swap(a, b int)
func (SortedPartyIDs) ToUnSorted ¶
func (spids SortedPartyIDs) ToUnSorted() UnSortedPartyIDs
type UnSortedPartyIDs ¶
type UnSortedPartyIDs []*PartyID