mpc_wallet_core/sign/
messages.rs

1//! DSG protocol messages
2
3use crate::PartyId;
4use serde::{Deserialize, Serialize};
5
6/// Round 1 DSG message: commitments to nonces
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct DsgRound1Message {
9    /// Sender's party ID
10    pub party_id: PartyId,
11    /// Commitment to k_i (compressed EC point)
12    pub k_commitment: Vec<u8>,
13    /// Commitment to gamma_i (compressed EC point)
14    pub gamma_commitment: Vec<u8>,
15}
16
17/// Round 2 DSG message: MtA protocol shares
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct DsgRound2Message {
20    /// Sender's party ID
21    pub party_id: PartyId,
22    /// Delta share for signature computation
23    pub delta_share: Vec<u8>,
24}
25
26/// Partial signature message
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct DsgPartialMessage {
29    /// Sender's party ID
30    pub party_id: PartyId,
31    /// Partial signature component
32    pub sigma_share: Vec<u8>,
33}
34
35/// Pre-signature data (can be generated before message is known)
36#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct PreSignature {
38    /// Session ID
39    pub session_id: [u8; 32],
40    /// Participating parties
41    pub parties: Vec<PartyId>,
42    /// R point (compressed, 33 bytes stored as Vec for serde compatibility)
43    pub r_point: Vec<u8>,
44    /// This party's k^{-1} share
45    pub k_inv_share: Vec<u8>,
46    /// This party's chi share (k * x)
47    pub chi_share: Vec<u8>,
48}
49
50/// Partial signature from one party
51#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct PartialSignature {
53    /// Party ID that created this partial
54    pub party_id: PartyId,
55    /// Sigma share for combining
56    pub sigma_share: Vec<u8>,
57}