diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2020-11-30 19:11:36 +0100 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2020-11-30 19:11:36 +0100 |
| commit | a699b6b4fe6f0e2567f7298fd8174e779f1bd43d (patch) | |
| tree | e79f3927acc133cd05e06e22b1c95c776effe991 /src/account/signature.rs | |
| parent | 678d45e7ae09510796d27a80ecd894f6a1ad8279 (diff) | |
hd wallet impl
Diffstat (limited to 'src/account/signature.rs')
| -rw-r--r-- | src/account/signature.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/account/signature.rs b/src/account/signature.rs new file mode 100644 index 0000000..eef37da --- /dev/null +++ b/src/account/signature.rs @@ -0,0 +1,26 @@ +//! Module containing signature data model. + +use std::fmt::{self, Display, Formatter}; + +/// A secp256k1 signature. +#[derive(Clone, Debug, Default, Eq, PartialEq)] +pub struct Signature { + /// Signature V value in Electrum notation. + pub v: u8, + /// Signature R value. + pub r: [u8; 32], + /// Signature S value. + pub s: [u8; 32], +} + +impl Display for Signature { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + write!( + f, + "0x{}{}{:02x}", + hex::encode(&self.r), + hex::encode(&self.s), + self.v + ) + } +} |
