use ruma's X-Matrix to construct the sending X-Matrix header value
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
da03de1d32
commit
391bfd986e
|
@ -8,6 +8,8 @@ use ruma::{
|
||||||
client::error::Error as RumaError, EndpointError, IncomingResponse, MatrixVersion, OutgoingRequest,
|
client::error::Error as RumaError, EndpointError, IncomingResponse, MatrixVersion, OutgoingRequest,
|
||||||
SendAccessToken,
|
SendAccessToken,
|
||||||
},
|
},
|
||||||
|
serde::Base64,
|
||||||
|
server_util::authorization::XMatrix,
|
||||||
ServerName,
|
ServerName,
|
||||||
};
|
};
|
||||||
use tracing::{debug, trace};
|
use tracing::{debug, trace};
|
||||||
|
@ -196,16 +198,20 @@ where
|
||||||
|
|
||||||
for signature_server in signatures {
|
for signature_server in signatures {
|
||||||
for s in signature_server {
|
for s in signature_server {
|
||||||
|
let key =
|
||||||
|
s.0.as_str()
|
||||||
|
.try_into()
|
||||||
|
.expect("valid homeserver signing key ID");
|
||||||
|
let sig = Base64::parse(s.1).expect("valid base64");
|
||||||
|
|
||||||
http_request.headers_mut().insert(
|
http_request.headers_mut().insert(
|
||||||
AUTHORIZATION,
|
AUTHORIZATION,
|
||||||
HeaderValue::from_str(&format!(
|
HeaderValue::from(&XMatrix::new(
|
||||||
"X-Matrix origin=\"{}\",destination=\"{}\",key=\"{}\",sig=\"{}\"",
|
services().globals.config.server_name.clone(),
|
||||||
services().globals.config.server_name,
|
dest.to_owned(),
|
||||||
dest,
|
key,
|
||||||
s.0,
|
sig,
|
||||||
s.1
|
)),
|
||||||
))
|
|
||||||
.expect("formatted X-Matrix header"),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue