#[non_exhaustive]pub struct XMatrix {
pub origin: OwnedServerName,
pub destination: Option<OwnedServerName>,
pub key: OwnedServerSigningKeyId,
pub sig: Base64,
}Expand description
Typed representation of an Authorization header of scheme X-Matrix, as defined in the
Matrix Server-Server API.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.origin: OwnedServerNameThe server name of the sending server.
destination: Option<OwnedServerName>The server name of the receiving sender.
For compatibility with older servers, recipients should accept requests without this parameter, but MUST always send it. If this property is included, but the value does not match the receiving server’s name, the receiving server must deny the request with an HTTP status code 401 Unauthorized.
key: OwnedServerSigningKeyIdThe ID - including the algorithm name - of the sending server’s key that was used to sign the request.
sig: Base64The signature of the JSON.
Implementations§
Source§impl XMatrix
impl XMatrix
Sourcepub fn new(
origin: OwnedServerName,
destination: OwnedServerName,
key: OwnedServerSigningKeyId,
sig: Base64,
) -> Self
pub fn new( origin: OwnedServerName, destination: OwnedServerName, key: OwnedServerSigningKeyId, sig: Base64, ) -> Self
Construct a new X-Matrix Authorization header.
Sourcepub fn parse(s: impl AsRef<str>) -> Result<Self, XMatrixParseError>
pub fn parse(s: impl AsRef<str>) -> Result<Self, XMatrixParseError>
Parse an X-Matrix Authorization header from the given string.
Sourcepub fn request_object<T: AsRef<[u8]>>(
request: &Request<T>,
origin: &ServerName,
destination: &ServerName,
) -> Result<CanonicalJsonObject, Error>
pub fn request_object<T: AsRef<[u8]>>( request: &Request<T>, origin: &ServerName, destination: &ServerName, ) -> Result<CanonicalJsonObject, Error>
Construct the canonical JSON object representation of the request to sign for the XMatrix
scheme.
Sourcepub fn try_from_http_request<T: AsRef<[u8]>>(
request: &Request<T>,
input: ServerSignaturesInput<'_>,
) -> Result<Self, IntoHttpError>
pub fn try_from_http_request<T: AsRef<[u8]>>( request: &Request<T>, input: ServerSignaturesInput<'_>, ) -> Result<Self, IntoHttpError>
Try to construct this header from the given HTTP request and input.
Trait Implementations§
Source§impl Credentials for XMatrix
impl Credentials for XMatrix
Source§const SCHEME: &'static str = "X-Matrix"
const SCHEME: &'static str = "X-Matrix"
Source§fn decode(value: &HeaderValue) -> Option<Self>
fn decode(value: &HeaderValue) -> Option<Self>
HeaderValue. Read moreSource§fn encode(&self) -> HeaderValue
fn encode(&self) -> HeaderValue
HeaderValue. Read more