pub fn generate_key() -> (String, Vec<u8>) {
    let mut csprng = OsRng {};
    let keypair = ed25519_dalek::Keypair::generate(&mut csprng);

    let secret_key: SecretKey = {
        let sk = keypair.secret.to_bytes().to_vec();
        SecretKey(secret_to_array(sk))
    };
    let public_key: PublicKey = {
        let pk = keypair.public.to_bytes().to_vec();
        PublicKey(public_to_array(pk))
    };

    let secret_pem = secret_key.to_pem(&public_key);
    let public_der = public_key.to_der();

    (secret_pem, public_der)
}
/// Generates the key and returns the (secret, public) pair encoded as PEM and
/// DER, respectively.
Generates the key and returns the (secret, public) pair encoded as PEM and
DER, respectively.
Generates the key and returns the ( secret public ) pair encoded as PEM and DER respectively .
pub fn generate_key() -> (String, Vec<u8>) {
    let mut csprng = OsRng {};
    let keypair = ed25519_dalek::Keypair::generate(&mut csprng);
    let secret_key: SecretKey = {
        let sk = keypair.secret.to_bytes().to_vec();
        SecretKey(secret_to_array(sk))
    };
    let public_key: PublicKey = {
        let pk = keypair.public.to_bytes().to_vec();
        PublicKey(public_to_array(pk))
    };
    let secret_pem = secret_key.to_pem(&public_key);
    let public_der = public_key.to_der();
    (secret_pem, public_der)
}
pub fn generate_key ( ) -> ( String , Vec < u8 > ) { let mut csprng = OsRng { } ; let keypair = ed25519_dalek :: Keypair :: generate ( & mut csprng ) ; let secret_key : SecretKey = { let sk = keypair . secret . to_bytes ( ) . to_vec ( ) ; SecretKey ( secret_to_array ( sk ) ) } ; let public_key : PublicKey = { let pk = keypair . public . to_bytes ( ) . to_vec ( ) ; PublicKey ( public_to_array ( pk ) ) } ; let secret_pem = secret_key . to_pem ( & public_key ) ; let public_der = public_key . to_der ( ) ; ( secret_pem , public_der ) }
Generates the key and returns the (secret, public) pair encoded as PEM and
DER, respectively.
Generates the key and returns the ( secret public ) pair encoded as PEM and DER respectively .