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

View File

@ -2,10 +2,11 @@
use std::time::SystemTime;
use crate::discovery::SigningKey;
use ruma_api::ruma_api;
use ruma_identifiers::ServerName;
use crate::discovery::ServerSigningKeys;
ruma_api! {
metadata: {
description: "Query for another server's keys.",
@ -34,7 +35,7 @@ ruma_api! {
response: {
/// 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 {
/// 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 }
}
}

View File

@ -2,7 +2,7 @@
use std::{collections::BTreeMap, time::SystemTime};
use crate::discovery::SigningKey;
use crate::discovery::ServerSigningKeys;
use ruma_api::ruma_api;
use ruma_identifiers::{ServerNameBox, ServerSigningKeyId};
use serde::{Deserialize, Serialize};
@ -43,7 +43,7 @@ ruma_api! {
response: {
/// 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 {
/// 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 }
}
}

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)
use crate::discovery::SigningKey;
use ruma_api::ruma_api;
use crate::discovery::ServerSigningKeys;
ruma_api! {
metadata: {
description: "Gets the homeserver's published signing keys.",
@ -19,7 +20,7 @@ ruma_api! {
response: {
/// Queried server key, signed by the notary server.
#[ruma_api(body)]
pub server_key: SigningKey,
pub server_key: ServerSigningKeys,
}
}
@ -32,13 +33,13 @@ impl Request {
impl Response {
/// 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 }
}
}
impl From<SigningKey> for Response {
fn from(server_key: SigningKey) -> Self {
impl From<ServerSigningKeys> for Response {
fn from(server_key: ServerSigningKeys) -> Self {
Self::new(server_key)
}
}