solana_seed_derivable/
lib.rs

1//! The interface by which keys are derived.
2use {solana_derivation_path::DerivationPath, std::error};
3
4/// The `SeedDerivable` trait defines the interface by which cryptographic keys/keypairs are
5/// derived from byte seeds, derivation paths, and passphrases.
6pub trait SeedDerivable: Sized {
7    fn from_seed(seed: &[u8]) -> Result<Self, Box<dyn error::Error>>;
8    fn from_seed_and_derivation_path(
9        seed: &[u8],
10        derivation_path: Option<DerivationPath>,
11    ) -> Result<Self, Box<dyn error::Error>>;
12    fn from_seed_phrase_and_passphrase(
13        seed_phrase: &str,
14        passphrase: &str,
15    ) -> Result<Self, Box<dyn error::Error>>;
16}