1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Fix CryptoApi#getVerificationRequestsToDeviceInProgress (#3611)

This commit is contained in:
Florian Duros
2023-07-20 11:46:55 +02:00
committed by GitHub
parent 7dffd8ffd3
commit ecef9fd755
2 changed files with 9 additions and 1 deletions

View File

@@ -164,6 +164,14 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("verification (%s)", (backend: st
expect(requests[0].transactionId).toEqual(transactionId);
}
// check that the returned request depends on the given userID
{
const requests = aliceClient
.getCrypto()!
.getVerificationRequestsToDeviceInProgress("@unknown:localhost");
expect(requests.length).toEqual(0);
}
let toDeviceMessage = requestBody.messages[TEST_USER_ID][TEST_DEVICE_ID];
expect(toDeviceMessage.from_device).toEqual(aliceClient.deviceId);
expect(toDeviceMessage.transaction_id).toEqual(transactionId);

View File

@@ -575,7 +575,7 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv
*/
public getVerificationRequestsToDeviceInProgress(userId: string): VerificationRequest[] {
const requests: RustSdkCryptoJs.VerificationRequest[] = this.olmMachine.getVerificationRequests(
new RustSdkCryptoJs.UserId(this.userId),
new RustSdkCryptoJs.UserId(userId),
);
return requests
.filter((request) => request.roomId === undefined)