mirror of
https://github.com/element-hq/element-web
synced 2024-11-25 10:45:51 +03:00
Merge pull request #4263 from matrix-org/dbkr/unify_cross_signing_checks
Use unified function to check cross-signing is ready
This commit is contained in:
commit
b5ea91f44c
2 changed files with 12 additions and 4 deletions
|
@ -116,7 +116,10 @@ export default class DeviceListener {
|
||||||
) return;
|
) return;
|
||||||
|
|
||||||
if (!cli.isCryptoEnabled()) return;
|
if (!cli.isCryptoEnabled()) return;
|
||||||
if (!cli.getCrossSigningId()) {
|
|
||||||
|
const crossSigningReady = await cli.isCrossSigningReady();
|
||||||
|
|
||||||
|
if (!crossSigningReady) {
|
||||||
if (this._dismissedThisDeviceToast) {
|
if (this._dismissedThisDeviceToast) {
|
||||||
ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY);
|
ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -70,7 +70,6 @@ export default class CrossSigningPanel extends React.PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
async _getUpdatedStatus() {
|
async _getUpdatedStatus() {
|
||||||
// XXX: Add public accessors if we keep this around in production
|
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
const crossSigning = cli._crypto._crossSigningInfo;
|
const crossSigning = cli._crypto._crossSigningInfo;
|
||||||
const secretStorage = cli._crypto._secretStorage;
|
const secretStorage = cli._crypto._secretStorage;
|
||||||
|
@ -79,6 +78,7 @@ export default class CrossSigningPanel extends React.PureComponent {
|
||||||
const secretStorageKeyInAccount = await secretStorage.hasKey();
|
const secretStorageKeyInAccount = await secretStorage.hasKey();
|
||||||
const homeserverSupportsCrossSigning =
|
const homeserverSupportsCrossSigning =
|
||||||
await cli.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing");
|
await cli.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing");
|
||||||
|
const crossSigningReady = await cli.isCrossSigningReady();
|
||||||
const secretStorageKeyNeedsUpgrade = await cli.secretStorageKeyNeedsUpgrade();
|
const secretStorageKeyNeedsUpgrade = await cli.secretStorageKeyNeedsUpgrade();
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -86,6 +86,7 @@ export default class CrossSigningPanel extends React.PureComponent {
|
||||||
crossSigningPrivateKeysInStorage,
|
crossSigningPrivateKeysInStorage,
|
||||||
secretStorageKeyInAccount,
|
secretStorageKeyInAccount,
|
||||||
homeserverSupportsCrossSigning,
|
homeserverSupportsCrossSigning,
|
||||||
|
crossSigningReady,
|
||||||
secretStorageKeyNeedsUpgrade,
|
secretStorageKeyNeedsUpgrade,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -131,6 +132,7 @@ export default class CrossSigningPanel extends React.PureComponent {
|
||||||
crossSigningPrivateKeysInStorage,
|
crossSigningPrivateKeysInStorage,
|
||||||
secretStorageKeyInAccount,
|
secretStorageKeyInAccount,
|
||||||
homeserverSupportsCrossSigning,
|
homeserverSupportsCrossSigning,
|
||||||
|
crossSigningReady,
|
||||||
secretStorageKeyNeedsUpgrade,
|
secretStorageKeyNeedsUpgrade,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
|
@ -147,11 +149,14 @@ export default class CrossSigningPanel extends React.PureComponent {
|
||||||
);
|
);
|
||||||
|
|
||||||
let summarisedStatus;
|
let summarisedStatus;
|
||||||
if (!homeserverSupportsCrossSigning) {
|
if (homeserverSupportsCrossSigning === undefined) {
|
||||||
|
const InlineSpinner = sdk.getComponent('views.elements.InlineSpinner');
|
||||||
|
summarisedStatus = <p><InlineSpinner /></p>;
|
||||||
|
} else if (!homeserverSupportsCrossSigning) {
|
||||||
summarisedStatus = <p>{_t(
|
summarisedStatus = <p>{_t(
|
||||||
"Your homeserver does not support cross-signing.",
|
"Your homeserver does not support cross-signing.",
|
||||||
)}</p>;
|
)}</p>;
|
||||||
} else if (enabledForAccount && crossSigningPublicKeysOnDevice) {
|
} else if (crossSigningReady) {
|
||||||
summarisedStatus = <p>✅ {_t(
|
summarisedStatus = <p>✅ {_t(
|
||||||
"Cross-signing and secret storage are enabled.",
|
"Cross-signing and secret storage are enabled.",
|
||||||
)}</p>;
|
)}</p>;
|
||||||
|
|
Loading…
Reference in a new issue