Fix invalid sig
This commit is contained in:
+5
-5
@@ -24,6 +24,10 @@ pub fn to_string(key: &VerifyingKey) -> String {
|
|||||||
bs58::encode(key.to_bytes()).into_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<VerifyingKey> {
|
pub fn from_string(key: &str) -> anyhow::Result<VerifyingKey> {
|
||||||
Ok(VerifyingKey::from_bytes(
|
Ok(VerifyingKey::from_bytes(
|
||||||
&bs58::decode(key)
|
&bs58::decode(key)
|
||||||
@@ -38,10 +42,6 @@ pub fn from_string_sig(signature: &str) -> anyhow::Result<Signature> {
|
|||||||
&bs58::decode(signature)
|
&bs58::decode(signature)
|
||||||
.into_vec()?
|
.into_vec()?
|
||||||
.try_into()
|
.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()
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user