pub trait Keypair:
Sized
+ ConstantTimeEq
+ ZeroizeOnDrop {
type SecretLen: ArrayLength<u8>;
type Public: BytesRepresentable + Clone + PartialEq;
// Required methods
fn random() -> Self;
fn from_secret(bytes: &[u8]) -> Result<Self, CryptoError>;
fn secret(&self) -> &SecretValue<Self::SecretLen>;
fn public(&self) -> &Self::Public;
// Provided method
fn unzip(self) -> (SecretValue<Self::SecretLen>, Self::Public) { ... }
}
Expand description
Represents a generic key pair The keypair contains a private key and public key. Must be comparable in constant time and zeroized on drop.
Required Associated Types§
Sourcetype Public: BytesRepresentable + Clone + PartialEq
type Public: BytesRepresentable + Clone + PartialEq
Represents the type of the public key
Required Methods§
Sourcefn from_secret(bytes: &[u8]) -> Result<Self, CryptoError>
fn from_secret(bytes: &[u8]) -> Result<Self, CryptoError>
Creates a keypair from the given secret key.
Sourcefn secret(&self) -> &SecretValue<Self::SecretLen>
fn secret(&self) -> &SecretValue<Self::SecretLen>
Returns the private (secret) part of the keypair
Provided Methods§
Sourcefn unzip(self) -> (SecretValue<Self::SecretLen>, Self::Public)
fn unzip(self) -> (SecretValue<Self::SecretLen>, Self::Public)
Consumes the instance and produces separated private and public parts
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.