Kill off references to deprecated getStoredDevice and getStoredDevicesForUser (#11152)

* Use new `CryptoEvent.VerificationRequestReceived` event

https://github.com/matrix-org/matrix-js-sdk/pull/3514 deprecates
`CryptoEvent.VerificationRequest` in favour of
`CryptoEvent.VerificationRequestReceived`. Use the new event.

* Factor out `getDeviceCryptoInfo` function

I seem to be writing this logic several times, so let's factor it out.

* Factor out `getUserDeviceIds` function

Another utility function

* VerificationRequestToast: `getStoredDevice` -> `getDeviceCryptoInfo`

* SlashCommands: `getStoredDevice` -> `getDeviceCryptoInfo`

* MemberTile: `getStoredDevicesForUser` -> `getUserDeviceIds`

* Remove redundant mock of `getStoredDevicesForUser`
This commit is contained in:
Richard van der Hoff 2023-06-28 13:39:34 +01:00 committed by GitHub
parent 0a3a111327
commit 46eb34a55d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 189 additions and 34 deletions

View file

@ -34,6 +34,7 @@ import DisambiguatedProfile from "../messages/DisambiguatedProfile";
import UserIdentifierCustomisations from "../../../customisations/UserIdentifier";
import { E2EState } from "./E2EIcon";
import { asyncSome } from "../../../utils/arrays";
import { getUserDeviceIds } from "../../../utils/crypto/deviceInfo";
interface IProps {
member: RoomMember;
@ -127,9 +128,8 @@ export default class MemberTile extends React.Component<IProps, IState> {
return;
}
const devices = cli.getStoredDevicesForUser(userId);
const anyDeviceUnverified = await asyncSome(devices, async (device) => {
const { deviceId } = device;
const deviceIDs = await getUserDeviceIds(cli, userId);
const anyDeviceUnverified = await asyncSome(deviceIDs, async (deviceId) => {
// For your own devices, we use the stricter check of cross-signing
// verification to encourage everyone to trust their own devices via
// cross-signing so that other users can then safely trust you.