From c21dccc397860d288e181c2df91712c619a31f68 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 7 Apr 2020 19:11:06 +0100 Subject: [PATCH 1/2] Add debug status for cached backup key format Check backup key format to ease tracking such issues Debug helper for https://github.com/vector-im/riot-web/issues/13057 --- .../views/settings/CrossSigningPanel.js | 21 +++++++++++++++++-- src/i18n/strings/en_EN.json | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/views/settings/CrossSigningPanel.js b/src/components/views/settings/CrossSigningPanel.js index 2217a0f2ee..cb04d2a018 100644 --- a/src/components/views/settings/CrossSigningPanel.js +++ b/src/components/views/settings/CrossSigningPanel.js @@ -81,7 +81,9 @@ export default class CrossSigningPanel extends React.PureComponent { const crossSigningPrivateKeysInStorage = await crossSigning.isStoredInSecretStorage(secretStorage); const selfSigningPrivateKeyCached = !!(pkCache && await pkCache.getCrossSigningKeyCache("self_signing")); const userSigningPrivateKeyCached = !!(pkCache && await pkCache.getCrossSigningKeyCache("user_signing")); - const sessionBackupKeyCached = !!(await cli._crypto.getSessionBackupPrivateKey()); + const sessionBackupKeyFromCache = await cli._crypto.getSessionBackupPrivateKey(); + const sessionBackupKeyCached = !!(sessionBackupKeyFromCache); + const sessionBackupKeyWellFormed = sessionBackupKeyFromCache instanceof Uint8Array; const secretStorageKeyInAccount = await secretStorage.hasKey(); const homeserverSupportsCrossSigning = await cli.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing"); @@ -94,6 +96,7 @@ export default class CrossSigningPanel extends React.PureComponent { selfSigningPrivateKeyCached, userSigningPrivateKeyCached, sessionBackupKeyCached, + sessionBackupKeyWellFormed, secretStorageKeyInAccount, homeserverSupportsCrossSigning, crossSigningReady, @@ -143,6 +146,7 @@ export default class CrossSigningPanel extends React.PureComponent { selfSigningPrivateKeyCached, userSigningPrivateKeyCached, sessionBackupKeyCached, + sessionBackupKeyWellFormed, secretStorageKeyInAccount, homeserverSupportsCrossSigning, crossSigningReady, @@ -208,6 +212,16 @@ export default class CrossSigningPanel extends React.PureComponent { ); } + let sessionBackupKeyWellFormedText = ""; + if (sessionBackupKeyCached) { + sessionBackupKeyWellFormedText = ", "; + if (sessionBackupKeyWellFormed) { + sessionBackupKeyWellFormedText += _t("well formed"); + } else { + sessionBackupKeyWellFormedText += _t("unexpected type"); + } + } + return (
{summarisedStatus} @@ -232,7 +246,10 @@ export default class CrossSigningPanel extends React.PureComponent { {_t("Session backup key:")} - {sessionBackupKeyCached ? _t("cached locally") : _t("not found locally")} + + {sessionBackupKeyCached ? _t("cached locally") : _t("not found locally")} + {sessionBackupKeyWellFormedText} + {_t("Secret storage public key:")} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index b7ad92757a..3336c50472 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -601,6 +601,8 @@ "not found locally": "not found locally", "User signing private key:": "User signing private key:", "Session backup key:": "Session backup key:", + "well formed": "well formed", + "unexpected type": "unexpected type", "Secret storage public key:": "Secret storage public key:", "in account data": "in account data", "Homeserver feature support:": "Homeserver feature support:", From 3196c1a0315446cebf5c236b9aa09857529766f0 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 7 Apr 2020 19:24:07 +0100 Subject: [PATCH 2/2] Update i18n --- src/i18n/strings/en_EN.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 3336c50472..82e87c3ac6 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -591,6 +591,8 @@ "Cross-signing and secret storage are not yet set up.": "Cross-signing and secret storage are not yet set up.", "Reset cross-signing and secret storage": "Reset cross-signing and secret storage", "Bootstrap cross-signing and secret storage": "Bootstrap cross-signing and secret storage", + "well formed": "well formed", + "unexpected type": "unexpected type", "Cross-signing public keys:": "Cross-signing public keys:", "in memory": "in memory", "not found": "not found", @@ -601,8 +603,6 @@ "not found locally": "not found locally", "User signing private key:": "User signing private key:", "Session backup key:": "Session backup key:", - "well formed": "well formed", - "unexpected type": "unexpected type", "Secret storage public key:": "Secret storage public key:", "in account data": "in account data", "Homeserver feature support:": "Homeserver feature support:",