Change Proof message to byte array

This commit is contained in:
Sosthene 2024-11-25 22:26:09 +01:00
parent d10382f121
commit 49c125f085

View File

@ -69,7 +69,7 @@ impl AnkHash {
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub struct Proof { pub struct Proof {
signature: Signature, signature: Signature,
message: AnkHash, message: [u8; 32],
key: PublicKey, key: PublicKey,
} }
@ -91,7 +91,7 @@ impl Proof {
Self { Self {
signature: sig, signature: sig,
message: message_hash, message: message_hash.to_byte_array(),
key: keypair.public_key(), key: keypair.public_key(),
} }
} }
@ -101,14 +101,14 @@ impl Proof {
} }
pub fn get_message(&self) -> [u8; 32] { pub fn get_message(&self) -> [u8; 32] {
self.message.to_byte_array() self.message
} }
pub fn verify(&self) -> Result<()> { pub fn verify(&self) -> Result<()> {
let secp = Secp256k1::verification_only(); let secp = Secp256k1::verification_only();
secp.verify_schnorr( secp.verify_schnorr(
&self.signature, &self.signature,
&Message::from_digest(self.message.to_byte_array()), &Message::from_digest(self.message),
&self.key.x_only_public_key().0, &self.key.x_only_public_key().0,
)?; )?;