/// Generates a keypair of the specified KeyPairType, as either Text or JSON
Generates a keypair of the specified KeyPairType, as either Text or JSON
Generates a keypair of the specified KeyPairType as either Text or JSON
pub(crate) fn generate(kt: &KeyPairType, output: &OutputKind) -> String {
    let kp = KeyPair::new(kt.clone());
    match output {
        OutputKind::Text => format!(
            "Public Key: {}\nSeed: {}\n\nRemember that the seed is private, treat it as a secret.",
            kp.public_key(),
            kp.seed().unwrap()
        ),
        OutputKind::JSON => json!({
            "public_key": kp.public_key(),
            "seed": kp.seed().unwrap(),
        })
        .to_string(),
    }
}
pub ( crate ) fn generate ( kt : & KeyPairType , output : & OutputKind ) -> String { let kp = KeyPair :: new ( kt . clone ( ) ) ; match output { OutputKind :: Text => format ! ( " \n \n \n " kp public_key ( ) kp seed ( ) unwrap ( ) ) , OutputKind :: JSON => json ! ( { " " kp public_key ( ) " " kp seed ( ) unwrap ( ) } ) . to_string ( ) , } }
Generates a keypair of the specified KeyPairType, as either Text or JSON
Generates a keypair of the specified KeyPairType as either Text or JSON
kt
&KeyPairType
output
&OutputKind