Remove MatrixClient.getDehydratedDevice call (#28254)

This commit is contained in:
Florian Duros 2024-10-22 10:09:07 +02:00 committed by GitHub
parent 3c8ac6fc49
commit 4a1f86f273
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 30 deletions

View file

@ -10,7 +10,6 @@ import { mocked, Mocked } from "jest-mock";
import { IBootstrapCrossSigningOpts } from "matrix-js-sdk/src/crypto";
import { MatrixClient, Device } from "matrix-js-sdk/src/matrix";
import { SecretStorageKeyDescriptionAesV1, ServerSideSecretStorage } from "matrix-js-sdk/src/secret-storage";
import { IDehydratedDevice } from "matrix-js-sdk/src/crypto/dehydration";
import { CryptoApi, DeviceVerificationStatus } from "matrix-js-sdk/src/crypto-api";
import { SdkContextClass } from "../../../src/contexts/SDKContext";
@ -97,28 +96,6 @@ describe("SetupEncryptionStore", () => {
expect(setupEncryptionStore.hasDevicesToVerifyAgainst).toBe(true);
});
it("should ignore the MSC2697 dehydrated device", async () => {
mockSecretStorage.isStored.mockResolvedValue({ sskeyid: {} as SecretStorageKeyDescriptionAesV1 });
client.getDehydratedDevice.mockResolvedValue({ device_id: "dehydrated" } as IDehydratedDevice);
const fakeDevice = new Device({
deviceId: "dehydrated",
userId: "",
algorithms: [],
keys: new Map([["curve25519:dehydrated", "identityKey"]]),
});
mockCrypto.getUserDeviceInfo.mockResolvedValue(
new Map([[client.getSafeUserId(), new Map([[fakeDevice.deviceId, fakeDevice]])]]),
);
setupEncryptionStore.start();
await emitPromise(setupEncryptionStore, "update");
expect(setupEncryptionStore.hasDevicesToVerifyAgainst).toBe(false);
expect(mockCrypto.getDeviceVerificationStatus).not.toHaveBeenCalled();
});
it("should ignore the MSC3812 dehydrated device", async () => {
mockSecretStorage.isStored.mockResolvedValue({ sskeyid: {} as SecretStorageKeyDescriptionAesV1 });