events: Use TransactionId for secret request IDs
This commit is contained in:
parent
9aa748459a
commit
46d2957c29
@ -3,7 +3,7 @@
|
||||
//! [`m.room_key_request`]: https://spec.matrix.org/v1.1/client-server-api/#mroom_key_request
|
||||
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::{DeviceId, EventEncryptionAlgorithm, RoomId};
|
||||
use ruma_identifiers::{DeviceId, EventEncryptionAlgorithm, RoomId, TransactionId};
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -29,7 +29,7 @@ pub struct ToDeviceRoomKeyRequestEventContent {
|
||||
///
|
||||
/// If the key is requested multiple times, it should be reused. It should also reused
|
||||
/// in order to cancel a request.
|
||||
pub request_id: String,
|
||||
pub request_id: Box<TransactionId>,
|
||||
}
|
||||
|
||||
impl ToDeviceRoomKeyRequestEventContent {
|
||||
@ -39,7 +39,7 @@ impl ToDeviceRoomKeyRequestEventContent {
|
||||
action: Action,
|
||||
body: Option<RequestedKeyInfo>,
|
||||
requesting_device_id: Box<DeviceId>,
|
||||
request_id: String,
|
||||
request_id: Box<TransactionId>,
|
||||
) -> Self {
|
||||
Self { action, body, requesting_device_id, request_id }
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::DeviceId;
|
||||
use ruma_identifiers::{DeviceId, TransactionId};
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{ser::SerializeStruct, Deserialize, Serialize};
|
||||
|
||||
@ -32,7 +32,7 @@ pub struct ToDeviceSecretRequestEventContent {
|
||||
///
|
||||
/// If the secret is requested from multiple devices at the same time, the same ID may be used
|
||||
/// for every target. The same ID is also used in order to cancel a previous request.
|
||||
pub request_id: String,
|
||||
pub request_id: Box<TransactionId>,
|
||||
}
|
||||
|
||||
impl ToDeviceSecretRequestEventContent {
|
||||
@ -41,7 +41,7 @@ impl ToDeviceSecretRequestEventContent {
|
||||
pub fn new(
|
||||
action: RequestAction,
|
||||
requesting_device_id: Box<DeviceId>,
|
||||
request_id: String,
|
||||
request_id: Box<TransactionId>,
|
||||
) -> Self {
|
||||
Self { action, requesting_device_id, request_id }
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ use serde::{Deserialize, Serialize};
|
||||
#[ruma_event(type = "m.secret.send", kind = ToDevice)]
|
||||
pub struct ToDeviceSecretSendEventContent {
|
||||
/// The ID of the request that this is a response to.
|
||||
pub request_id: String,
|
||||
pub request_id: Box<TransactionId>,
|
||||
|
||||
/// The contents of the secret.
|
||||
pub secret: String,
|
||||
@ -24,7 +24,7 @@ pub struct ToDeviceSecretSendEventContent {
|
||||
|
||||
impl ToDeviceSecretSendEventContent {
|
||||
/// Creates a new `SecretSendEventContent` with the given request ID and secret.
|
||||
pub fn new(request_id: String, secret: String) -> Self {
|
||||
pub fn new(request_id: Box<TransactionId>, secret: String) -> Self {
|
||||
Self { request_id, secret }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user