1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Use stable calls to /room_keys (#2729)

* Use stable calls to `/room_keys`

Fixes https://github.com/vector-im/element-web/issues/22839

* Appease the CI
This commit is contained in:
Travis Ralston
2022-10-04 12:55:16 -04:00
committed by GitHub
parent 2f24e90e53
commit b1ed972867
2 changed files with 6 additions and 6 deletions

View File

@@ -2700,7 +2700,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
try {
res = await this.http.authedRequest<IKeyBackupInfo>(
undefined, Method.Get, "/room_keys/version", undefined, undefined,
{ prefix: PREFIX_UNSTABLE },
{ prefix: PREFIX_V3 },
);
} catch (e) {
if (e.errcode === 'M_NOT_FOUND') {
@@ -2856,7 +2856,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
const res = await this.http.authedRequest<IKeyBackupInfo>(
undefined, Method.Post, "/room_keys/version", undefined, data,
{ prefix: PREFIX_UNSTABLE },
{ prefix: PREFIX_V3 },
);
// We could assume everything's okay and enable directly, but this ensures
@@ -2888,7 +2888,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
return this.http.authedRequest(
undefined, Method.Delete, path, undefined, undefined,
{ prefix: PREFIX_UNSTABLE },
{ prefix: PREFIX_V3 },
);
}

View File

@@ -18,7 +18,7 @@ import { logger } from "../logger";
import { MatrixEvent } from "../models/event";
import { createCryptoStoreCacheCallbacks, ICacheCallbacks } from "./CrossSigning";
import { IndexedDBCryptoStore } from './store/indexeddb-crypto-store';
import { Method, PREFIX_UNSTABLE } from "../http-api";
import { Method, PREFIX_V3 } from "../http-api";
import { Crypto, IBootstrapCrossSigningOpts } from "./index";
import {
ClientEvent,
@@ -246,14 +246,14 @@ export class EncryptionSetupOperation {
algorithm: this.keyBackupInfo.algorithm,
auth_data: this.keyBackupInfo.auth_data,
},
{ prefix: PREFIX_UNSTABLE },
{ prefix: PREFIX_V3 },
);
} else {
// add new key backup
await baseApis.http.authedRequest(
undefined, Method.Post, "/room_keys/version",
undefined, this.keyBackupInfo,
{ prefix: PREFIX_UNSTABLE },
{ prefix: PREFIX_V3 },
);
}
}