Skip to content

Commit

Permalink
Fix CryptoApi#getVerificationRequestsToDeviceInProgress (#3611)
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros authored Jul 20, 2023
1 parent 7dffd8f commit ecef9fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spec/integ/crypto/verification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/rust-crypto/rust-crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ecef9fd

Please sign in to comment.