unc/types/
secret_key.rs

1#[derive(Debug, Clone, PartialEq, Eq)]
2pub struct SecretKey(pub unc_crypto::SecretKey);
3
4impl std::fmt::Display for SecretKey {
5    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6        self.0.fmt(f)
7    }
8}
9
10impl std::str::FromStr for SecretKey {
11    type Err = unc_crypto::ParseKeyError;
12
13    fn from_str(s: &str) -> Result<Self, Self::Err> {
14        let private_key = unc_crypto::SecretKey::from_str(s)?;
15        Ok(Self(private_key))
16    }
17}
18
19impl From<SecretKey> for unc_crypto::SecretKey {
20    fn from(item: SecretKey) -> Self {
21        item.0
22    }
23}
24
25impl interactive_clap::ToCli for SecretKey {
26    type CliVariant = SecretKey;
27}