pub struct OlmPkSigning { /* private fields */ }Expand description
Signs messages using public key cryptography.
Implementations§
Source§impl OlmPkSigning
impl OlmPkSigning
Sourcepub fn new(seed: &[u8]) -> Result<Self, OlmPkSigningError>
pub fn new(seed: &[u8]) -> Result<Self, OlmPkSigningError>
Create a new signing object.
§Arguments
seed- the seed to use as the private key for signing. The seed must have the same length as the seeds generated byOlmPkSigning::generate_seed(). The correct length can be checked usingOlmPkSigning::seed_length()as well.
Sourcepub fn seed_length() -> usize
pub fn seed_length() -> usize
Get the required seed length.
Sourcepub fn generate_seed() -> Vec<u8> ⓘ
pub fn generate_seed() -> Vec<u8> ⓘ
Generate a random seed that can be used to initialize a OlmPkSigning
object.
Sourcepub fn public_key(&self) -> &str
pub fn public_key(&self) -> &str
Get the public key of the the OlmPkSigning object.
This can be used to check the signature of a messsage that has been signed by this object.
§Example
let message = "It's a secret to everyone".to_string();
let sign = OlmPkSigning::new(&OlmPkSigning::generate_seed()).unwrap();
let utility = OlmUtility::new();
let signature = sign.sign(&message);
utility.ed25519_verify(sign.public_key(), &message, signature).unwrap();Trait Implementations§
Source§impl Drop for OlmPkSigning
impl Drop for OlmPkSigning
impl Send for OlmPkSigning
Auto Trait Implementations§
impl Freeze for OlmPkSigning
impl RefUnwindSafe for OlmPkSigning
impl !Sync for OlmPkSigning
impl Unpin for OlmPkSigning
impl UnwindSafe for OlmPkSigning
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