federation-api: Wrap ServerSigningKeys in Raw
Instances might contain extra fields that need to be taken into account for signature verification.
This commit is contained in:
parent
6502e4e378
commit
2003948edb
@ -11,6 +11,7 @@ pub mod v2 {
|
|||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_common::MilliSecondsSinceUnixEpoch;
|
use ruma_common::MilliSecondsSinceUnixEpoch;
|
||||||
use ruma_identifiers::ServerName;
|
use ruma_identifiers::ServerName;
|
||||||
|
use ruma_serde::Raw;
|
||||||
|
|
||||||
use crate::discovery::ServerSigningKeys;
|
use crate::discovery::ServerSigningKeys;
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ pub mod v2 {
|
|||||||
|
|
||||||
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<ServerSigningKeys>,
|
pub server_keys: Vec<Raw<ServerSigningKeys>>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ pub mod v2 {
|
|||||||
|
|
||||||
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<ServerSigningKeys>) -> Self {
|
pub fn new(server_keys: Vec<Raw<ServerSigningKeys>>) -> Self {
|
||||||
Self { server_keys }
|
Self { server_keys }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ pub mod v2 {
|
|||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_common::MilliSecondsSinceUnixEpoch;
|
use ruma_common::MilliSecondsSinceUnixEpoch;
|
||||||
use ruma_identifiers::{ServerName, ServerSigningKeyId};
|
use ruma_identifiers::{ServerName, ServerSigningKeyId};
|
||||||
|
use ruma_serde::Raw;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::discovery::ServerSigningKeys;
|
use crate::discovery::ServerSigningKeys;
|
||||||
@ -43,7 +44,7 @@ pub mod v2 {
|
|||||||
|
|
||||||
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<ServerSigningKeys>,
|
pub server_keys: Vec<Raw<ServerSigningKeys>>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ pub mod v2 {
|
|||||||
|
|
||||||
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<ServerSigningKeys>) -> Self {
|
pub fn new(server_keys: Vec<Raw<ServerSigningKeys>>) -> Self {
|
||||||
Self { server_keys }
|
Self { server_keys }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ pub mod v2 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.2/server-server-api/#get_matrixkeyv2serverkeyid
|
//! [spec]: https://spec.matrix.org/v1.2/server-server-api/#get_matrixkeyv2serverkeyid
|
||||||
|
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
|
use ruma_serde::Raw;
|
||||||
|
|
||||||
use crate::discovery::ServerSigningKeys;
|
use crate::discovery::ServerSigningKeys;
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ pub mod v2 {
|
|||||||
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: ServerSigningKeys,
|
pub server_key: Raw<ServerSigningKeys>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,13 +45,13 @@ pub mod v2 {
|
|||||||
|
|
||||||
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: ServerSigningKeys) -> Self {
|
pub fn new(server_key: Raw<ServerSigningKeys>) -> Self {
|
||||||
Self { server_key }
|
Self { server_key }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ServerSigningKeys> for Response {
|
impl From<Raw<ServerSigningKeys>> for Response {
|
||||||
fn from(server_key: ServerSigningKeys) -> Self {
|
fn from(server_key: Raw<ServerSigningKeys>) -> Self {
|
||||||
Self::new(server_key)
|
Self::new(server_key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user