Skip to content

Commit

Permalink
Fix canUploadKeysWithPasswordOnly for MSC3967
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dbkr committed Dec 5, 2024
1 parent 2a5af99 commit 0a43803
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/CreateCrossSigning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import InteractiveAuthDialog from "./components/views/dialogs/InteractiveAuthDia
async function canUploadKeysWithPasswordOnly(cli: MatrixClient): Promise<boolean> {
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!");
Expand Down

0 comments on commit 0a43803

Please sign in to comment.