diff --git a/src/prd.rs b/src/prd.rs index 959dcf0..ef93b78 100644 --- a/src/prd.rs +++ b/src/prd.rs @@ -158,7 +158,7 @@ impl Prd { // check that the proof is consistent if let Some(proof) = prd.proof { let proof_key = proof.get_key(); - let local_spend_key: XOnlyPublicKey = local_address.get_spend_key().x_only_public_key().0; + let local_spend_key = local_address.get_spend_key(); // If it's our own device key we abort if proof_key == local_spend_key { return Err(anyhow::Error::msg("Proof signed by ourselves, we are parsing our own message")); @@ -166,13 +166,11 @@ impl Prd { // take the spending keys in sender let sender: Member = serde_json::from_str(&prd.sender)?; let addresses = sender.get_addresses(); - let mut spend_keys: Vec = vec![]; + let mut spend_keys: Vec = vec![]; for address in addresses { spend_keys.push( ::try_from(address)? .get_spend_key() - .x_only_public_key() - .0, ); } // The key in proof must be one of the sender keys diff --git a/src/signature.rs b/src/signature.rs index c0db384..22f05e4 100644 --- a/src/signature.rs +++ b/src/signature.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use sp_client::bitcoin::hashes::{sha256t_hash_newtype, Hash, HashEngine}; use sp_client::bitcoin::key::Secp256k1; use sp_client::bitcoin::secp256k1::schnorr::Signature; -use sp_client::bitcoin::secp256k1::{Keypair, Message, SecretKey, XOnlyPublicKey}; +use sp_client::bitcoin::secp256k1::{Keypair, Message, PublicKey, SecretKey}; use crate::pcd::AnkPcdHash; @@ -70,7 +70,7 @@ impl AnkHash { pub struct Proof { signature: Signature, message: AnkHash, - key: XOnlyPublicKey, + key: PublicKey, } impl Proof { @@ -92,11 +92,11 @@ impl Proof { Self { signature: sig, message: message_hash, - key: keypair.x_only_public_key().0, + key: keypair.public_key(), } } - pub fn get_key(&self) -> XOnlyPublicKey { + pub fn get_key(&self) -> PublicKey { self.key } @@ -109,7 +109,7 @@ impl Proof { secp.verify_schnorr( &self.signature, &Message::from_digest(self.message.to_byte_array()), - &self.key, + &self.key.x_only_public_key().0, )?; Ok(())