mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-05 21:14:32 -04:00
Emit message0 out of NB (both parties)
This commit is contained in:
parent
ad0d563d93
commit
ad0d8d5713
9 changed files with 77 additions and 43 deletions
|
@ -1,8 +1,9 @@
|
|||
use anyhow::Result;
|
||||
use ecdsa_fun::{adaptor::EncryptedSignature, Signature};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use crate::{bitcoin, monero};
|
||||
use crate::{bitcoin, monero, serde::cross_curve_dleq_proof};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Message {
|
||||
|
@ -11,11 +12,12 @@ pub enum Message {
|
|||
Message2(Message2),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Message0 {
|
||||
pub(crate) A: bitcoin::PublicKey,
|
||||
pub(crate) S_a_monero: monero::PublicKey,
|
||||
pub(crate) S_a_bitcoin: bitcoin::PublicKey,
|
||||
#[serde(with = "cross_curve_dleq_proof")]
|
||||
pub(crate) dleq_proof_s_a: cross_curve_dleq::Proof,
|
||||
pub(crate) v_a: monero::PrivateViewKey,
|
||||
pub(crate) redeem_address: bitcoin::Address,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::{bitcoin, monero};
|
||||
use crate::{bitcoin, monero, serde::cross_curve_dleq_proof};
|
||||
use anyhow::Result;
|
||||
use ecdsa_fun::{adaptor::EncryptedSignature, Signature};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -11,11 +12,12 @@ pub enum Message {
|
|||
Message3(Message3),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Message0 {
|
||||
pub(crate) B: bitcoin::PublicKey,
|
||||
pub(crate) S_b_monero: monero::PublicKey,
|
||||
pub(crate) S_b_bitcoin: bitcoin::PublicKey,
|
||||
#[serde(with = "cross_curve_dleq_proof")]
|
||||
pub(crate) dleq_proof_s_b: cross_curve_dleq::Proof,
|
||||
pub(crate) v_b: monero::PrivateViewKey,
|
||||
pub(crate) refund_address: bitcoin::Address,
|
||||
|
|
|
@ -88,6 +88,44 @@ pub mod cross_curve_dleq_scalar {
|
|||
}
|
||||
}
|
||||
|
||||
pub mod cross_curve_dleq_proof {
|
||||
use serde::{de, de::Visitor, Deserializer, Serializer};
|
||||
use std::fmt;
|
||||
|
||||
struct MyVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for MyVisitor {
|
||||
type Value = cross_curve_dleq::Proof;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(formatter, "todo")
|
||||
}
|
||||
|
||||
fn visit_bytes<E>(self, _s: &[u8]) -> Result<Self::Value, E>
|
||||
where
|
||||
E: de::Error,
|
||||
{
|
||||
todo!("visit_bytes")
|
||||
}
|
||||
}
|
||||
|
||||
pub fn serialize<S>(_x: &cross_curve_dleq::Proof, _s: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
todo!("serialize")
|
||||
}
|
||||
|
||||
pub fn deserialize<'de, D>(
|
||||
_deserializer: D,
|
||||
) -> Result<cross_curve_dleq::Proof, <D as Deserializer<'de>>::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
todo!("deserialize")
|
||||
}
|
||||
}
|
||||
|
||||
pub mod monero_private_key {
|
||||
use serde::{de, de::Visitor, Deserializer, Serializer};
|
||||
use std::fmt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue