mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Introduce Ed25519 verify as an external.
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user