Introduce Ed25519 verify as an external.

This commit is contained in:
Gav
2018-01-17 19:17:34 +01:00
parent 6b1153d975
commit ec78b7244a
3 changed files with 32 additions and 3 deletions
+11
View File
@@ -15,6 +15,17 @@ impl<'a> ::std::fmt::Display for HexDisplay<'a> {
}
}
pub fn verify(sig: &[u8], message: &[u8], public: &[u8]) -> bool {
let public_key = untrusted::Input::from(public);
let msg = untrusted::Input::from(message);
let sig = untrusted::Input::from(sig);
match signature::verify(&signature::ED25519, public_key, msg, sig) {
Ok(_) => true,
_ => false,
}
}
/// A public key.
#[derive(PartialEq, Clone, Debug)]
pub struct Public ([u8; 32]);