pub async fn create_outgoing_key_request(
        &self,
        room_id: &RoomId,
        sender_key: &str,
        session_id: &str,
    ) -> Result<(), CryptoStoreError> {
        let key_info = RequestedKeyInfo {
            algorithm: EventEncryptionAlgorithm::MegolmV1AesSha2,
            room_id: room_id.to_owned(),
            sender_key: sender_key.to_owned(),
            session_id: session_id.to_owned(),
        };

        let id: Option<String> = self.store.get_object(&key_info.encode()).await?;

        if id.is_some() {
            // We already sent out a request for this key, nothing to do.
            return Ok(());
        }

        info!("Creating new outgoing room key request {:#?}", key_info);

        let id = Uuid::new_v4();

        let content = RoomKeyRequestEventContent {
            action: Action::Request,
            request_id: id.to_string(),
            requesting_device_id: (&*self.device_id).clone(),
            body: Some(key_info),
        };

        let request = wrap_key_request_content(self.user_id().clone(), id, &content)?;

        let info = OugoingKeyInfo {
            request_id: id,
            info: content.body.unwrap(),
            sent_out: false,
        };

        self.save_outgoing_key_info(id, info).await?;
        self.outgoing_to_device_requests.insert(id, request);

        Ok(())
    }
/// Create a new outgoing key request for the key with the given session id.
///
/// This will queue up a new to-device request and store the key info so
/// once we receive a forwarded room key we can check that it matches the
/// key we requested.
///
/// This does nothing if a request for this key has already been sent out.
///
/// # Arguments
/// * `room_id` - The id of the room where the key is used in.
///
/// * `sender_key` - The curve25519 key of the sender that owns the key.
///
/// * `session_id` - The id that uniquely identifies the session.
Create a new outgoing key request for the key with the given session id.
This will queue up a new to-device request and store the key info so
once we receive a forwarded room key we can check that it matches the
key we requested.

This does nothing if a request for this key has already been sent out.
Create a new outgoing key request for the key with the given session id . This will queue up a new to - device request and store the key info so once we receive a forwarded room key we can check that it matches the key we requested . This does nothing if a request for this key has already been sent out .
pub async fn create_outgoing_key_request(
        &self,
        room_id: &RoomId,
        sender_key: &str,
        session_id: &str,
    ) -> Result<(), CryptoStoreError> {
        let key_info = RequestedKeyInfo {
            algorithm: EventEncryptionAlgorithm::MegolmV1AesSha2,
            room_id: room_id.to_owned(),
            sender_key: sender_key.to_owned(),
            session_id: session_id.to_owned(),
        };
        let id: Option<String> = self.store.get_object(&key_info.encode()).await?;
        if id.is_some() {
            // We already sent out a request for this key, nothing to do.
            return Ok(());
        }
        info!("Creating new outgoing room key request {:#?}", key_info);
        let id = Uuid::new_v4();
        let content = RoomKeyRequestEventContent {
            action: Action::Request,
            request_id: id.to_string(),
            requesting_device_id: (&*self.device_id).clone(),
            body: Some(key_info),
        };
        let request = wrap_key_request_content(self.user_id().clone(), id, &content)?;
        let info = OugoingKeyInfo {
            request_id: id,
            info: content.body.unwrap(),
            sent_out: false,
        };
        self.save_outgoing_key_info(id, info).await?;
        self.outgoing_to_device_requests.insert(id, request);
        Ok(())
    }
pub async fn create_outgoing_key_request ( & self , room_id : & RoomId , sender_key : & str , session_id : & str , ) -> Result < ( ) , CryptoStoreError > { let key_info = RequestedKeyInfo { algorithm : EventEncryptionAlgorithm :: MegolmV1AesSha2 , room_id : room_id . to_owned ( ) , sender_key : sender_key . to_owned ( ) , session_id : session_id . to_owned ( ) , } ; let id : Option < String > = self . store . get_object ( & key_info . encode ( ) ) . await ? ; if id . is_some ( ) { // We already sent out a request for this key, nothing to do. return Ok ( ( ) ) ; } info ! ( " " key_info ) ; let id = Uuid :: new_v4 ( ) ; let content = RoomKeyRequestEventContent { action : Action :: Request , request_id : id . to_string ( ) , requesting_device_id : ( & * self . device_id ) . clone ( ) , body : Some ( key_info ) , } ; let request = wrap_key_request_content ( self . user_id ( ) . clone ( ) , id , & content ) ? ; let info = OugoingKeyInfo { request_id : id , info : content . body . unwrap ( ) , sent_out : false , } ; self . save_outgoing_key_info ( id , info ) . await ? ; self . outgoing_to_device_requests . insert ( id , request ) ; Ok ( ( ) ) }
Create a new outgoing key request for the key with the given session id.
Create a new outgoing key request for the key with the given session id .
&self
room_id
&RoomId
sender_key
&str
session_id
&str
&self
room_id
&RoomId
sender_key
&str
session_id
&str