mirror of
https://github.com/element-hq/element-web
synced 2024-11-21 16:55:34 +03:00
Replace MatrixClient.userHasCrossSigningKeys
by MatrixClient.getCrypto.userHasCrossSigningKeys
(#148)
This commit is contained in:
parent
07506253f9
commit
503d9004d1
2 changed files with 9 additions and 9 deletions
|
@ -426,7 +426,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
// from another device.
|
||||
promisesList.push(
|
||||
(async (): Promise<void> => {
|
||||
crossSigningIsSetUp = await cli.userHasCrossSigningKeys();
|
||||
crossSigningIsSetUp = Boolean(await cli.getCrypto()?.userHasCrossSigningKeys());
|
||||
})(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,6 @@ describe("<MatrixChat />", () => {
|
|||
}),
|
||||
getVisibleRooms: jest.fn().mockReturnValue([]),
|
||||
getRooms: jest.fn().mockReturnValue([]),
|
||||
userHasCrossSigningKeys: jest.fn(),
|
||||
setGlobalBlacklistUnverifiedDevices: jest.fn(),
|
||||
setGlobalErrorOnUnknownDevices: jest.fn(),
|
||||
getCrypto: jest.fn().mockReturnValue({
|
||||
|
@ -136,6 +135,7 @@ describe("<MatrixChat />", () => {
|
|||
getUserVerificationStatus: jest.fn().mockResolvedValue(new UserVerificationStatus(false, false, false)),
|
||||
getVersion: jest.fn().mockReturnValue("1"),
|
||||
setDeviceIsolationMode: jest.fn(),
|
||||
userHasCrossSigningKeys: jest.fn(),
|
||||
}),
|
||||
// This needs to not finish immediately because we need to test the screen appears
|
||||
bootstrapCrossSigning: jest.fn().mockImplementation(() => bootstrapDeferred.promise),
|
||||
|
@ -1010,10 +1010,10 @@ describe("<MatrixChat />", () => {
|
|||
.fn()
|
||||
.mockResolvedValue(new UserVerificationStatus(false, false, false)),
|
||||
setDeviceIsolationMode: jest.fn(),
|
||||
userHasCrossSigningKeys: jest.fn().mockResolvedValue(false),
|
||||
};
|
||||
loginClient.isCryptoEnabled.mockReturnValue(true);
|
||||
loginClient.getCrypto.mockReturnValue(mockCrypto as any);
|
||||
loginClient.userHasCrossSigningKeys.mockClear().mockResolvedValue(false);
|
||||
});
|
||||
|
||||
it("should go straight to logged in view when crypto is not enabled", async () => {
|
||||
|
@ -1021,7 +1021,7 @@ describe("<MatrixChat />", () => {
|
|||
|
||||
await getComponentAndLogin(true);
|
||||
|
||||
expect(loginClient.userHasCrossSigningKeys).not.toHaveBeenCalled();
|
||||
expect(loginClient.getCrypto()!.userHasCrossSigningKeys).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should go straight to logged in view when user does not have cross signing keys and server does not support cross signing", async () => {
|
||||
|
@ -1042,7 +1042,7 @@ describe("<MatrixChat />", () => {
|
|||
describe("when server supports cross signing and user does not have cross signing setup", () => {
|
||||
beforeEach(() => {
|
||||
loginClient.doesServerSupportUnstableFeature.mockResolvedValue(true);
|
||||
loginClient.userHasCrossSigningKeys.mockResolvedValue(false);
|
||||
jest.spyOn(loginClient.getCrypto()!, "userHasCrossSigningKeys").mockResolvedValue(false);
|
||||
});
|
||||
|
||||
describe("when encryption is force disabled", () => {
|
||||
|
@ -1088,7 +1088,7 @@ describe("<MatrixChat />", () => {
|
|||
|
||||
await getComponentAndLogin();
|
||||
|
||||
expect(loginClient.userHasCrossSigningKeys).toHaveBeenCalled();
|
||||
expect(loginClient.getCrypto()!.userHasCrossSigningKeys).toHaveBeenCalled();
|
||||
|
||||
// set up keys screen is rendered
|
||||
await expect(await screen.findByText("Setting up keys")).toBeInTheDocument();
|
||||
|
@ -1096,11 +1096,11 @@ describe("<MatrixChat />", () => {
|
|||
});
|
||||
|
||||
it("should show complete security screen when user has cross signing setup", async () => {
|
||||
loginClient.userHasCrossSigningKeys.mockResolvedValue(true);
|
||||
jest.spyOn(loginClient.getCrypto()!, "userHasCrossSigningKeys").mockResolvedValue(true);
|
||||
|
||||
await getComponentAndLogin();
|
||||
|
||||
expect(loginClient.userHasCrossSigningKeys).toHaveBeenCalled();
|
||||
expect(loginClient.getCrypto()!.userHasCrossSigningKeys).toHaveBeenCalled();
|
||||
|
||||
await flushPromises();
|
||||
|
||||
|
@ -1113,7 +1113,7 @@ describe("<MatrixChat />", () => {
|
|||
|
||||
await getComponentAndLogin();
|
||||
|
||||
expect(loginClient.userHasCrossSigningKeys).toHaveBeenCalled();
|
||||
expect(loginClient.getCrypto()!.userHasCrossSigningKeys).toHaveBeenCalled();
|
||||
|
||||
await flushPromises();
|
||||
|
||||
|
|
Loading…
Reference in a new issue