pub struct PublicKey(/* private fields */);
Expand description
An WOTS public key.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn verify(&self, message: &[u8], signature: Signature) -> bool
pub fn verify(&self, message: &[u8], signature: Signature) -> bool
Verify a signature
on a message
using the WOTS algorithm.
§Inputs
message
in bytes representation.signature
is a purported WOTSSignature
on themessage
.
§Returns
Returns true
if the signature
was a valid signature created by this
SecretKey
on the message
.
§Example
use rand::rngs::OsRng;
use wots_rs::{PublicKey, SecretKey};
let mut csprng = OsRng{};
let secret_key: SecretKey = SecretKey::generate(&mut csprng);
let public_key: PublicKey = PublicKey::from(&secret_key);
let message = b"hello";
let signature = secret_key.sign(message);
assert!(public_key.verify(message, signature));
Trait Implementations§
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more