/// Load a ed25519 keypair from disk. If a keypair file does not yet exist,
/// a new keypair is generated and then saved to disk.
Load a ed25519 keypair from disk. If a keypair file does not yet exist,
a new keypair is generated and then saved to disk.
Load a ed25519 keypair from disk . If a keypair file does not yet exist a new keypair is generated and then saved to disk .
pub fn load_or_generate_ed25519() -> identity::Keypair {
    let keypair_path = get_keypair_path();
    match load_ed25519(&keypair_path) {
        Ok(keypair) => identity::Keypair::Ed25519(keypair),
        Err(_) => {
            let keypair = identity::ed25519::Keypair::generate();
            if let Err(e) = save_ed25519(&keypair, &keypair_path) {
                warn!("Failed to persist newly generated keypair: {:?}", e);
            }
            identity::Keypair::Ed25519(keypair)
        }
    }
}
pub fn load_or_generate_ed25519 ( ) -> identity :: Keypair { let keypair_path = get_keypair_path ( ) ; match load_ed25519 ( & keypair_path ) { Ok ( keypair ) => identity :: Keypair :: Ed25519 ( keypair ) , Err ( _ ) => { let keypair = identity :: ed25519 :: Keypair :: generate ( ) ; if let Err ( e ) = save_ed25519 ( & keypair , & keypair_path ) { warn ! ( " " e ) ; } identity :: Keypair :: Ed25519 ( keypair ) } } }
Load a ed25519 keypair from disk.
Load a ed25519 keypair from disk .