You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-08-09 04:22:45 +03:00
Interface to allow cross-signing reset using Synapse admin API
This commit is contained in:
@@ -130,6 +130,9 @@ struct SynapseDeactivateUserRequest {
|
||||
erase: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct SynapseAllowCrossSigningResetRequest {}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl HomeserverConnection for SynapseConnection {
|
||||
type Error = anyhow::Error;
|
||||
@@ -366,4 +369,37 @@ impl HomeserverConnection for SynapseConnection {
|
||||
async fn unset_displayname(&self, mxid: &str) -> Result<(), Self::Error> {
|
||||
self.set_displayname(mxid, "").await
|
||||
}
|
||||
|
||||
#[tracing::instrument(
|
||||
name = "homeserver.allow_cross_signing_reset",
|
||||
skip_all,
|
||||
fields(
|
||||
matrix.homeserver = self.homeserver,
|
||||
matrix.mxid = mxid,
|
||||
),
|
||||
err(Display),
|
||||
)]
|
||||
async fn allow_cross_signing_reset(&self, mxid: &str) -> Result<(), Self::Error> {
|
||||
let mut client = self
|
||||
.http_client_factory
|
||||
.client("homeserver.allow_cross_signing_reset")
|
||||
.request_bytes_to_body()
|
||||
.json_request();
|
||||
|
||||
let request = self
|
||||
.post(&format!(
|
||||
"_synapse/admin/v1/users/{mxid}/_allow_cross_signing_replacement_without_uia"
|
||||
))
|
||||
.body(SynapseAllowCrossSigningResetRequest {})?;
|
||||
|
||||
let response = client.ready().await?.call(request).await?;
|
||||
|
||||
if response.status() != StatusCode::OK {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Failed to allow cross signing reset in Synapse"
|
||||
));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user