Trait duniter_keys::PrivateKey
[−]
[src]
pub trait PrivateKey: Clone + Display + Debug + PartialEq + Eq + ToBase58 { type Signature: Signature; fn from_base58(base58_string: &str) -> Result<Self, BaseConvertionError>; fn sign(&self, message: &[u8]) -> Self::Signature; }
Store a cryptographic private key.
A PrivateKey
can be converted from/to Base58 format.
When converted back and forth the value should be the same.
A PrivateKey
is used to sign a message. The corresponding PublicKey
will then be used to verify that signature.
Associated Types
Required Methods
fn from_base58(base58_string: &str) -> Result<Self, BaseConvertionError>
Create a PrivateKey from a Base58 string.
The Base58 string should contains only valid Base58 characters
and have a correct length. If it's not the case, a BaseConvertionError
is returned with the corresponding variant.
fn sign(&self, message: &[u8]) -> Self::Signature
Sign a message with this private key.
Implementors
impl PrivateKey for PrivateKey type Signature = Signature;