Documentation
¶
Index ¶
- Constants
- func ComposeAuthorizerRaw(msg InitiatorMessage) ([]byte, error)
- func MarshalMpcMsg(msg *MpcMsg) ([]byte, error)
- func MarshalStartMessage(params []byte) ([]byte, error)
- type AuthorizerSignature
- type ECDHMessage
- type EventInitiatorKeyType
- type GenerateKeyMessage
- type InitiatorMessage
- type KeyType
- type MpcMsg
- type ResharingMessage
- type SignTxMessage
- type StartMessage
Constants ¶
const ( ProtoDklsGroupDKG = "dkls-group-dkg" // FROST-style group DKG on secp256k1 ProtoDklsPairSetup = "dkls-pair-setup" // DKLS19 pairwise OT setup ProtoDklsSign = "dkls-sign" // DKLS19 pairwise signing ProtoDklsRefresh = "dkls-refresh" // DKLS19 key refresh (resharing) ProtoFrostDKG = "frost-dkg" // FROST DKG (EdDSA / Ed25519) ProtoFrostSign = "frost-sign" // FROST signing (EdDSA) )
Variables ¶
This section is empty.
Functions ¶
func ComposeAuthorizerRaw ¶
func ComposeAuthorizerRaw(msg InitiatorMessage) ([]byte, error)
ComposeAuthorizerRaw composes the raw data to be signed by an authorizer
func MarshalMpcMsg ¶
MarshalMpcMsg serialises msg to JSON.
func MarshalStartMessage ¶
Types ¶
type AuthorizerSignature ¶
type AuthorizerSignature struct {
AuthorizerID string `json:"authorizer_id"`
Signature []byte `json:"signature"`
}
AuthorizerSignature represents a single authorizer signature attached to an initiator message.
type ECDHMessage ¶
type ECDHMessage struct {
From string `json:"from"`
PublicKey []byte `json:"public_key"`
Timestamp time.Time `json:"timestamp"`
Signature []byte `json:"signature"`
}
func (*ECDHMessage) MarshalForSigning ¶
func (msg *ECDHMessage) MarshalForSigning() ([]byte, error)
MarshalForSigning returns the deterministic JSON bytes for signing
type EventInitiatorKeyType ¶
type EventInitiatorKeyType string
const ( EventInitiatorKeyTypeEd25519 EventInitiatorKeyType = "ed25519" EventInitiatorKeyTypeP256 EventInitiatorKeyType = "p256" )
type GenerateKeyMessage ¶
type GenerateKeyMessage struct {
WalletID string `json:"wallet_id"`
Nonce string `json:"nonce"`
Timestamp time.Time `json:"timestamp"`
Signature []byte `json:"signature"`
AuthorizerSignatures []AuthorizerSignature `json:"authorizer_signatures,omitempty"`
}
func (*GenerateKeyMessage) GetAuthorizerSignatures ¶
func (m *GenerateKeyMessage) GetAuthorizerSignatures() []AuthorizerSignature
func (*GenerateKeyMessage) InitiatorID ¶
func (m *GenerateKeyMessage) InitiatorID() string
func (*GenerateKeyMessage) Raw ¶
func (m *GenerateKeyMessage) Raw() ([]byte, error)
func (*GenerateKeyMessage) Sig ¶
func (m *GenerateKeyMessage) Sig() []byte
type InitiatorMessage ¶
type InitiatorMessage interface {
// Raw returns the canonical byte‐slice that was signed.
Raw() ([]byte, error)
// Sig returns the signature over Raw().
Sig() []byte
// InitiatorID returns the ID whose public key we have to look up.
InitiatorID() string
GetAuthorizerSignatures() []AuthorizerSignature
}
InitiatorMessage is anything that carries a payload to verify and its signature.
type MpcMsg ¶
type MpcMsg struct {
// WalletID identifies the keygen/sign session.
WalletID string `json:"walletID"`
// Protocol identifies which sub-protocol produced this message.
// Valid values: "dkls-group-dkg", "dkls-pair-setup", "dkls-sign",
// "frost-dkg", "frost-sign", "dkls-refresh", "frost-reshare".
Protocol string `json:"protocol"`
// Round is a human-readable round label for logging (e.g. "dkg-round-1").
Round string `json:"round,omitempty"`
// PairAlice and PairBob identify the Alice/Bob pair for DKLS19 messages.
// For FROST messages these fields are empty.
PairAlice string `json:"pairAlice,omitempty"`
PairBob string `json:"pairBob,omitempty"`
// FromNodeID is the sender's node ID.
FromNodeID string `json:"from"`
// ToNodeID is the intended recipient's node ID.
// Empty for broadcast messages (FROST DKG Round1Bcast, etc.).
ToNodeID string `json:"to,omitempty"`
// Payload carries the gob-encoded protocol.Message produced by the kryptology
// iterator (AliceDkg.Next / BobDkg.Next / etc.).
Payload []byte `json:"payload"`
// Signature is the Ed25519 signature over MarshalForSigning().
// Set only on broadcast messages (point-to-point messages are AEAD-encrypted
// and authenticated by the encryption layer instead).
Signature []byte `json:"sig,omitempty"`
}
MpcMsg is the outer envelope used for all MPC protocol messages transported over NATS (both broadcast and point-to-point). It replaces the old TssMessage that carried tss.PartyID values; node identity is now represented as plain strings, matching the node IDs used in Consul and the peer registry.
func UnmarshalMpcMsg ¶
UnmarshalMpcMsg deserialises JSON bytes into an MpcMsg.
func (*MpcMsg) MarshalForSigning ¶
MarshalForSigning returns the canonical JSON bytes that are signed/verified for broadcast MpcMsg messages. The Signature field is excluded.
type ResharingMessage ¶
type ResharingMessage struct {
SessionID string `json:"session_id"`
NodeIDs []string `json:"node_ids"` // new peer IDs
NewThreshold int `json:"new_threshold"`
KeyType KeyType `json:"key_type"`
WalletID string `json:"wallet_id"`
Signature []byte `json:"signature,omitempty"`
AuthorizerSignatures []AuthorizerSignature `json:"authorizer_signatures,omitempty"`
}
func (*ResharingMessage) GetAuthorizerSignatures ¶
func (m *ResharingMessage) GetAuthorizerSignatures() []AuthorizerSignature
func (*ResharingMessage) InitiatorID ¶
func (m *ResharingMessage) InitiatorID() string
func (*ResharingMessage) Raw ¶
func (m *ResharingMessage) Raw() ([]byte, error)
func (*ResharingMessage) Sig ¶
func (m *ResharingMessage) Sig() []byte
type SignTxMessage ¶
type SignTxMessage struct {
KeyType KeyType `json:"key_type"`
WalletID string `json:"wallet_id"`
NetworkInternalCode string `json:"network_internal_code"`
TxID string `json:"tx_id"`
Tx []byte `json:"tx"`
Signature []byte `json:"signature"`
DerivationPath []uint32 `json:"derivation_path"`
AuthorizerSignatures []AuthorizerSignature `json:"authorizer_signatures,omitempty"`
}
func (*SignTxMessage) GetAuthorizerSignatures ¶
func (m *SignTxMessage) GetAuthorizerSignatures() []AuthorizerSignature
func (*SignTxMessage) InitiatorID ¶
func (m *SignTxMessage) InitiatorID() string
func (*SignTxMessage) Raw ¶
func (m *SignTxMessage) Raw() ([]byte, error)
func (*SignTxMessage) Sig ¶
func (m *SignTxMessage) Sig() []byte
type StartMessage ¶
type StartMessage struct {
Params []byte `json:"params"`
}
StartMessage wraps arbitrary params for session initiation (kept for compatibility).
func UnmarshalStartMessage ¶
func UnmarshalStartMessage(msgBytes []byte) (*StartMessage, error)