Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 42e6c98

Browse files
authored
Replace remaining use of checkDeviceTrust (#10716)
* Fix remaing use of `checkDeviceTrust` Followup to #10663 * fix strict type-checking error
1 parent e8cddca commit 42e6c98

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/stores/SetupEncryptionStore.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import Modal from "../Modal";
3131
import InteractiveAuthDialog from "../components/views/dialogs/InteractiveAuthDialog";
3232
import { _t } from "../languageHandler";
3333
import { SdkContextClass } from "../contexts/SDKContext";
34+
import { asyncSome } from "../utils/arrays";
3435

3536
export enum Phase {
3637
Loading = 0,
@@ -108,20 +109,12 @@ export class SetupEncryptionStore extends EventEmitter {
108109
// do we have any other verified devices which are E2EE which we can verify against?
109110
const dehydratedDevice = await cli.getDehydratedDevice();
110111
const ownUserId = cli.getUserId()!;
111-
const crossSigningInfo = cli.getStoredCrossSigningForUser(ownUserId);
112-
this.hasDevicesToVerifyAgainst = cli.getStoredDevicesForUser(ownUserId).some((device) => {
112+
this.hasDevicesToVerifyAgainst = await asyncSome(cli.getStoredDevicesForUser(ownUserId), async (device) => {
113113
if (!device.getIdentityKey() || (dehydratedDevice && device.deviceId == dehydratedDevice?.device_id)) {
114114
return false;
115115
}
116-
// check if the device is signed by the cross-signing key stored for our user. Note that this is
117-
// *different* to calling `cryptoApi.getDeviceVerificationStatus`, because even if we have stored
118-
// a cross-signing key for our user, we don't necessarily trust it yet (In legacy Crypto, we have not
119-
// yet imported it into `Crypto.crossSigningInfo`, which for maximal confusion is a different object to
120-
// `Crypto.getStoredCrossSigningForUser(ownUserId)`).
121-
//
122-
// TODO: figure out wtf to to here for rust-crypto
123-
const verificationStatus = crossSigningInfo?.checkDeviceTrust(crossSigningInfo, device, false, true);
124-
return !!verificationStatus?.isCrossSigningVerified();
116+
const verificationStatus = await cli.getCrypto()?.getDeviceVerificationStatus(ownUserId, device.deviceId);
117+
return !!verificationStatus?.signedByOwner;
125118
});
126119

127120
this.phase = Phase.Intro;

0 commit comments

Comments
 (0)