From 0a43803d469bce72760b64078417dc63789f6b3e Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 5 Dec 2024 14:10:16 +0000 Subject: [PATCH] Fix canUploadKeysWithPasswordOnly for MSC3967 Being able to upload keys without any auth works too, so return true. Otherwise we have to go the same route via the InteractiveAuthDialog which is way more complex. --- src/CreateCrossSigning.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CreateCrossSigning.ts b/src/CreateCrossSigning.ts index e67e030f60..8c2d4488cf 100644 --- a/src/CreateCrossSigning.ts +++ b/src/CreateCrossSigning.ts @@ -23,11 +23,11 @@ import InteractiveAuthDialog from "./components/views/dialogs/InteractiveAuthDia async function canUploadKeysWithPasswordOnly(cli: MatrixClient): Promise { try { await cli.uploadDeviceSigningKeys(undefined, {} as CrossSigningKeys); - // We should never get here: the server should always require - // UI auth to upload device signing keys. If we do, we upload - // no keys which would be a no-op. + // If we get here, it's because the server is allowing us to upload keys without + // auth the first time due to MSC3967. Therefore, yes, we can upload keys + // (with or without password, technically, but that's fine). logger.log("uploadDeviceSigningKeys unexpectedly succeeded without UI auth!"); - return false; + return true; } catch (error) { if (!(error instanceof MatrixError) || !error.data || !error.data.flows) { logger.log("uploadDeviceSigningKeys advertised no flows!");