[][src]Struct ripple_keypairs::PrivateKey

pub struct PrivateKey { /* fields omitted */ }

A private key that can be used to sign messages

Examples

use ripple_keypairs::Seed;

let seed = "sp5fghtJtpUorTwvof1NpDXAzNwf5".parse::<Seed>()?;

let (private_key, _) = seed.derive_keypair()?;

let signature = private_key.sign(&"test message");

assert_eq!(signature.to_string(), "30440220583A91C95E54E6A651C47BEC22744E0B101E2C4060E7B08F6341657DAD9BC3EE02207D1489C7395DB0188D3A56A977ECBA54B36FA9371B40319655B1B4429E33EF2D");
assert_eq!(signature.into(), vec![48, 68, 2, 32, 88, 58, 145, 201, 94, 84, 230, 166, 81, 196, 123, 236, 34, 116, 78, 11, 16, 30, 44, 64, 96, 231, 176, 143, 99, 65, 101, 125, 173, 155, 195, 238, 2, 32, 125, 20, 137, 199, 57, 93, 176, 24, 141, 58, 86, 169, 119, 236, 186, 84, 179, 111, 169, 55, 27, 64, 49, 150, 85, 177, 180, 66, 158, 51, 239, 45]);

assert_eq!(private_key.to_string(), "00D78B9735C3F26501C7337B8A5727FD53A6EFDBC6AA55984F098488561F985E23");

Implementations

impl PrivateKey[src]

pub fn sign(&self, message: &impl AsRef<[u8]>) -> impl Signature[src]

Sign message

Returns the Signature which that can be treated as bytes or as a hex encoded string.

Trait Implementations

impl Clone for PrivateKey[src]

impl Debug for PrivateKey[src]

impl Display for PrivateKey[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Display as a hex encoded string

impl Eq for PrivateKey[src]

impl Hash for PrivateKey[src]

impl PartialEq<PrivateKey> for PrivateKey[src]

impl StructuralEq for PrivateKey[src]

impl StructuralPartialEq for PrivateKey[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,