fn create_new_key_pair(key_path: &Path) -> Result<KeyPair, Error> {
    let parents = key_path.parent();
    if let Some(parent_path) = parents {
        create_dirs(&[&parent_path])?
    }

    let key_pair = KeyPair::generate();
    let encoded = bs58::encode(key_pair.encode().as_ref()).into_string();

    let mut key_file = File::create(key_path)?;
    key_file.write_all(encoded.as_bytes())?;

    Ok(key_pair)
}
/// Creates new key pair and store it in a `key_path` file.
Creates new key pair and store it in a `key_path` file.
Creates new key pair and store it in a ` key_path ` file .
fn create_new_key_pair(key_path: &Path) -> Result<KeyPair, Error> {
    let parents = key_path.parent();
    if let Some(parent_path) = parents {
        create_dirs(&[&parent_path])?
    }
    let key_pair = KeyPair::generate();
    let encoded = bs58::encode(key_pair.encode().as_ref()).into_string();
    let mut key_file = File::create(key_path)?;
    key_file.write_all(encoded.as_bytes())?;
    Ok(key_pair)
}
fn create_new_key_pair ( key_path : & Path ) -> Result < KeyPair , Error > { let parents = key_path . parent ( ) ; if let Some ( parent_path ) = parents { create_dirs ( & [ & parent_path ] ) ? } let key_pair = KeyPair :: generate ( ) ; let encoded = bs58 :: encode ( key_pair . encode ( ) . as_ref ( ) ) . into_string ( ) ; let mut key_file = File :: create ( key_path ) ? ; key_file . write_all ( encoded . as_bytes ( ) ) ? ; Ok ( key_pair ) }
Creates new key pair and store it in a `key_path` file.
Creates new key pair and store it in a ` key_path ` file .
key_path
&Path