Use ServerNameBox in ruma-events, ruma-*-api

This commit is contained in:
Jonas Platte 2020-08-13 21:57:56 +02:00
parent b4b96e44fd
commit 148d876acb
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
8 changed files with 21 additions and 21 deletions

View File

@ -3,7 +3,7 @@
use std::time::Duration; use std::time::Duration;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::{ServerName, UserId}; use ruma_identifiers::{ServerNameBox, UserId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
ruma_api! { ruma_api! {
@ -30,7 +30,7 @@ ruma_api! {
pub token_type: TokenType, pub token_type: TokenType,
/// Homeserver domain for verification of user's identity. /// Homeserver domain for verification of user's identity.
pub matrix_server_name: Box<ServerName>, pub matrix_server_name: ServerNameBox,
/// Seconds until token expiration. /// Seconds until token expiration.
#[serde(with = "ruma_serde::duration::secs")] #[serde(with = "ruma_serde::duration::secs")]

View File

@ -1,7 +1,7 @@
//! [POST /_matrix/client/r0/join/{roomIdOrAlias}](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-join-roomidoralias) //! [POST /_matrix/client/r0/join/{roomIdOrAlias}](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-join-roomidoralias)
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::{RoomId, RoomIdOrAliasId, ServerName}; use ruma_identifiers::{RoomId, RoomIdOrAliasId, ServerNameBox};
use super::{IncomingThirdPartySigned, ThirdPartySigned}; use super::{IncomingThirdPartySigned, ThirdPartySigned};
@ -24,7 +24,7 @@ ruma_api! {
/// must be participating in the room. /// must be participating in the room.
#[ruma_api(query)] #[ruma_api(query)]
#[serde(default)] #[serde(default)]
pub server_name: &'a [Box<ServerName>], pub server_name: &'a [ServerNameBox],
/// The signature of a `m.third_party_invite` token to prove that this user owns a third /// The signature of a `m.third_party_invite` token to prove that this user owns a third
/// party identity which has been invited to the room. /// party identity which has been invited to the room.

View File

@ -2,7 +2,7 @@
use ruma_api::{ruma_api, Outgoing}; use ruma_api::{ruma_api, Outgoing};
use ruma_common::thirdparty::Medium; use ruma_common::thirdparty::Medium;
use ruma_identifiers::{DeviceId, DeviceIdBox, ServerName, UserId}; use ruma_identifiers::{DeviceId, DeviceIdBox, ServerNameBox, UserId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
ruma_api! { ruma_api! {
@ -46,7 +46,7 @@ ruma_api! {
/// Deprecated: Clients should instead use the `user_id.server_name()` /// Deprecated: Clients should instead use the `user_id.server_name()`
/// method if they require it. /// method if they require it.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub home_server: Option<Box<ServerName>>, pub home_server: Option<ServerNameBox>,
/// ID of the logged-in device. /// ID of the logged-in device.
/// ///

View File

@ -12,7 +12,7 @@ use std::{collections::BTreeMap, time::SystemTime};
use js_int::UInt; use js_int::UInt;
use ruma_events::EventType; use ruma_events::EventType;
use ruma_identifiers::{EventId, RoomId, ServerKeyId, ServerName, UserId}; use ruma_identifiers::{EventId, RoomId, ServerKeyId, ServerNameBox, UserId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue; use serde_json::Value as JsonValue;
@ -84,7 +84,7 @@ pub struct RoomV1Pdu {
pub hashes: EventHash, pub hashes: EventHash,
/// Signatures for the PDU. /// Signatures for the PDU.
pub signatures: BTreeMap<Box<ServerName>, BTreeMap<ServerKeyId, String>>, pub signatures: BTreeMap<ServerNameBox, BTreeMap<ServerKeyId, String>>,
} }
/// A 'persistent data unit' (event) for room versions 3 and beyond. /// A 'persistent data unit' (event) for room versions 3 and beyond.
@ -140,7 +140,7 @@ pub struct RoomV3Pdu {
pub hashes: EventHash, pub hashes: EventHash,
/// Signatures for the PDU. /// Signatures for the PDU.
pub signatures: BTreeMap<Box<ServerName>, BTreeMap<ServerKeyId, String>>, pub signatures: BTreeMap<ServerNameBox, BTreeMap<ServerKeyId, String>>,
} }
/// PDU type without event and room IDs. /// PDU type without event and room IDs.
@ -216,7 +216,7 @@ pub struct RoomV1PduStub {
pub hashes: EventHash, pub hashes: EventHash,
/// Signatures for the PDU. /// Signatures for the PDU.
pub signatures: BTreeMap<Box<ServerName>, BTreeMap<ServerKeyId, String>>, pub signatures: BTreeMap<ServerNameBox, BTreeMap<ServerKeyId, String>>,
} }
impl RoomV1PduStub { impl RoomV1PduStub {
@ -292,7 +292,7 @@ pub struct RoomV3PduStub {
pub hashes: EventHash, pub hashes: EventHash,
/// Signatures for the PDU. /// Signatures for the PDU.
pub signatures: BTreeMap<Box<ServerName>, BTreeMap<ServerKeyId, String>>, pub signatures: BTreeMap<ServerNameBox, BTreeMap<ServerKeyId, String>>,
} }
impl RoomV3PduStub { impl RoomV3PduStub {

View File

@ -3,7 +3,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use ruma_events_macros::StateEventContent; use ruma_events_macros::StateEventContent;
use ruma_identifiers::{ServerKeyId, ServerName, UserId}; use ruma_identifiers::{ServerKeyId, ServerNameBox, UserId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use strum::{Display, EnumString}; use strum::{Display, EnumString};
@ -108,7 +108,7 @@ pub struct SignedContent {
/// A single signature from the verifying server, in the format specified by the Signing Events /// A single signature from the verifying server, in the format specified by the Signing Events
/// section of the server-server API. /// section of the server-server API.
pub signatures: BTreeMap<Box<ServerName>, BTreeMap<ServerKeyId, String>>, pub signatures: BTreeMap<ServerNameBox, BTreeMap<ServerKeyId, String>>,
/// The token property of the containing third_party_invite object. /// The token property of the containing third_party_invite object.
pub token: String, pub token: String,

View File

@ -5,7 +5,7 @@ use std::time::SystemTime;
use js_int::UInt; use js_int::UInt;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_events::pdu::Pdu; use ruma_events::pdu::Pdu;
use ruma_identifiers::{EventId, RoomId, ServerName}; use ruma_identifiers::{EventId, RoomId, ServerNameBox};
ruma_api! { ruma_api! {
metadata: { metadata: {
@ -33,7 +33,7 @@ ruma_api! {
response: { response: {
/// The `server_name` of the homeserver sending this transaction. /// The `server_name` of the homeserver sending this transaction.
pub origin: Box<ServerName>, pub origin: ServerNameBox,
/// POSIX timestamp in milliseconds on originating homeserver when this transaction started. /// POSIX timestamp in milliseconds on originating homeserver when this transaction started.
#[serde(with = "ruma_serde::time::ms_since_unix_epoch")] #[serde(with = "ruma_serde::time::ms_since_unix_epoch")]
@ -59,7 +59,7 @@ impl Response {
/// * the `server_name` of the homeserver. /// * the `server_name` of the homeserver.
/// * the timestamp in milliseconds of when this transaction started. /// * the timestamp in milliseconds of when this transaction started.
/// * the list of persistent updates to rooms. /// * the list of persistent updates to rooms.
pub fn new(origin: Box<ServerName>, origin_server_ts: SystemTime, pdus: Vec<Pdu>) -> Self { pub fn new(origin: ServerNameBox, origin_server_ts: SystemTime, pdus: Vec<Pdu>) -> Self {
Self { origin, origin_server_ts, pdus } Self { origin, origin_server_ts, pdus }
} }
} }

View File

@ -2,7 +2,7 @@
use std::{collections::BTreeMap, time::SystemTime}; use std::{collections::BTreeMap, time::SystemTime};
use ruma_identifiers::{ServerKeyId, ServerName}; use ruma_identifiers::{ServerKeyId, ServerNameBox};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
pub mod discover_homeserver; pub mod discover_homeserver;
@ -34,14 +34,14 @@ pub struct OldVerifyKey {
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ServerKey { pub struct ServerKey {
/// DNS name of the homeserver. /// DNS name of the homeserver.
pub server_name: Box<ServerName>, pub server_name: ServerNameBox,
/// Public keys of the homeserver for verifying digital signatures. /// Public keys of the homeserver for verifying digital signatures.
pub verify_keys: BTreeMap<String, VerifyKey>, pub verify_keys: BTreeMap<String, VerifyKey>,
/// Public keys that the homeserver used to use and when it stopped using them. /// Public keys that the homeserver used to use and when it stopped using them.
pub old_verify_keys: BTreeMap<String, OldVerifyKey>, pub old_verify_keys: BTreeMap<String, OldVerifyKey>,
/// Digital signatures of this object signed using the verify_keys. Map of /// Digital signatures of this object signed using the verify_keys. Map of
/// server name to keys by key ID /// server name to keys by key ID
pub signatures: BTreeMap<Box<ServerName>, BTreeMap<ServerKeyId, String>>, pub signatures: BTreeMap<ServerNameBox, BTreeMap<ServerKeyId, String>>,
/// Timestamp when the keys should be refreshed. This field MUST be ignored in room /// Timestamp when the keys should be refreshed. This field MUST be ignored in room
/// versions 1, 2, 3, and 4. /// versions 1, 2, 3, and 4.
#[serde(with = "ruma_serde::time::ms_since_unix_epoch")] #[serde(with = "ruma_serde::time::ms_since_unix_epoch")]

View File

@ -4,7 +4,7 @@ use std::{collections::BTreeMap, time::SystemTime};
use crate::discovery::ServerKey; use crate::discovery::ServerKey;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::{ServerKeyId, ServerName}; use ruma_identifiers::{ServerKeyId, ServerNameBox};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
ruma_api! { ruma_api! {
@ -28,7 +28,7 @@ ruma_api! {
/// The notary server may return multiple keys regardless of the Key IDs /// The notary server may return multiple keys regardless of the Key IDs
/// given. /// given.
#[ruma_api(body)] #[ruma_api(body)]
pub server_keys: BTreeMap<Box<ServerName>, BTreeMap<ServerKeyId, QueryCriteria>>, pub server_keys: BTreeMap<ServerNameBox, BTreeMap<ServerKeyId, QueryCriteria>>,
/// A millisecond POSIX timestamp in milliseconds indicating when the /// A millisecond POSIX timestamp in milliseconds indicating when the
/// returned certificates will need to be valid until to be useful to /// returned certificates will need to be valid until to be useful to