Struct matrix_sdk_crypto::olm::InboundGroupSession
source · [−]pub struct InboundGroupSession {
pub session_id: Arc<str>,
pub sender_key: Arc<str>,
pub signing_keys: Arc<BTreeMap<DeviceKeyAlgorithm, String>>,
pub room_id: Arc<RoomId>,
/* private fields */
}
Expand description
Inbound group session.
Inbound group sessions are used to exchange room messages between a group of participants. Inbound group sessions are used to decrypt the room messages.
Fields
session_id: Arc<str>
The SessionId associated to this GroupSession
sender_key: Arc<str>
The sender_key associated to this GroupSession
signing_keys: Arc<BTreeMap<DeviceKeyAlgorithm, String>>
Map of DeviceKeyAlgorithm to the public ed25519 key of the account
room_id: Arc<RoomId>
The Room this GroupSession belongs to
Implementations
sourceimpl InboundGroupSession
impl InboundGroupSession
sourcepub fn new(
sender_key: &str,
signing_key: &str,
room_id: &RoomId,
session_key: SessionKey,
history_visibility: Option<HistoryVisibility>
) -> Self
pub fn new(
sender_key: &str,
signing_key: &str,
room_id: &RoomId,
session_key: SessionKey,
history_visibility: Option<HistoryVisibility>
) -> Self
Create a new inbound group session for the given room.
These sessions are used to decrypt room messages.
Arguments
-
sender_key
- The public curve25519 key of the account that sent us the session -
signing_key
- The public ed25519 key of the account that sent us the session. -
room_id
- The id of the room that the session is used in. -
session_key
- The private session key that is used to decrypt messages.
sourcepub fn from_export(exported_session: ExportedRoomKey) -> Self
pub fn from_export(exported_session: ExportedRoomKey) -> Self
Create a InboundGroupSession from an exported version of the group session.
Most notably this can be called with an ExportedRoomKey
from a
previous export()
call.
sourcepub fn from_forwarded_key(
sender_key: &str,
content: &mut ToDeviceForwardedRoomKeyEventContent
) -> Result<Self, SessionKeyDecodeError>
pub fn from_forwarded_key(
sender_key: &str,
content: &mut ToDeviceForwardedRoomKeyEventContent
) -> Result<Self, SessionKeyDecodeError>
Create a new inbound group session from a forwarded room key content.
Arguments
-
sender_key
- The public curve25519 key of the account that sent us the session -
content
- A forwarded room key content that contains the session key to create theInboundGroupSession
.
sourcepub async fn pickle(&self) -> PickledInboundGroupSession
pub async fn pickle(&self) -> PickledInboundGroupSession
Store the group session as a base64 encoded string.
Arguments
pickle_mode
- The mode that was used to pickle the group session, either an unencrypted mode or an encrypted using passphrase.
sourcepub async fn export(&self) -> ExportedRoomKey
pub async fn export(&self) -> ExportedRoomKey
Export this session at the first known message index.
If only a limited part of this session should be exported use
export_at_index()
.
sourcepub fn sender_key(&self) -> &str
pub fn sender_key(&self) -> &str
Get the sender key that this session was received from.
sourcepub fn reset_backup_state(&self)
pub fn reset_backup_state(&self)
Reset the backup state of the inbound group session.
sourcepub fn mark_as_backed_up(&self)
pub fn mark_as_backed_up(&self)
For testing, allow to manually mark this GroupSession to have been backed up
sourcepub fn signing_keys(&self) -> &BTreeMap<DeviceKeyAlgorithm, String>
pub fn signing_keys(&self) -> &BTreeMap<DeviceKeyAlgorithm, String>
Get the map of signing keys this session was received from.
sourcepub fn forwarding_key_chain(&self) -> &[String]
pub fn forwarding_key_chain(&self) -> &[String]
Get the list of ed25519 keys that this session was forwarded through.
Each ed25519 key represents a single device. If device A forwards the session to device B and device B to C this list will contain the ed25519 keys of A and B.
sourcepub async fn export_at_index(&self, message_index: u32) -> ExportedRoomKey
pub async fn export_at_index(&self, message_index: u32) -> ExportedRoomKey
Export this session at the given message index.
sourcepub fn from_pickle(
pickle: PickledInboundGroupSession
) -> Result<Self, PickleError>
pub fn from_pickle(
pickle: PickledInboundGroupSession
) -> Result<Self, PickleError>
Restore a Session from a previously pickled string.
Returns the restored group session or a UnpicklingError
if there
was an error.
Arguments
-
pickle
- The pickled version of theInboundGroupSession
. -
pickle_mode
- The mode that was used to pickle the session, either an unencrypted mode or an encrypted using passphrase.
sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Returns the unique identifier for this session.
sourcepub fn first_known_index(&self) -> u32
pub fn first_known_index(&self) -> u32
Get the first message index we know how to decrypt.
sourcepub async fn decrypt(
&self,
event: &OriginalSyncRoomEncryptedEvent
) -> Result<(Raw<AnyRoomEvent>, u32), MegolmError>
pub async fn decrypt(
&self,
event: &OriginalSyncRoomEncryptedEvent
) -> Result<(Raw<AnyRoomEvent>, u32), MegolmError>
Trait Implementations
sourceimpl Clone for InboundGroupSession
impl Clone for InboundGroupSession
sourcefn clone(&self) -> InboundGroupSession
fn clone(&self) -> InboundGroupSession
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for InboundGroupSession
impl Debug for InboundGroupSession
sourceimpl From<ExportedRoomKey> for InboundGroupSession
impl From<ExportedRoomKey> for InboundGroupSession
sourcefn from(key: ExportedRoomKey) -> Self
fn from(key: ExportedRoomKey) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for InboundGroupSession
impl Send for InboundGroupSession
impl Sync for InboundGroupSession
impl Unpin for InboundGroupSession
impl !UnwindSafe for InboundGroupSession
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more