OlmPkSigning

Struct OlmPkSigning 

Source
pub struct OlmPkSigning { /* private fields */ }
Expand description

Signs messages using public key cryptography.

Implementations§

Source§

impl OlmPkSigning

Source

pub fn new(seed: &[u8]) -> Result<Self, OlmPkSigningError>

Create a new signing object.

§Arguments
Source

pub fn seed_length() -> usize

Get the required seed length.

Source

pub fn generate_seed() -> Vec<u8>

Generate a random seed that can be used to initialize a OlmPkSigning object.

Source

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();
Source

pub fn sign(&self, message: &str) -> String

Sign a message using this object.

§Arguments
  • message - The message that should be signed with the private key of this object.
§Panics
  • OUTPUT_BUFFER_TOO_SMALL for the signature buffer that is provided to libolm.
  • on malformed UTF-8 coding of the signature provided by libolm.

Trait Implementations§

Source§

impl Drop for OlmPkSigning

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for OlmPkSigning

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.