/// Reads encrypted master key from file and generate validator keys from it.
Reads encrypted master key from file and generate validator keys from it.
Reads encrypted master key from file and generate validator keys from it .
pub fn read_keys_from_file<P: AsRef<Path>, W: AsRef<[u8]>>(
    path: P,
    pass_phrase: W,
) -> Result<Keys, failure::Error> {
    let mut key_file = File::open(path)?;
    #[cfg(unix)]
    validate_file_mode(key_file.metadata()?.mode())?;
    let mut file_content = vec![];
    key_file.read_to_end(&mut file_content)?;
    let keys: EncryptedMasterKey =
        toml::from_slice(file_content.as_slice()).map_err(|e| Error::new(ErrorKind::Other, e))?;
    let seed = keys.decrypt(pass_phrase)?;
    let tree = SecretTree::from_seed(&seed).expect("Error creating secret tree from seed.");
    generate_keys_from_master_password(tree)
        .ok_or_else(|| format_err!("Error deriving keys from master key"))
}
pub fn read_keys_from_file < P : AsRef < Path > , W : AsRef < [ u8 ] > > ( path : P , pass_phrase : W , ) -> Result < Keys , failure :: Error > { let mut key_file = File :: open ( path ) ? ; # [ cfg ( unix ) ] validate_file_mode ( key_file . metadata ( ) ? . mode ( ) ) ? ; let mut file_content = vec ! [ ] ; key_file . read_to_end ( & mut file_content ) ? ; let keys : EncryptedMasterKey = toml :: from_slice ( file_content . as_slice ( ) ) . map_err ( | e | Error :: new ( ErrorKind :: Other , e ) ) ? ; let seed = keys . decrypt ( pass_phrase ) ? ; let tree = SecretTree :: from_seed ( & seed ) . expect ( " " ) ; generate_keys_from_master_password ( tree ) . ok_or_else ( | | format_err ! ( " " ) ) }
Reads encrypted master key from file and generate validator keys from it.
Reads encrypted master key from file and generate validator keys from it .
path
P
pass_phrase
W