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§
Sourcefn from_keypair_bytes(key: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_keypair_bytes(key: &[u8]) -> Result<Self, Error>where
Self: Sized,
Create a new key instance from a slice of keypair bytes.
Sourcefn with_keypair_bytes<O>(&self, f: impl FnOnce(Option<&[u8]>) -> O) -> O
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§
Sourcefn to_keypair_bytes_buffer<B: WriteBuffer>(
&self,
out: &mut B,
) -> Result<(), Error>
fn to_keypair_bytes_buffer<B: WriteBuffer>( &self, out: &mut B, ) -> Result<(), Error>
Write the keypair bytes to a buffer.
Sourcefn to_keypair_bytes(&self) -> Result<SecretBytes, Error>
Available on crate feature alloc only.
fn to_keypair_bytes(&self) -> Result<SecretBytes, Error>
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§
impl KeypairBytes for Ed25519KeyPair
Available on crate feature
ed25519 only.impl KeypairBytes for K256KeyPair
Available on crate feature
k256 only.impl KeypairBytes for P256KeyPair
Available on crate features
p256 or p256_hardware only.impl KeypairBytes for P384KeyPair
Available on crate feature
p384 only.impl KeypairBytes for X25519KeyPair
Available on crate feature
ed25519 only.