Struct olm_rs::session::OlmSession [−][src]
Either an outbound or inbound session for secure communication.
Implementations
impl OlmSession[src]
pub fn session_id(&self) -> String[src]
Retuns the identifier for this session. Will be the same for both ends of the conversation.
C-API equivalent
olm_session_id
Panics
OutputBufferTooSmallif the supplied output buffer for the ID was too small- on malformed UTF-8 coding of the session ID provided by libolm
pub fn pickle(&self, mode: PicklingMode) -> String[src]
Serialises an OlmSession to encrypted base64.
C-API equivalent
olm_pickle_session
Panics
OUTPUT_BUFFER_TOO_SMALLfor OlmSession's pickled buffer- on malformed UTF-8 coding of the pickling provided by libolm
pub fn unpickle(
mut pickled: String,
mode: PicklingMode
) -> Result<Self, OlmSessionError>[src]
mut pickled: String,
mode: PicklingMode
) -> Result<Self, OlmSessionError>
Deserialises from encrypted base64 that was previously obtained by pickling an OlmSession.
C-API equivalent
olm_unpickle_session
Errors
BadAccountKeyif the key doesn't match the one the session was encrypted withInvalidBase64if decoding the suppliedpickledstring slice fails
pub fn encrypt(&self, plaintext: &str) -> OlmMessage[src]
Encrypts a plaintext message using the session.
C-API equivalent
olm_encrypt
Panics
NotEnoughRandomfor too little supplied random dataOutputBufferTooSmallfor encrypted message- on malformed UTF-8 coding of the ciphertext provided by libolm
pub fn decrypt(&self, message: OlmMessage) -> Result<String, OlmSessionError>[src]
Decrypts a message using this session. Decoding is lossy, meaing if
the decrypted plaintext contains invalid UTF-8 symbols, they will
be returned as U+FFFD (�).
C-API equivalent
olm_decrypt
Errors
InvalidBase64on invalid base64 coding for supplied argumentsBadMessageVersionon unsupported protocol versionBadMessageFormaton failing to decode the messageBadMessageMacon invalid message MAC
Panics
OutputBufferTooSmallon plaintext output buffer
pub fn has_received_message(&self) -> bool[src]
Checker for any received messages for this session.
C-API equivalent
olm_session_has_received_message
pub fn matches_inbound_session(
&self,
mut message: PreKeyMessage
) -> Result<bool, OlmSessionError>[src]
&self,
mut message: PreKeyMessage
) -> Result<bool, OlmSessionError>
Checks if the 'prekey' message is for this in-bound session.
C-API equivalent
olm_matches_inbound_session
Errors
InvalidBase64for failing to decode base64 inone_time_key_messageBadMessageVersionfor message from unsupported protocol versionBadMessageFormatfor failing to decodeone_time_key_message
pub fn matches_inbound_session_from(
&self,
their_identity_key: &str,
mut message: PreKeyMessage
) -> Result<bool, OlmSessionError>[src]
&self,
their_identity_key: &str,
mut message: PreKeyMessage
) -> Result<bool, OlmSessionError>
Checks if the 'prekey' message is for this in-bound session.
C-API equivalent
olm_matches_inbound_session
Errors
InvalidBase64for failing to decode base64 inone_time_key_messageBadMessageVersionfor message from unsupported protocol versionBadMessageFormatfor failing to decodeone_time_key_message
Trait Implementations
impl Debug for OlmSession[src]
impl Drop for OlmSession[src]
impl Eq for OlmSession[src]
impl Ord for OlmSession[src]
orders by unicode code points (which is a superset of ASCII)
fn cmp(&self, other: &Self) -> Ordering[src]
#[must_use]pub fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self1.50.0[src]
impl PartialEq<OlmSession> for OlmSession[src]
impl PartialOrd<OlmSession> for OlmSession[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl Send for OlmSession[src]
impl StructuralEq for OlmSession[src]
Auto Trait Implementations
impl RefUnwindSafe for OlmSession[src]
impl !Sync for OlmSession[src]
impl Unpin for OlmSession[src]
impl UnwindSafe for OlmSession[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,