KeypairBytes

Trait KeypairBytes 

Source
pub trait KeypairBytes {
    // Required methods
    fn from_keypair_bytes(key: &[u8]) -> Result<Self, Error>
       where Self: Sized;
    fn with_keypair_bytes<O>(&self, f: impl FnOnce(Option<&[u8]>) -> O) -> O;

    // Provided methods
    fn to_keypair_bytes_buffer<B: WriteBuffer>(
        &self,
        out: &mut B,
    ) -> Result<(), Error> { ... }
    fn to_keypair_bytes(&self) -> Result<SecretBytes, Error> { ... }
}
Expand description

Convert between keypair instance and keypair (secret and public) bytes

Required Methods§

Source

fn from_keypair_bytes(key: &[u8]) -> Result<Self, Error>
where Self: Sized,

Create a new key instance from a slice of keypair bytes.

Source

fn with_keypair_bytes<O>(&self, f: impl FnOnce(Option<&[u8]>) -> O) -> O

Create a new key instance from a slice of keypair bytes.

Provided Methods§

Source

fn to_keypair_bytes_buffer<B: WriteBuffer>( &self, out: &mut B, ) -> Result<(), Error>

Write the keypair bytes to a buffer.

Source

fn to_keypair_bytes(&self) -> Result<SecretBytes, Error>

Available on crate feature alloc only.

Write the keypair bytes to a new allocated buffer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl KeypairBytes for Ed25519KeyPair

Available on crate feature ed25519 only.
Source§

impl KeypairBytes for K256KeyPair

Available on crate feature k256 only.
Source§

impl KeypairBytes for P256KeyPair

Available on crate features p256 or p256_hardware only.
Source§

impl KeypairBytes for P384KeyPair

Available on crate feature p384 only.
Source§

impl KeypairBytes for X25519KeyPair

Available on crate feature ed25519 only.