Skip to content

Commit

Permalink
Add schnorrsig module
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibo-lg committed Nov 9, 2020
1 parent 47b3382 commit 34aad13
Show file tree
Hide file tree
Showing 4 changed files with 665 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ pub const MAX_SIGNATURE_SIZE: usize = 72;
/// The maximum size of a compact signature
pub const COMPACT_SIGNATURE_SIZE: usize = 64;

/// Size of a Schnorr signature
pub const SCHNORRSIG_SIGNATURE_SIZE: usize = 64;

/// Size of a Schnorr public key
pub const SCHNORRSIG_PUBLIC_KEY_SIZE: usize = 32;

/// Size of a key pair
pub const KEY_PAIR_SIZE: usize = 96;

/// The Prime for the secp256k1 field element.
pub const FIELD_SIZE: [u8; 32] = [
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ mod context;
pub mod constants;
pub mod ecdh;
pub mod key;
pub mod schnorrsig;
#[cfg(feature = "recovery")]
pub mod recovery;

Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ macro_rules! serde_impl(

if d.is_human_readable() {
let sl: &str = ::serde::Deserialize::deserialize(d)?;
SecretKey::from_str(sl).map_err(D::Error::custom)
$t::from_str(sl).map_err(D::Error::custom)
} else {
let sl: &[u8] = ::serde::Deserialize::deserialize(d)?;
if sl.len() != $len {
Expand Down
Loading

0 comments on commit 34aad13

Please sign in to comment.