diff --git a/src/signature.rs b/src/signature.rs index fc80df4..3dd0753 100644 --- a/src/signature.rs +++ b/src/signature.rs @@ -24,6 +24,10 @@ pub fn to_string(key: &VerifyingKey) -> String { bs58::encode(key.to_bytes()).into_string() } +pub fn to_string_sig(signature: &Signature) -> String { + bs58::encode(signature.to_bytes()).into_string() +} + pub fn from_string(key: &str) -> anyhow::Result { Ok(VerifyingKey::from_bytes( &bs58::decode(key) @@ -38,10 +42,6 @@ pub fn from_string_sig(signature: &str) -> anyhow::Result { &bs58::decode(signature) .into_vec()? .try_into() - .map_err(|_| anyhow::anyhow!("Invalid public key"))?, + .map_err(|_| anyhow::anyhow!("Invalid signature"))?, )) } - -pub fn to_string_sig(signature: &Signature) -> String { - bs58::encode(signature.to_bytes()).into_string() -}