From a0987ee2b885763bb63a6c0b00d76d69b9795615 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 22 Oct 2020 11:19:43 +1100 Subject: [PATCH] Use upstream serder for dleq Proof --- xmr-btc/Cargo.toml | 2 +- xmr-btc/src/alice/message.rs | 3 +-- xmr-btc/src/bob/message.rs | 3 +-- xmr-btc/src/serde.rs | 38 ------------------------------------ 4 files changed, 3 insertions(+), 43 deletions(-) diff --git a/xmr-btc/Cargo.toml b/xmr-btc/Cargo.toml index 62044dcb..c37df001 100644 --- a/xmr-btc/Cargo.toml +++ b/xmr-btc/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" anyhow = "1" async-trait = "0.1" bitcoin = { version = "0.23", features = ["rand", "serde"] } -cross-curve-dleq = { git = "https://github.com/comit-network/cross-curve-dleq", rev = "3fc1726e4511d53a6cbcb91a42f479238eca688b" } +cross-curve-dleq = { git = "https://github.com/comit-network/cross-curve-dleq", rev = "1931c0436f259e1a1f53a4ec8acbbaaf614bd1e4", features = ["serde"] } curve25519-dalek = "2" ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", rev = "510d48ef6a2b19805f7f5c70c598e5b03f668e7a", features = ["libsecp_compat", "serde", "serialization"] } ed25519-dalek = { version = "1.0.0-pre.4", features = ["serde"] }# Cannot be 1 because they depend on curve25519-dalek version 3 diff --git a/xmr-btc/src/alice/message.rs b/xmr-btc/src/alice/message.rs index ada3636f..79b66986 100644 --- a/xmr-btc/src/alice/message.rs +++ b/xmr-btc/src/alice/message.rs @@ -3,7 +3,7 @@ use ecdsa_fun::{adaptor::EncryptedSignature, Signature}; use serde::{Deserialize, Serialize}; use std::convert::TryFrom; -use crate::{bitcoin, monero, serde::cross_curve_dleq_proof}; +use crate::{bitcoin, monero}; #[derive(Debug)] pub enum Message { @@ -17,7 +17,6 @@ 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, diff --git a/xmr-btc/src/bob/message.rs b/xmr-btc/src/bob/message.rs index 465241f6..2826a545 100644 --- a/xmr-btc/src/bob/message.rs +++ b/xmr-btc/src/bob/message.rs @@ -1,4 +1,4 @@ -use crate::{bitcoin, monero, serde::cross_curve_dleq_proof}; +use crate::{bitcoin, monero}; use anyhow::Result; use ecdsa_fun::{adaptor::EncryptedSignature, Signature}; use serde::{Deserialize, Serialize}; @@ -17,7 +17,6 @@ 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, diff --git a/xmr-btc/src/serde.rs b/xmr-btc/src/serde.rs index 5e6e7052..e64cfd10 100644 --- a/xmr-btc/src/serde.rs +++ b/xmr-btc/src/serde.rs @@ -88,44 +88,6 @@ 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(self, _s: &[u8]) -> Result - where - E: de::Error, - { - todo!("visit_bytes") - } - } - - pub fn serialize(_x: &cross_curve_dleq::Proof, _s: S) -> Result - where - S: Serializer, - { - todo!("serialize") - } - - pub fn deserialize<'de, D>( - _deserializer: D, - ) -> Result>::Error> - where - D: Deserializer<'de>, - { - todo!("deserialize") - } -} - pub mod monero_private_key { use serde::{de, de::Visitor, Deserializer, Serializer}; use std::fmt;