pub trait KeyPairSchema:
Sized
+ PartialEq
+ Debug
+ Copy {
type Crypto: BlockCipher;
// Required methods
fn random() -> Self;
fn from_bytes(bytes: &[u8]) -> Result<Self>;
fn from_hex_private_key<S: AsRef<str>>(hex: S) -> Result<Self>;
fn from_private_key(pk: PrivateKey) -> Self;
fn private_key(&self) -> PrivateKey;
fn public_key(&self) -> PublicKey;
fn sign(&self, data: &[u8]) -> Signature;
fn verify(&self, data: &[u8], signature: Signature) -> Result<()>;
fn from_null_private_key(pk: PublicKey) -> Self;
// Provided method
fn to_bytes(&self) -> [u8; 64] { ... }
}Expand description
This trait defines a schema: an association of symbol or nis1 keypair type.
Required Associated Types§
type Crypto: BlockCipher
Required Methods§
Sourcefn from_bytes(bytes: &[u8]) -> Result<Self>
fn from_bytes(bytes: &[u8]) -> Result<Self>
Construct a Keypair from the bytes of a PublicKey and PrivateKey.
Sourcefn from_hex_private_key<S: AsRef<str>>(hex: S) -> Result<Self>
fn from_hex_private_key<S: AsRef<str>>(hex: S) -> Result<Self>
Construct a Keypair from a hex encoded private key string.
Sourcefn from_private_key(pk: PrivateKey) -> Self
fn from_private_key(pk: PrivateKey) -> Self
Construct a Keypair PrivateKey type.
fn private_key(&self) -> PrivateKey
fn public_key(&self) -> PublicKey
Sourcefn verify(&self, data: &[u8], signature: Signature) -> Result<()>
fn verify(&self, data: &[u8], signature: Signature) -> Result<()>
Verify a Signature on a data with this Keypair public key.
fn from_null_private_key(pk: PublicKey) -> Self
Provided Methods§
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.