Skip to content

Commit

Permalink
Merge #2549
Browse files Browse the repository at this point in the history
...onto group call branch

This commit just has the merge with encryptAndSendKeysToDevices
converted, but not other calls yet.
  • Loading branch information
dbkr committed Jul 29, 2022
1 parent b711781 commit a2ac707
Show file tree
Hide file tree
Showing 17 changed files with 754 additions and 72 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"jest-localstorage-mock": "^2.4.6",
"jest-sonar-reporter": "^2.0.0",
"jsdoc": "^3.6.6",
"matrix-mock-request": "^2.1.0",
"matrix-mock-request": "^2.1.1",
"rimraf": "^3.0.2",
"terser": "^5.5.1",
"tsify": "^5.0.2",
Expand Down
9 changes: 6 additions & 3 deletions spec/unit/crypto/algorithms/megolm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe("MegolmDecryption", function() {
mockBaseApis = {
claimOneTimeKeys: jest.fn(),
sendToDevice: jest.fn(),
queueToDevice: jest.fn(),
} as unknown as MockedObject<MatrixClient>;

const cryptoStore = new MemoryCryptoStore();
Expand Down Expand Up @@ -179,6 +180,7 @@ describe("MegolmDecryption", function() {
});

mockBaseApis.sendToDevice.mockReset();
mockBaseApis.queueToDevice.mockReset();

// do the share
megolmDecryption.shareKeysWithDevice(keyRequest);
Expand Down Expand Up @@ -324,6 +326,7 @@ describe("MegolmDecryption", function() {
},
});
mockBaseApis.sendToDevice.mockResolvedValue(undefined);
mockBaseApis.queueToDevice.mockResolvedValue(undefined);

aliceDeviceInfo = {
deviceId: 'aliceDevice',
Expand Down Expand Up @@ -410,7 +413,7 @@ describe("MegolmDecryption", function() {
expect(mockCrypto.downloadKeys).toHaveBeenCalledWith(
['@alice:home.server'], false,
);
expect(mockBaseApis.sendToDevice).toHaveBeenCalled();
expect(mockBaseApis.queueToDevice).toHaveBeenCalled();
expect(mockBaseApis.claimOneTimeKeys).toHaveBeenCalledWith(
[['@alice:home.server', 'aliceDevice']], 'signed_curve25519', 2000,
);
Expand Down Expand Up @@ -453,15 +456,15 @@ describe("MegolmDecryption", function() {
'YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWI',
);

mockBaseApis.sendToDevice.mockClear();
mockBaseApis.queueToDevice.mockClear();
await megolmEncryption.reshareKeyWithDevice(
olmDevice.deviceCurve25519Key,
ct1.session_id,
'@alice:home.server',
aliceDeviceInfo,
);

expect(mockBaseApis.sendToDevice).not.toHaveBeenCalled();
expect(mockBaseApis.queueToDevice).not.toHaveBeenCalled();
});
});
});
Expand Down
Loading

0 comments on commit a2ac707

Please sign in to comment.