Documentation
¶
Index ¶
- func SetupMessageHash(setupData []byte) ([]byte, error)
- func SetupParticipants(setupData []byte) ([]string, error)
- func SetupThreshold(setupData []byte) (int, error)
- type Message
- type Result
- type Session
- func NewKeygenSession(setupData []byte, sessionID string, partyID string, participants []string, ...) (Session, error)
- func NewKeyrefreshSession(setupData []byte, sessionID string, partyID string, participants []string, ...) (Session, error)
- func NewQuorumChangeSession(setupData []byte, sessionID string, partyID string, participants []string, ...) (Session, error)
- func NewSignSession(setupData []byte, sessionID string, partyID string, participants []string, ...) (Session, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupMessageHash ¶ added in v0.0.48
SetupMessageHash returns the message hash embedded in a sign setup blob. DklsSignSessionFromSetup signs over the setup, not over any hash passed alongside it, so callers must confirm the two agree.
func SetupParticipants ¶ added in v0.0.48
SetupParticipants returns the participant list embedded in a DKLS setup blob, in index order. The setup is what actually drives the session, so callers must confirm it matches the participants they validated. Otherwise a coordinator can present one list for validation and run the session over another.
Party names decode by index and come back empty past the end, which is how the list terminates.
func SetupThreshold ¶ added in v0.0.48
SetupThreshold returns the threshold embedded in a keygen, keyrefresh or quorumchange setup blob. Sign setups carry no threshold and return an error.
Types ¶
type Message ¶
type Message struct {
Receiver string // Party ID of the receiver
Data []byte // Protocol message data
}
Message represents a protocol message that needs to be sent to a participant.
type Result ¶
type Result struct {
Signature []byte // For sign
PublicKey []byte // Public key
Participants []string // All participants
}
Result contains the result of a DKLS protocol operation.
type Session ¶
type Session interface {
// Step processes the next protocol step and returns messages to send.
// Returns (messages, finished, error)
Step() ([]Message, bool, error)
// InputMessage processes an incoming protocol message.
InputMessage(data []byte) error
// GetResult returns the result when finished.
// For keygen/keyrefresh/quorumchange: returns keyshare (signature will be nil)
// For sign: returns signature (keyshare will be nil)
GetResult() (*Result, error)
// Close cleans up the session.
Close()
}
Session manages a DKLS protocol session (keygen, keyrefresh, quorumchange, or sign).
func NewKeygenSession ¶
func NewKeygenSession( setupData []byte, sessionID string, partyID string, participants []string, threshold int, ) (Session, error)
NewKeygenSession creates a new keygen session. setupData: The setup message (required - must be provided by caller) sessionID: Session identifier (typically eventID) partyID: This node's party ID participants: List of participant party IDs (sorted) threshold: The threshold for the keygen (number of parties needed to sign)
func NewKeyrefreshSession ¶
func NewKeyrefreshSession( setupData []byte, sessionID string, partyID string, participants []string, threshold int, oldKeyshare []byte, ) (Session, error)
NewKeyrefreshSession creates a new keyrefresh session. setupData: The setup message (required - must be provided by caller) sessionID: Session identifier (typically eventID) partyID: This node's party ID participants: List of participant party IDs (sorted) threshold: The threshold for the keyrefresh oldKeyshare: The existing keyshare to refresh (keyID is extracted from keyshare)
func NewQuorumChangeSession ¶
func NewQuorumChangeSession( setupData []byte, sessionID string, partyID string, participants []string, threshold int, oldKeyshare []byte, ) (Session, error)
NewQuorumChangeSession creates a new quorumchange session. setupData: The setup message (required - must be provided by caller) sessionID: Session identifier (typically eventID) partyID: This node's party ID participants: List of participant party IDs (sorted) threshold: The threshold for the quorumchange oldKeyshare: The existing keyshare to change quorum for (nil if this is a new party)
func NewSignSession ¶
func NewSignSession( setupData []byte, sessionID string, partyID string, participants []string, keyshare []byte, messageHash []byte, chainPath []byte, ) (Session, error)
NewSignSession creates a new sign session. setupData: The setup message (must be provided - keyID is extracted from keyshare by caller) sessionID: Session identifier (typically eventID) partyID: This node's party ID participants: List of participant party IDs (sorted) keyshare: The keyshare to use for signing (keyID is extracted from keyshare) messageHash: The message hash to sign chainPath: Optional chain path (nil if empty)