dkls

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 {
	Keyshare     []byte   // For keygen/keyrefresh/quorumchange
	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)

Jump to

Keyboard shortcuts

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