#[non_exhaustive]pub struct XMatrix {
    pub origin: OwnedServerName,
    pub destination: Option<OwnedServerName>,
    pub key: OwnedKeyId<SigningKeyAlgorithm, ServerSigningKeyVersion>,
    pub sig: Base64,
}api and (crate features federation-api-c or federation-api-s) only.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: OwnedKeyId<SigningKeyAlgorithm, ServerSigningKeyVersion>The 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: OwnedKeyId<SigningKeyAlgorithm, ServerSigningKeyVersion>,
    sig: Base64,
) -> XMatrix
 
pub fn new( origin: OwnedServerName, destination: OwnedServerName, key: OwnedKeyId<SigningKeyAlgorithm, ServerSigningKeyVersion>, sig: Base64, ) -> XMatrix
Construct a new X-Matrix Authorization header.
Sourcepub fn parse(s: impl AsRef<str>) -> Result<XMatrix, XMatrixParseError>
 
pub fn parse(s: impl AsRef<str>) -> Result<XMatrix, XMatrixParseError>
Parse an X-Matrix Authorization header from the given string.
Sourcepub fn request_object<T>(
    request: &Request<T>,
    origin: &ServerName,
    destination: &ServerName,
) -> Result<BTreeMap<String, CanonicalJsonValue>, Error>
 
pub fn request_object<T>( request: &Request<T>, origin: &ServerName, destination: &ServerName, ) -> Result<BTreeMap<String, CanonicalJsonValue>, Error>
Construct the canonical JSON object representation of the request to sign for the XMatrix
scheme.
Sourcepub fn try_from_http_request<T>(
    request: &Request<T>,
    input: ServerSignaturesInput<'_>,
) -> Result<XMatrix, XMatrixFromRequestError>
 
pub fn try_from_http_request<T>( request: &Request<T>, input: ServerSignaturesInput<'_>, ) -> Result<XMatrix, XMatrixFromRequestError>
Try to construct this header from the given HTTP request and input.
Sourcepub fn verify_request<T>(
    &self,
    request: &Request<T>,
    destination: &ServerName,
    public_key_map: &BTreeMap<String, BTreeMap<String, Base64>>,
) -> Result<(), XMatrixVerificationError>
 
pub fn verify_request<T>( &self, request: &Request<T>, destination: &ServerName, public_key_map: &BTreeMap<String, BTreeMap<String, Base64>>, ) -> Result<(), XMatrixVerificationError>
Verify that the signature in the sig field is valid for the given incoming HTTP request,
with the given public keys map from the origin.
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<XMatrix>
 
fn decode(value: &HeaderValue) -> Option<XMatrix>
HeaderValue. Read moreSource§fn encode(&self) -> HeaderValue
 
fn encode(&self) -> HeaderValue
HeaderValue. Read more