Fix cross-signing bootstrap by passing UIA password auth

The homeserver requires User-Interactive Authentication before accepting
cross-signing keys. Pass the bot's password so bootstrap succeeds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dave
2026-03-17 16:08:39 +00:00
parent 7ec869baa8
commit f5d5196bf5

View File

@@ -136,9 +136,22 @@ pub async fn run_bot(
slog!("[matrix-bot] Logged in as {bot_user_id} (device: {})", login_response.device_id); slog!("[matrix-bot] Logged in as {bot_user_id} (device: {})", login_response.device_id);
// Bootstrap cross-signing keys for E2EE verification support. // Bootstrap cross-signing keys for E2EE verification support.
if let Err(e) = client.encryption().bootstrap_cross_signing(None).await { // Pass the bot's password for UIA (User-Interactive Authentication) —
// the homeserver requires proof of identity before accepting cross-signing keys.
{
use matrix_sdk::ruma::api::client::uiaa;
let password_auth = uiaa::AuthData::Password(uiaa::Password::new(
uiaa::UserIdentifier::UserIdOrLocalpart(config.username.clone()),
config.password.clone(),
));
if let Err(e) = client
.encryption()
.bootstrap_cross_signing(Some(password_auth))
.await
{
slog!("[matrix-bot] Cross-signing bootstrap note: {e}"); slog!("[matrix-bot] Cross-signing bootstrap note: {e}");
} }
}
// Self-sign own device keys so other clients don't show // Self-sign own device keys so other clients don't show
// "encrypted by a device not verified by its owner" warnings. // "encrypted by a device not verified by its owner" warnings.