diff --git a/libcitadel/src/keys.rs b/libcitadel/src/keys.rs index f6b1bb5..3308b21 100644 --- a/libcitadel/src/keys.rs +++ b/libcitadel/src/keys.rs @@ -50,8 +50,12 @@ impl KeyPair { pub fn from_hex(hex: &str) -> Result { let bytes = hex::decode(hex)?; + KeyPair::from_bytes(&bytes) + } + + pub fn from_bytes(bytes: &[u8]) -> Result { if bytes.len() != SEEDBYTES { - bail!("Hex encoded keypair has incorrect length"); + bail!("Hex encoded keypair has incorrect length"); } let seed = sign::Seed::from_slice(&bytes).expect("Seed::from_slice() failed"); Ok(KeyPair(seed))