[][src]Trait solana_libra_nextgen_crypto::traits::ValidKey

pub trait ValidKey: for<'a> TryFrom<&'a [u8], Error = CryptoMaterialError> + Debug {
    fn to_bytes(&self) -> Vec<u8>;

    fn validate(&self) -> Result<(), CryptoMaterialError> { ... }
}

Key material with a notion of byte validation.

A type family for material that knows how to serialize and deserialize, as well as validate byte-encoded material. The validation must be implemented as a TryFrom which classifies its failures against the above CryptoMaterialError.

This provides an implementation for a validation that relies on a round-trip to bytes and corresponding TryFrom.

Required methods

fn to_bytes(&self) -> Vec<u8>

Convert the valid key to bytes.

Loading content...

Provided methods

fn validate(&self) -> Result<(), CryptoMaterialError>

TryFrom is the source of truth on whether we can build a valid key. => we can use it once we've built, to validate!

Loading content...

Implementors

impl ValidKey for BLS12381PrivateKey[src]

impl ValidKey for BLS12381PublicKey[src]

impl ValidKey for Ed25519PrivateKey[src]

impl ValidKey for Ed25519PublicKey[src]

Loading content...