Revert "identifiers: Add SecretRequestId"
This reverts commit aafbe14923a9272029652e7f56ef2aa809b03e34.
This commit is contained in:
parent
aafbe14923
commit
9aa748459a
@ -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, SecretRequestId};
|
||||
use ruma_identifiers::{DeviceId, EventEncryptionAlgorithm, RoomId};
|
||||
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: Box<SecretRequestId>,
|
||||
pub request_id: String,
|
||||
}
|
||||
|
||||
impl ToDeviceRoomKeyRequestEventContent {
|
||||
@ -39,7 +39,7 @@ impl ToDeviceRoomKeyRequestEventContent {
|
||||
action: Action,
|
||||
body: Option<RequestedKeyInfo>,
|
||||
requesting_device_id: Box<DeviceId>,
|
||||
request_id: Box<SecretRequestId>,
|
||||
request_id: String,
|
||||
) -> 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, SecretRequestId};
|
||||
use ruma_identifiers::DeviceId;
|
||||
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: Box<SecretRequestId>,
|
||||
pub request_id: String,
|
||||
}
|
||||
|
||||
impl ToDeviceSecretRequestEventContent {
|
||||
@ -41,7 +41,7 @@ impl ToDeviceSecretRequestEventContent {
|
||||
pub fn new(
|
||||
action: RequestAction,
|
||||
requesting_device_id: Box<DeviceId>,
|
||||
request_id: Box<SecretRequestId>,
|
||||
request_id: String,
|
||||
) -> Self {
|
||||
Self { action, requesting_device_id, request_id }
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
//! [`m.secret.send`]: https://spec.matrix.org/v1.1/client-server-api/#msecretsend
|
||||
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::SecretRequestId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The content of an `m.secret.send` event.
|
||||
@ -17,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: Box<SecretRequestId>,
|
||||
pub request_id: String,
|
||||
|
||||
/// The contents of the secret.
|
||||
pub secret: String,
|
||||
@ -25,7 +24,7 @@ pub struct ToDeviceSecretSendEventContent {
|
||||
|
||||
impl ToDeviceSecretSendEventContent {
|
||||
/// Creates a new `SecretSendEventContent` with the given request ID and secret.
|
||||
pub fn new(request_id: Box<SecretRequestId>, secret: String) -> Self {
|
||||
pub fn new(request_id: String, secret: String) -> Self {
|
||||
Self { request_id, secret }
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ Breaking changes:
|
||||
|
||||
Improvements:
|
||||
|
||||
* Add `TransactionId` and `SecretRequestId`
|
||||
* Add `host`, `port` and `is_ip_literal` methods to `ServerName`
|
||||
|
||||
Bug fixes:
|
||||
|
@ -38,7 +38,6 @@ pub use crate::{
|
||||
room_name::RoomName,
|
||||
room_or_room_alias_id::RoomOrAliasId,
|
||||
room_version_id::RoomVersionId,
|
||||
secret_request_id::SecretRequestId,
|
||||
server_name::ServerName,
|
||||
session_id::SessionId,
|
||||
signatures::{DeviceSignatures, EntitySignatures, ServerSignatures, Signatures},
|
||||
@ -67,7 +66,6 @@ mod room_id;
|
||||
mod room_name;
|
||||
mod room_or_room_alias_id;
|
||||
mod room_version_id;
|
||||
mod secret_request_id;
|
||||
mod server_name;
|
||||
mod session_id;
|
||||
mod signatures;
|
||||
|
@ -1,22 +0,0 @@
|
||||
/// A secret request ID.
|
||||
///
|
||||
/// You can create one from a string (using `.into()`) but the recommended way is to use
|
||||
/// `SecretRequestId::new()` to generate a random one. If that function is not available for you,
|
||||
/// you need to activate this crate's `rand` Cargo feature.
|
||||
#[repr(transparent)]
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct SecretRequestId(str);
|
||||
|
||||
impl SecretRequestId {
|
||||
/// Creates a random secret request ID.
|
||||
///
|
||||
/// This will currently be a UUID without hyphens, but no guarantees are made about the
|
||||
/// structure of transaction IDs generated from this function.
|
||||
#[cfg(feature = "rand")]
|
||||
pub fn new() -> Box<Self> {
|
||||
let id = uuid::Uuid::new_v4();
|
||||
Self::from_owned(id.to_simple().to_string().into_boxed_str())
|
||||
}
|
||||
}
|
||||
|
||||
opaque_identifier!(SecretRequestId);
|
@ -85,9 +85,9 @@ pub use ruma_identifiers::{
|
||||
device_id, device_key_id, event_id, mxc_uri, room_alias_id, room_id, room_version_id,
|
||||
server_name, server_signing_key_id, user_id, ClientSecret, DeviceId, DeviceKeyAlgorithm,
|
||||
DeviceKeyId, DeviceSignatures, DeviceSigningKeyId, EntitySignatures, EventEncryptionAlgorithm,
|
||||
EventId, KeyId, KeyName, MxcUri, RoomAliasId, RoomId, RoomOrAliasId, RoomVersionId,
|
||||
SecretRequestId, ServerName, ServerSignatures, ServerSigningKeyId, SessionId, Signatures,
|
||||
SigningKeyAlgorithm, TransactionId, UserId,
|
||||
EventId, KeyId, KeyName, MxcUri, RoomAliasId, RoomId, RoomOrAliasId, RoomVersionId, ServerName,
|
||||
ServerSignatures, ServerSigningKeyId, SessionId, Signatures, SigningKeyAlgorithm,
|
||||
TransactionId, UserId,
|
||||
};
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user