federation-api: Rename SigningKey => ServerSigningKeys

This commit is contained in:
Jonas Platte 2020-11-28 00:19:25 +01:00
parent 8ccf0f128b
commit f8bf8b3fb8
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
4 changed files with 16 additions and 14 deletions

View File

@ -49,7 +49,7 @@ impl OldVerifyKey {
/// Queried server key, signed by the notary server. /// Queried server key, signed by the notary server.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct SigningKey { pub struct ServerSigningKeys {
/// DNS name of the homeserver. /// DNS name of the homeserver.
pub server_name: ServerNameBox, pub server_name: ServerNameBox,
@ -69,8 +69,8 @@ pub struct SigningKey {
pub valid_until_ts: SystemTime, pub valid_until_ts: SystemTime,
} }
impl SigningKey { impl ServerSigningKeys {
/// Creates a new `SigningKey` with the given server name and validity timestamp. /// Creates a new `ServerSigningKeys` with the given server name and validity timestamp.
/// ///
/// All other fields will be empty. /// All other fields will be empty.
pub fn new(server_name: ServerNameBox, valid_until_ts: SystemTime) -> Self { pub fn new(server_name: ServerNameBox, valid_until_ts: SystemTime) -> Self {

View File

@ -2,10 +2,11 @@
use std::time::SystemTime; use std::time::SystemTime;
use crate::discovery::SigningKey;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::ServerName; use ruma_identifiers::ServerName;
use crate::discovery::ServerSigningKeys;
ruma_api! { ruma_api! {
metadata: { metadata: {
description: "Query for another server's keys.", description: "Query for another server's keys.",
@ -34,7 +35,7 @@ ruma_api! {
response: { response: {
/// The queried server's keys, signed by the notary server. /// The queried server's keys, signed by the notary server.
pub server_keys: Vec<SigningKey>, pub server_keys: Vec<ServerSigningKeys>,
} }
} }
@ -47,7 +48,7 @@ impl<'a> Request<'a> {
impl Response { impl Response {
/// Creates a new `Response` with the given keys. /// Creates a new `Response` with the given keys.
pub fn new(server_keys: Vec<SigningKey>) -> Self { pub fn new(server_keys: Vec<ServerSigningKeys>) -> Self {
Self { server_keys } Self { server_keys }
} }
} }

View File

@ -2,7 +2,7 @@
use std::{collections::BTreeMap, time::SystemTime}; use std::{collections::BTreeMap, time::SystemTime};
use crate::discovery::SigningKey; use crate::discovery::ServerSigningKeys;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::{ServerNameBox, ServerSigningKeyId}; use ruma_identifiers::{ServerNameBox, ServerSigningKeyId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -43,7 +43,7 @@ ruma_api! {
response: { response: {
/// The queried server's keys, signed by the notary server. /// The queried server's keys, signed by the notary server.
pub server_keys: Vec<SigningKey>, pub server_keys: Vec<ServerSigningKeys>,
} }
} }
@ -59,7 +59,7 @@ impl Request {
impl Response { impl Response {
/// Creates a new `Response` with the given keys. /// Creates a new `Response` with the given keys.
pub fn new(server_keys: Vec<SigningKey>) -> Self { pub fn new(server_keys: Vec<ServerSigningKeys>) -> Self {
Self { server_keys } Self { server_keys }
} }
} }

View File

@ -1,8 +1,9 @@
//! [GET /_matrix/key/v2/server](https://matrix.org/docs/spec/server_server/r0.1.4#get-matrix-key-v2-server-keyid) //! [GET /_matrix/key/v2/server](https://matrix.org/docs/spec/server_server/r0.1.4#get-matrix-key-v2-server-keyid)
use crate::discovery::SigningKey;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use crate::discovery::ServerSigningKeys;
ruma_api! { ruma_api! {
metadata: { metadata: {
description: "Gets the homeserver's published signing keys.", description: "Gets the homeserver's published signing keys.",
@ -19,7 +20,7 @@ ruma_api! {
response: { response: {
/// Queried server key, signed by the notary server. /// Queried server key, signed by the notary server.
#[ruma_api(body)] #[ruma_api(body)]
pub server_key: SigningKey, pub server_key: ServerSigningKeys,
} }
} }
@ -32,13 +33,13 @@ impl Request {
impl Response { impl Response {
/// Creates a new `Response` with the given server key. /// Creates a new `Response` with the given server key.
pub fn new(server_key: SigningKey) -> Self { pub fn new(server_key: ServerSigningKeys) -> Self {
Self { server_key } Self { server_key }
} }
} }
impl From<SigningKey> for Response { impl From<ServerSigningKeys> for Response {
fn from(server_key: SigningKey) -> Self { fn from(server_key: ServerSigningKeys) -> Self {
Self::new(server_key) Self::new(server_key)
} }
} }