From a233af67eab6f15bc2a1743976e9f0966f3e897c Mon Sep 17 00:00:00 2001
From: Matthew Hodgson
Date: Mon, 15 Jan 2018 02:02:48 +0000
Subject: [PATCH 001/218] initial pseudocode WIP for e2e online backups
---
src/SuggestKeyRestoreHandler.js | 96 +++++++++++++++++++
src/components/structures/MatrixChat.js | 6 ++
.../views/dialogs/SuggestKeyBackupDialog.js | 68 +++++++++++++
.../views/dialogs/SuggestKeyRestoreDialog.js | 77 +++++++++++++++
4 files changed, 247 insertions(+)
create mode 100644 src/SuggestKeyRestoreHandler.js
create mode 100644 src/components/views/dialogs/SuggestKeyBackupDialog.js
create mode 100644 src/components/views/dialogs/SuggestKeyRestoreDialog.js
diff --git a/src/SuggestKeyRestoreHandler.js b/src/SuggestKeyRestoreHandler.js
new file mode 100644
index 0000000000..3383889c1e
--- /dev/null
+++ b/src/SuggestKeyRestoreHandler.js
@@ -0,0 +1,96 @@
+/*
+Copyright 2018 New Vector Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import sdk from './index';
+import Modal from './Modal';
+
+export default class SuggestKeyRestoreHandler {
+ constructor(matrixClient) {
+ this._matrixClient = matrixClient;
+ }
+
+ handleSuggestKeyRestore() {
+ const onVerifyDevice = () => {
+ const DeviceVerifyDialog = sdk.getComponent('views.dialogs.DeviceVerifyDialog');
+
+ Modal.createTrackedDialog('Key Restore', 'Starting verification', DeviceVerifyDialog, {
+ // userId: this.props.userId,
+ // device: this.state.deviceInfo,
+ onFinished: (verified) => {
+ if (verified) {
+ this.props.onFinished();
+ }
+ },
+ });
+ };
+
+ const onRecoverFromBackup = () => {
+ // XXX: we need this so that you can get at it from UserSettings too
+ // * prompt for recovery key
+ // * Download the current backup version info from the server and check the key decrypts it okay.
+ // * Check that the public key for that backup version matches the recovery key
+ // * show a spinner
+ // * Download all the existing keys from the server
+ // * Decrypt them using the recovery key
+ // * Add them to the local store (which encrypts them as normal with "DEFAULT KEY"
+ // * Enable incremental backups for this device.
+ };
+
+ const onIgnoreSuggestion = () => {
+ };
+
+ const onFinished = () => {
+ this.suggestBackup();
+ };
+
+ // FIXME: need a way to know if an account has ever touched E2E before.
+ // Perhaps we can extend toDevice to include a flag if it's the first time the
+ // server has ever sent a room_key to a client or something?
+ const virginAccount = false;
+
+ if (virginAccount) {
+ this.suggestBackup();
+ return;
+ }
+
+ const SuggestKeyRestoreDialog = sdk.getComponent("dialogs.SuggestKeyRestoreDialog");
+ Modal.createTrackedDialog('Key Restore', 'Key Restore', SuggestKeyRestoreDialog, {
+ matrixClient: this._matrixClient,
+ isOnlyDevice: false, // FIXME
+ hasOnlineBackup: false, // FIXME
+ onVerifyDevice: onVerifyDevice,
+ onRecoverFromBackup: onRecoverFromBackup,
+ onIgnoreSuggestion: onIgnoreSuggestion,
+ onFinished: onFinished,
+ });
+ }
+
+ suggestBackup() {
+ if (hasOnlineBackup) return;
+
+ const onStartNewBackup = () => {
+ // XXX: we need this so that you can get at it from UserSettings too
+ // * Upload all their existing keys from their session store to the backup using the bulk upload API.
+ // (Having re-encrypted them using the backup keypair rather than the static one used to store them on disk)
+ };
+
+ const SuggestKeyBackupDialog = sdk.getComponent("dialogs.SuggestKeyBackupDialog");
+ Modal.createTrackedDialog('Key Backup', 'Key Backup', SuggestKeyBackupDialog, {
+ onStartNewBackup: onStartNewBackup,
+ });
+ }
+}
+
diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 733007677b..4b04f4cf1d 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -1129,6 +1129,12 @@ export default React.createClass({
cli.on("crypto.roomKeyRequestCancellation", (req) => {
krh.handleKeyRequestCancellation(req);
});
+
+ const skrh = new SuggestKeyRestoreHandler(cli);
+ cli.on("crypto.suggestKeyRestore", () => {
+ skrh.handleSuggestKeyRestore();
+ });
+
cli.on("Room", (room) => {
if (MatrixClientPeg.get().isCryptoEnabled()) {
const blacklistEnabled = SettingsStore.getValueAt(
diff --git a/src/components/views/dialogs/SuggestKeyBackupDialog.js b/src/components/views/dialogs/SuggestKeyBackupDialog.js
new file mode 100644
index 0000000000..c2d6cfc60f
--- /dev/null
+++ b/src/components/views/dialogs/SuggestKeyBackupDialog.js
@@ -0,0 +1,68 @@
+/*
+Copyright 2018 New Vector Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import Modal from '../../../Modal';
+import React from 'react';
+import PropTypes from 'prop-types';
+import sdk from '../../../index';
+
+import { _t, _td } from '../../../languageHandler';
+
+/**
+ * Dialog which asks the user whether they want to restore megolm keys
+ * from various sources when they first start using E2E on a new device.
+ */
+export default React.createClass({
+ propTypes: {
+ onStartNewBackup: PropTypes.func.isRequired,
+ },
+
+ render: function() {
+ const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
+
+ return (
+
+
+
To avoid ever losing your encrypted message history, you
+ can save your encryption keys on the server, protected by a recovery key.
+
+
To maximise security, your recovery key is never stored by the app,
+ so you must store it yourself somewhere safe.
+
+
Warning: storing your encryption keys on the server means that
+ if someone gains access to your account and also steals your recovery key,
+ they will be able to read all of your encrypted conversation history.
+
+
+
Do you wish to generate a recovery key and backup your encryption
+ keys on the server?
+
+
+
+
+
+
+
+ );
+ },
+});
diff --git a/src/components/views/dialogs/SuggestKeyRestoreDialog.js b/src/components/views/dialogs/SuggestKeyRestoreDialog.js
new file mode 100644
index 0000000000..2a711e0231
--- /dev/null
+++ b/src/components/views/dialogs/SuggestKeyRestoreDialog.js
@@ -0,0 +1,77 @@
+/*
+Copyright 2018 New Vector Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import Modal from '../../../Modal';
+import React from 'react';
+import PropTypes from 'prop-types';
+import sdk from '../../../index';
+
+import { _t, _td } from '../../../languageHandler';
+
+/**
+ * Dialog which asks the user whether they want to restore megolm keys
+ * from various sources when they first start using E2E on a new device.
+ */
+export default React.createClass({
+ propTypes: {
+ matrixClient: PropTypes.object.isRequired,
+ isOnlyDevice: PropTypes.bool.isRequired,
+ hasOnlineBackup: PropTypes.bool.isRequired,
+ onVerifyDevice: PropTypes.func.isRequired,
+ onImportBackup: PropTypes.func.isRequired,
+ onRecoverFromBackup: PropTypes.func.isRequired,
+ onIgnoreSuggestion: PropTypes.func.isRequired,
+ },
+
+ render: function() {
+ const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
+
+ return (
+
+
+
We don't have a way to decrypt older messages on this device.
+
+
Your options are:
+
+
+ { !this.props.isOnlyDevice ?
Verify this device from one or more of your other ones to automatically sync keys
: '' }
+ { this.props.hasOnlineBackup ?
Enter your recovery key to restore encryption keys from your online backup
: '' }
+
Import encryption keys from an offline backup
+
Continue without restoring keys, syncing keys from your other devices on a best effort basis
We don't have a way to decrypt older messages on this device.
+
+
We don't have a way to decrypt older messages on this device.
-
Your options are:
+
Your options are:
-
- { !this.props.isOnlyDevice ?
Verify this device from one or more of your other ones to automatically sync keys
: '' }
- { this.props.hasOnlineBackup ?
Enter your recovery key to restore encryption keys from your online backup
: '' }
-
Import encryption keys from an offline backup
-
Continue without restoring keys, syncing keys from your other devices on a best effort basis
-
+
+ { !this.props.isOnlyDevice ?
Verify this device from one or more of your other ones to automatically sync keys
: '' }
+ { this.props.hasOnlineBackup ?
Enter your recovery key to restore encryption keys from your online backup
: '' }
+
Import encryption keys from an offline backup
+
Continue without restoring keys, syncing keys from your other devices on a best effort basis
+
-
-
-
-
-
+
+
+
+
+
+
-
);
},
From 52cdf609540f1883abfec9bb3998f330fa2e5bf0 Mon Sep 17 00:00:00 2001
From: Travis Ralston
Date: Sat, 26 May 2018 20:27:48 -0600
Subject: [PATCH 003/218] Add options to pin unread/mentioned rooms to the top
of the room list
Fixes https://github.com/vector-im/riot-web/issues/6604
Fixes https://github.com/vector-im/riot-web/issues/732
Fixes https://github.com/vector-im/riot-web/issues/1104
Signed-off-by: Travis Ralston
---
src/components/structures/RoomSubList.js | 21 ++++++++++++++++++++-
src/components/structures/UserSettings.js | 2 ++
src/i18n/strings/en_EN.json | 2 ++
src/settings/Settings.js | 10 ++++++++++
4 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js
index fb82ee067b..b3c9d5f1b6 100644
--- a/src/components/structures/RoomSubList.js
+++ b/src/components/structures/RoomSubList.js
@@ -17,6 +17,8 @@ limitations under the License.
'use strict';
+import SettingsStore from "../../settings/SettingsStore";
+
var React = require('react');
var ReactDOM = require('react-dom');
var classNames = require('classnames');
@@ -98,8 +100,10 @@ var RoomSubList = React.createClass({
componentWillReceiveProps: function(newProps) {
// order the room list appropriately before we re-render
//if (debug) console.log("received new props, list = " + newProps.list);
+ const filteredRooms = this.applySearchFilter(newProps.list, newProps.searchFilter);
+ const sortedRooms = newProps.order === "recent" ? this.applyPinnedTileRules(filteredRooms) : filteredRooms;
this.setState({
- sortedList: this.applySearchFilter(newProps.list, newProps.searchFilter),
+ sortedList: sortedRooms,
});
},
@@ -110,6 +114,21 @@ var RoomSubList = React.createClass({
});
},
+ applyPinnedTileRules: function(list) {
+ const pinUnread = SettingsStore.getValue("pinUnreadRooms");
+ const pinMentioned = SettingsStore.getValue("pinMentionedRooms");
+ if (!pinUnread && !pinMentioned) {
+ return list; // Nothing to sort
+ }
+
+ const mentioned = !pinMentioned ? [] : list.filter(room => room.getUnreadNotificationCount("highlight") > 0);
+ const unread = !pinUnread ? [] : list.filter(room => Unread.doesRoomHaveUnreadMessages(room));
+
+ return mentioned
+ .concat(unread.filter(room => !mentioned.find(other => other === room)))
+ .concat(list.filter(room => !unread.find(other => other === room)));
+ },
+
// The header is collapsable if it is hidden or not stuck
// The dataset elements are added in the RoomList _initAndPositionStickyHeaders method
isCollapsableOnClick: function() {
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index c8ce79905d..3695e0cf9f 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -81,6 +81,8 @@ const SIMPLE_SETTINGS = [
{ id: "VideoView.flipVideoHorizontally" },
{ id: "TagPanel.disableTagPanel" },
{ id: "enableWidgetScreenshots" },
+ { id: "pinMentionedRooms" },
+ { id: "pinUnreadRooms" },
];
// These settings must be defined in SettingsStore
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index bf9e395bee..1b378c34d3 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -218,6 +218,8 @@
"Enable URL previews for this room (only affects you)": "Enable URL previews for this room (only affects you)",
"Enable URL previews by default for participants in this room": "Enable URL previews by default for participants in this room",
"Room Colour": "Room Colour",
+ "Pin unread rooms to the top of the room list": "Pin unread rooms to the top of the room list",
+ "Pin rooms I'm mentioned in to the top of the room list": "Pin rooms I'm mentioned in to the top of the room list",
"Enable widget screenshots on supported widgets": "Enable widget screenshots on supported widgets",
"Collecting app version information": "Collecting app version information",
"Collecting logs": "Collecting logs",
diff --git a/src/settings/Settings.js b/src/settings/Settings.js
index b1bc4161fd..1665a59dfd 100644
--- a/src/settings/Settings.js
+++ b/src/settings/Settings.js
@@ -269,6 +269,16 @@ export const SETTINGS = {
default: true,
controller: new AudioNotificationsEnabledController(),
},
+ "pinMentionedRooms": {
+ supportedLevels: LEVELS_ACCOUNT_SETTINGS,
+ displayName: _td("Pin rooms I'm mentioned in to the top of the room list"),
+ default: false,
+ },
+ "pinUnreadRooms": {
+ supportedLevels: LEVELS_ACCOUNT_SETTINGS,
+ displayName: _td("Pin unread rooms to the top of the room list"),
+ default: false,
+ },
"enableWidgetScreenshots": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Enable widget screenshots on supported widgets'),
From 292b1f09af60b294a1a73cb512339cbc3179ad6d Mon Sep 17 00:00:00 2001
From: David Baker
Date: Thu, 13 Sep 2018 17:11:46 +0100
Subject: [PATCH 004/218] WIP e2e key backups
Continues from Matthew's work: adds a feature flag & panel in
user settings to create a backup.
Can't restore a backup yet, nor even continue backing up to the same
backup after a refresh.
---
res/css/_components.scss | 1 +
.../views/dialogs/_CreateKeyBackupDialog.scss | 25 ++
src/components/structures/MatrixChat.js | 2 +
src/components/structures/UserSettings.js | 11 +
.../views/dialogs/SuggestKeyBackupDialog.js | 68 ------
.../keybackup/CreateKeyBackupDialog.js | 230 ++++++++++++++++++
.../views/settings/KeyBackupPanel.js | 134 ++++++++++
src/i18n/strings/en_EN.json | 33 +++
src/settings/Settings.js | 6 +
9 files changed, 442 insertions(+), 68 deletions(-)
create mode 100644 res/css/views/dialogs/_CreateKeyBackupDialog.scss
delete mode 100644 src/components/views/dialogs/SuggestKeyBackupDialog.js
create mode 100644 src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
create mode 100644 src/components/views/settings/KeyBackupPanel.js
diff --git a/res/css/_components.scss b/res/css/_components.scss
index 0e40b40a29..e8a8877d62 100644
--- a/res/css/_components.scss
+++ b/res/css/_components.scss
@@ -33,6 +33,7 @@
@import "./views/dialogs/_ChatInviteDialog.scss";
@import "./views/dialogs/_ConfirmUserActionDialog.scss";
@import "./views/dialogs/_CreateGroupDialog.scss";
+@import "./views/dialogs/_CreateKeyBackupDialog.scss";
@import "./views/dialogs/_CreateRoomDialog.scss";
@import "./views/dialogs/_DeactivateAccountDialog.scss";
@import "./views/dialogs/_DevtoolsDialog.scss";
diff --git a/res/css/views/dialogs/_CreateKeyBackupDialog.scss b/res/css/views/dialogs/_CreateKeyBackupDialog.scss
new file mode 100644
index 0000000000..a422cf858c
--- /dev/null
+++ b/res/css/views/dialogs/_CreateKeyBackupDialog.scss
@@ -0,0 +1,25 @@
+/*
+Copyright 2018 New Vector Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+.mx_CreateKeyBackupDialog {
+ padding-right: 40px;
+}
+
+.mx_CreateKeyBackupDialog_recoveryKey {
+ padding: 20px;
+ color: $info-plinth-fg-color;
+ background-color: $info-plinth-bg-color;
+}
diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 39e973e8f7..900cd57b90 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -48,6 +48,8 @@ import SettingsStore, {SettingLevel} from "../../settings/SettingsStore";
import { startAnyRegistrationFlow } from "../../Registration.js";
import { messageForSyncError } from '../../utils/ErrorUtils';
+import SuggestKeyRestoreHandler from "../../SuggestKeyRestoreHandler";
+
/** constants for MatrixChat.state.view */
const VIEWS = {
// a special initial state which is only used at startup, while we are
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index 53e1ddea71..b5cbf5bd89 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -736,6 +736,16 @@ module.exports = React.createClass({
);
}
+
+ let keyBackupSection;
+ if (SettingsStore.isFeatureEnabled("feature_keybackup")) {
+ const KeyBackupPanel = sdk.getComponent('views.settings.KeyBackupPanel');
+ keyBackupSection =
);
},
diff --git a/src/components/views/dialogs/SuggestKeyBackupDialog.js b/src/components/views/dialogs/SuggestKeyBackupDialog.js
deleted file mode 100644
index c2d6cfc60f..0000000000
--- a/src/components/views/dialogs/SuggestKeyBackupDialog.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-Copyright 2018 New Vector Ltd
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-import Modal from '../../../Modal';
-import React from 'react';
-import PropTypes from 'prop-types';
-import sdk from '../../../index';
-
-import { _t, _td } from '../../../languageHandler';
-
-/**
- * Dialog which asks the user whether they want to restore megolm keys
- * from various sources when they first start using E2E on a new device.
- */
-export default React.createClass({
- propTypes: {
- onStartNewBackup: PropTypes.func.isRequired,
- },
-
- render: function() {
- const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
-
- return (
-
-
-
To avoid ever losing your encrypted message history, you
- can save your encryption keys on the server, protected by a recovery key.
-
-
To maximise security, your recovery key is never stored by the app,
- so you must store it yourself somewhere safe.
-
-
Warning: storing your encryption keys on the server means that
- if someone gains access to your account and also steals your recovery key,
- they will be able to read all of your encrypted conversation history.
-
-
-
Do you wish to generate a recovery key and backup your encryption
- keys on the server?
-
-
-
-
-
-
-
- );
- },
-});
diff --git a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
new file mode 100644
index 0000000000..03410f4f7d
--- /dev/null
+++ b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
@@ -0,0 +1,230 @@
+/*
+Copyright 2018 New Vector Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import Modal from '../../../../Modal';
+import React from 'react';
+import PropTypes from 'prop-types';
+import sdk from '../../../../index';
+import MatrixClientPeg from '../../../../MatrixClientPeg';
+import { formatCryptoKey } from '../../../../utils/FormattingUtils';
+import Promise from 'bluebird';
+
+import { _t, _td } from '../../../../languageHandler';
+
+const PHASE_INTRO = 0;
+const PHASE_GENERATING = 1;
+const PHASE_SHOWKEY = 2;
+const PHASE_MAKEBACKUP = 3;
+const PHASE_UPLOAD = 4;
+const PHASE_DONE = 5;
+
+// XXX: copied from ShareDialog: factor out into utils
+function selectText(target) {
+ const range = document.createRange();
+ range.selectNodeContents(target);
+
+ const selection = window.getSelection();
+ selection.removeAllRanges();
+ selection.addRange(range);
+}
+
+/**
+ * Walks the user through the process of creating an e22 key backup
+ * on the server.
+ */
+export default React.createClass({
+ getInitialState: function() {
+ return {
+ phase: PHASE_INTRO,
+ };
+ },
+
+ componentWillMount: function() {
+ this._recoveryKeyNode = null;
+ this._keyBackupInfo = null;
+ },
+
+ _collectRecoveryKeyNode: function(n) {
+ this._recoveryKeyNode = n;
+ },
+
+ _copyRecoveryKey: function() {
+ selectText(this._recoveryKeyNode);
+ const successful = document.execCommand('copy');
+ if (successful) {
+ this.setState({copied: true});
+ }
+ },
+
+ _createBackup: function() {
+ this.setState({
+ phase: PHASE_MAKEBACKUP,
+ error: null,
+ });
+ this._createBackupPromise = MatrixClientPeg.get().createKeyBackupVersion(
+ this._keyBackupInfo,
+ ).then((info) => {
+ this.setState({
+ phase: PHASE_UPLOAD,
+ });
+ return MatrixClientPeg.get().backupAllGroupSessions(info.version);
+ }).then(() => {
+ this.setState({
+ phase: PHASE_DONE,
+ });
+ }).catch(e => {
+ console.log("Error creating key backup", e);
+ this.setState({
+ error: e,
+ });
+ });
+ },
+
+ _onCancel: function() {
+ this.props.onFinished(false);
+ },
+
+ _onDone: function() {
+ this.props.onFinished(true);
+ },
+
+ _generateKey: async function() {
+ this.setState({
+ phase: PHASE_GENERATING,
+ });
+ // Look, work is being done!
+ await Promise.delay(1200);
+ this._keyBackupInfo = MatrixClientPeg.get().prepareKeyBackupVersion();
+ this.setState({
+ phase: PHASE_SHOWKEY,
+ });
+ },
+
+ _renderPhaseIntro: function() {
+ const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
+ return
+
To avoid ever losing your encrypted message history, you
+ can save your encryption keys on the server, protected by a recovery key.
+
+
To maximise security, your recovery key is never stored by the app,
+ so you must store it yourself somewhere safe.
+
Warning: storing your encryption keys on the server means that
+ if someone gains access to your account and also steals your recovery key,
+ they will be able to read all of your encrypted conversation history.
+
+
+
Do you wish to generate a recovery key and backup your encryption
+ keys on the server?
{_t("This key can decrypt your full message history.")}
+
{_t(
+ "When you've saved it somewhere safe, proceed to the next step where the key will be used to "+
+ "create an encrypted backup of your message keys and then destroyed."
+ )}
+
+ );
+ },
+});
diff --git a/src/components/views/settings/KeyBackupPanel.js b/src/components/views/settings/KeyBackupPanel.js
new file mode 100644
index 0000000000..3b452e77f8
--- /dev/null
+++ b/src/components/views/settings/KeyBackupPanel.js
@@ -0,0 +1,134 @@
+/*
+Copyright 2018 New Vector Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import React from 'react';
+import PropTypes from 'prop-types';
+
+import sdk from '../../../index';
+import MatrixClientPeg from '../../../MatrixClientPeg';
+import { _t } from '../../../languageHandler';
+import Modal from '../../../Modal';
+
+export default class KeyBackupPanel extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this._startNewBackup = this._startNewBackup.bind(this);
+ this._deleteBackup = this._deleteBackup.bind(this);
+
+ this._unmounted = false;
+ this.state = {
+ loading: true,
+ error: null,
+ backupInfo: null,
+ };
+ this._loadBackupStatus();
+ }
+
+ componentWillUnmount() {
+ this._unmounted = true;
+ }
+
+ async _loadBackupStatus() {
+ this.setState({loading: true});
+ try {
+ const backupInfo = await MatrixClientPeg.get().getKeyBackupVersion();
+ if (this._unmounted) return;
+ this.setState({
+ backupInfo,
+ loading: false,
+ });
+ } catch (e) {
+ console.log("Unable to fetch key backup status", e);
+ if (this._unmounted) return;
+ this.setState({
+ error: e,
+ loading: false,
+ });
+ return;
+ }
+ }
+
+ _startNewBackup() {
+ const CreateKeyBackupDialog = sdk.getComponent("dialogs.keybackup.CreateKeyBackupDialog");
+ Modal.createTrackedDialog('Key Backup', 'Key Backup', CreateKeyBackupDialog, {
+ onFinished: () => {
+ this._loadBackupStatus();
+ },
+ });
+ }
+
+ _deleteBackup() {
+ const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
+ Modal.createTrackedDialog('Delete Backup', '', QuestionDialog, {
+ title: _t("Delete Backup"),
+ description: _t(
+ "Delete your backed up encryption keys from the server? " +
+ "You will no longer be able to use your recovery key to read encrypted message history"
+ ),
+ button: _t('Delete backup'),
+ danger: true,
+ onFinished: (proceed) => {
+ if (!proceed) return;
+ this.setState({loading: true});
+ MatrixClientPeg.get().deleteKeyBackupVersion(this.state.backupInfo.version).then(() => {
+ this._loadBackupStatus();
+ });
+ },
+ });
+
+ }
+
+ render() {
+ const Spinner = sdk.getComponent("elements.Spinner");
+ const AccessibleButton = sdk.getComponent("elements.AccessibleButton");
+
+ if (this.state.error) {
+ return (
+
+ {_t("Unable to load key backup status")}
+
+ );
+ } else if (this.state.loading) {
+ return ;
+ } else if (this.state.backupInfo) {
+ let clientBackupStatus;
+ if (MatrixClientPeg.get().getKeyBackupEnabled()) {
+ clientBackupStatus = _t("This device is uploading keys to this backup");
+ } else {
+ // XXX: display why and how to fix it
+ clientBackupStatus = _t("This device is not uploading keys to this backup", {}, {b: x => {x}});
+ }
+ return
+
{ _t("Delete backup") }
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 16695c8ec8..acad2b7e33 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -304,6 +304,11 @@
"Unable to load key backup status": "Unable to load key backup status",
"This device is uploading keys to this backup": "This device is uploading keys to this backup",
"This device is not uploading keys to this backup": "This device is not uploading keys to this backup",
+ "Backup has a valid signature from verified device x": "Backup has a valid signature from verified device x",
+ "Backup has a valid signature from unverified device ": "Backup has a valid signature from unverified device ",
+ "Backup has an invalid signature from verified device ": "Backup has an invalid signature from verified device ",
+ "Backup has an invalid signature from unverified device ": "Backup has an invalid signature from unverified device ",
+ "Backup is not signed by any of your devices": "Backup is not signed by any of your devices",
"Backup version: ": "Backup version: ",
"Algorithm: ": "Algorithm: ",
"No backup is present": "No backup is present",
@@ -937,6 +942,10 @@
"Share Room Message": "Share Room Message",
"Link to selected message": "Link to selected message",
"COPY": "COPY",
+ "Restore encryption keys": "Restore encryption keys",
+ "Verify this device": "Verify this device",
+ "Restore from online backup": "Restore from online backup",
+ "Restore from offline backup": "Restore from offline backup",
"You are currently blacklisting unverified devices; to send messages to these devices you must verify them.": "You are currently blacklisting unverified devices; to send messages to these devices you must verify them.",
"We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.": "We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.",
"Room contains unknown devices": "Room contains unknown devices",
@@ -957,12 +966,6 @@
"Creating backup...": "Creating backup...",
"Uploading keys...": "Uploading keys...",
"Create Key Backup": "Create Key Backup",
- "Backup encryption keys on your server?": "Backup encryption keys on your server?",
- "Generate recovery key and enable online backups": "Generate recovery key and enable online backups",
- "Restore encryption keys": "Restore encryption keys",
- "Verify this device": "Verify this device",
- "Restore from online backup": "Restore from online backup",
- "Restore from offline backup": "Restore from offline backup",
"Private Chat": "Private Chat",
"Public Chat": "Public Chat",
"Custom": "Custom",
From 2e6d27717cdd17310beb72e77e973ca3fa541408 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Fri, 14 Sep 2018 17:33:25 +0100
Subject: [PATCH 006/218] LIIIIIIIIIIIIIIIINT!
---
.../views/dialogs/SuggestKeyRestoreDialog.js | 3 +-
.../keybackup/CreateKeyBackupDialog.js | 4 +-
.../views/settings/KeyBackupPanel.js | 43 ++++++++++++++-----
3 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/src/components/views/dialogs/SuggestKeyRestoreDialog.js b/src/components/views/dialogs/SuggestKeyRestoreDialog.js
index 3419b6235c..993bc74666 100644
--- a/src/components/views/dialogs/SuggestKeyRestoreDialog.js
+++ b/src/components/views/dialogs/SuggestKeyRestoreDialog.js
@@ -14,12 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-import Modal from '../../../Modal';
import React from 'react';
import PropTypes from 'prop-types';
import sdk from '../../../index';
-import { _t, _td } from '../../../languageHandler';
+import { _t } from '../../../languageHandler';
/**
* Dialog which asks the user whether they want to restore megolm keys
diff --git a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
index 03410f4f7d..6e83e4c032 100644
--- a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
+++ b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
@@ -14,9 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-import Modal from '../../../../Modal';
import React from 'react';
-import PropTypes from 'prop-types';
import sdk from '../../../../index';
import MatrixClientPeg from '../../../../MatrixClientPeg';
import { formatCryptoKey } from '../../../../utils/FormattingUtils';
@@ -146,7 +144,7 @@ export default React.createClass({
{_t("This key can decrypt your full message history.")}
{_t(
"When you've saved it somewhere safe, proceed to the next step where the key will be used to "+
- "create an encrypted backup of your message keys and then destroyed."
+ "create an encrypted backup of your message keys and then destroyed.",
)}
+ {"\uD83D\uDC4D "}{_t("This looks like a valid recovery key!")}
+
;
+ } else {
+ keyStatus =
+ {"\uD83D\uDC4E "}{_t("Not a valid recovery key")}
+
;
+ }
+
content =
{_t("Please enter the recovery key generated when you set up key backup")}
+ {keyStatus}
;
}
diff --git a/src/components/views/elements/DialogButtons.js b/src/components/views/elements/DialogButtons.js
index baf831415f..e8e1c78e71 100644
--- a/src/components/views/elements/DialogButtons.js
+++ b/src/components/views/elements/DialogButtons.js
@@ -43,7 +43,11 @@ module.exports = React.createClass({
focus: PropTypes.bool,
+ // disables the primary and cancel buttons
disabled: PropTypes.bool,
+
+ // disables only the primary button
+ primaryDisabled: PropTypes.bool,
},
getDefaultProps: function() {
@@ -73,7 +77,7 @@ module.exports = React.createClass({
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 1be2845787..511b007eca 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -972,6 +972,8 @@
"No backup found!": "No backup found!",
"Failed to decrypt %(failedCount)s sessions!": "Failed to decrypt %(failedCount)s sessions!",
"Restored %(sessionCount)s session keys": "Restored %(sessionCount)s session keys",
+ "This looks like a valid recovery key!": "This looks like a valid recovery key!",
+ "Not a valid recovery key": "Not a valid recovery key",
"Please enter the recovery key generated when you set up key backup": "Please enter the recovery key generated when you set up key backup",
"Recover": "Recover",
"Restore Key Backup": "Restore Key Backup",
From 12d10cccefb606a7b57ecec89a101cc17c47fdb7 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Mon, 17 Sep 2018 17:14:03 +0100
Subject: [PATCH 009/218] Show if sig is from this device
---
src/components/views/settings/KeyBackupPanel.js | 7 ++++++-
src/i18n/strings/en_EN.json | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/components/views/settings/KeyBackupPanel.js b/src/components/views/settings/KeyBackupPanel.js
index ebf9daf0d2..7cbee9c501 100644
--- a/src/components/views/settings/KeyBackupPanel.js
+++ b/src/components/views/settings/KeyBackupPanel.js
@@ -164,7 +164,12 @@ export default class KeyBackupPanel extends React.Component {
device: sub => {sig.device.getDisplayName()},
};
let sigStat;
- if (sig.valid && sig.device.isVerified()) {
+ if (sig.device.getFingerprint() === MatrixClientPeg.get().getDeviceEd25519Key()) {
+ sigStat = _t(
+ "Backup has a valid signature from this device",
+ {}, sigStatSub,
+ );
+ } else if (sig.valid && sig.device.isVerified()) {
sigStat = _t(
"Backup has a valid signature from " +
"verified device x",
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 511b007eca..300a1f67cf 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -304,6 +304,7 @@
"Unable to load key backup status": "Unable to load key backup status",
"This device is uploading keys to this backup": "This device is uploading keys to this backup",
"This device is not uploading keys to this backup": "This device is not uploading keys to this backup",
+ "Backup has a valid signature from this device": "Backup has a valid signature from this device",
"Backup has a valid signature from verified device x": "Backup has a valid signature from verified device x",
"Backup has a valid signature from unverified device ": "Backup has a valid signature from unverified device ",
"Backup has an invalid signature from verified device ": "Backup has an invalid signature from verified device ",
From 2cef0f7f727e9237759bb82f4264f24e41786d06 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Tue, 18 Sep 2018 15:04:51 +0100
Subject: [PATCH 010/218] lint
---
src/SuggestKeyRestoreHandler.js | 96 -------------------
.../views/dialogs/SuggestKeyRestoreDialog.js | 76 ---------------
.../keybackup/RestoreKeyBackupDialog.js | 8 +-
3 files changed, 2 insertions(+), 178 deletions(-)
delete mode 100644 src/SuggestKeyRestoreHandler.js
delete mode 100644 src/components/views/dialogs/SuggestKeyRestoreDialog.js
diff --git a/src/SuggestKeyRestoreHandler.js b/src/SuggestKeyRestoreHandler.js
deleted file mode 100644
index 3383889c1e..0000000000
--- a/src/SuggestKeyRestoreHandler.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-Copyright 2018 New Vector Ltd
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-import sdk from './index';
-import Modal from './Modal';
-
-export default class SuggestKeyRestoreHandler {
- constructor(matrixClient) {
- this._matrixClient = matrixClient;
- }
-
- handleSuggestKeyRestore() {
- const onVerifyDevice = () => {
- const DeviceVerifyDialog = sdk.getComponent('views.dialogs.DeviceVerifyDialog');
-
- Modal.createTrackedDialog('Key Restore', 'Starting verification', DeviceVerifyDialog, {
- // userId: this.props.userId,
- // device: this.state.deviceInfo,
- onFinished: (verified) => {
- if (verified) {
- this.props.onFinished();
- }
- },
- });
- };
-
- const onRecoverFromBackup = () => {
- // XXX: we need this so that you can get at it from UserSettings too
- // * prompt for recovery key
- // * Download the current backup version info from the server and check the key decrypts it okay.
- // * Check that the public key for that backup version matches the recovery key
- // * show a spinner
- // * Download all the existing keys from the server
- // * Decrypt them using the recovery key
- // * Add them to the local store (which encrypts them as normal with "DEFAULT KEY"
- // * Enable incremental backups for this device.
- };
-
- const onIgnoreSuggestion = () => {
- };
-
- const onFinished = () => {
- this.suggestBackup();
- };
-
- // FIXME: need a way to know if an account has ever touched E2E before.
- // Perhaps we can extend toDevice to include a flag if it's the first time the
- // server has ever sent a room_key to a client or something?
- const virginAccount = false;
-
- if (virginAccount) {
- this.suggestBackup();
- return;
- }
-
- const SuggestKeyRestoreDialog = sdk.getComponent("dialogs.SuggestKeyRestoreDialog");
- Modal.createTrackedDialog('Key Restore', 'Key Restore', SuggestKeyRestoreDialog, {
- matrixClient: this._matrixClient,
- isOnlyDevice: false, // FIXME
- hasOnlineBackup: false, // FIXME
- onVerifyDevice: onVerifyDevice,
- onRecoverFromBackup: onRecoverFromBackup,
- onIgnoreSuggestion: onIgnoreSuggestion,
- onFinished: onFinished,
- });
- }
-
- suggestBackup() {
- if (hasOnlineBackup) return;
-
- const onStartNewBackup = () => {
- // XXX: we need this so that you can get at it from UserSettings too
- // * Upload all their existing keys from their session store to the backup using the bulk upload API.
- // (Having re-encrypted them using the backup keypair rather than the static one used to store them on disk)
- };
-
- const SuggestKeyBackupDialog = sdk.getComponent("dialogs.SuggestKeyBackupDialog");
- Modal.createTrackedDialog('Key Backup', 'Key Backup', SuggestKeyBackupDialog, {
- onStartNewBackup: onStartNewBackup,
- });
- }
-}
-
diff --git a/src/components/views/dialogs/SuggestKeyRestoreDialog.js b/src/components/views/dialogs/SuggestKeyRestoreDialog.js
deleted file mode 100644
index 993bc74666..0000000000
--- a/src/components/views/dialogs/SuggestKeyRestoreDialog.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-Copyright 2018 New Vector Ltd
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-import React from 'react';
-import PropTypes from 'prop-types';
-import sdk from '../../../index';
-
-import { _t } from '../../../languageHandler';
-
-/**
- * Dialog which asks the user whether they want to restore megolm keys
- * from various sources when they first start using E2E on a new device.
- */
-export default React.createClass({
- propTypes: {
- matrixClient: PropTypes.object.isRequired,
- isOnlyDevice: PropTypes.bool.isRequired,
- hasOnlineBackup: PropTypes.bool.isRequired,
- onVerifyDevice: PropTypes.func.isRequired,
- onImportBackup: PropTypes.func.isRequired,
- onRecoverFromBackup: PropTypes.func.isRequired,
- onIgnoreSuggestion: PropTypes.func.isRequired,
- },
-
- render: function() {
- const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
-
- return (
-
-
-
We don't have a way to decrypt older messages on this device.
-
-
Your options are:
-
-
- { !this.props.isOnlyDevice ?
Verify this device from one or more of your other ones to automatically sync keys
: '' }
- { this.props.hasOnlineBackup ?
Enter your recovery key to restore encryption keys from your online backup
: '' }
-
Import encryption keys from an offline backup
-
Continue without restoring keys, syncing keys from your other devices on a best effort basis
-
-
-
-
-
-
-
-
-
-
- );
- },
-});
diff --git a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js
index 5c02fd1227..149f6a6d1f 100644
--- a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js
+++ b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js
@@ -14,15 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-import Modal from '../../../../Modal';
import React from 'react';
-import PropTypes from 'prop-types';
import sdk from '../../../../index';
import MatrixClientPeg from '../../../../MatrixClientPeg';
-import { formatCryptoKey } from '../../../../utils/FormattingUtils';
-import Promise from 'bluebird';
-import { _t, _td } from '../../../../languageHandler';
+import { _t } from '../../../../languageHandler';
function isRecoveryKeyValid(r) {
return MatrixClientPeg.get().isValidRecoveryKey(r.replace(/ /g, ''));
@@ -149,7 +145,7 @@ export default React.createClass({
content =
{_t("Please enter the recovery key generated when you set up key backup")}
-
+ Without setting up Secure Message Recovery, you won't be able to restore your
+ encrypted message history if you log out or use another device.
+
+
+
+
;
} else {
switch (this.state.phase) {
- case PHASE_INTRO:
- content = this._renderPhaseIntro();
+ case PHASE_PASSPHRASE:
+ content = this._renderPhasePassPhrase();
break;
- case PHASE_GENERATING:
- content = this._renderBusyPhase(_td("Generating recovery key..."));
+ case PHASE_PASSPHRASE_CONFIRM:
+ content = this._renderPhasePassPhraseConfirm();
break;
case PHASE_SHOWKEY:
content = this._renderPhaseShowKey();
break;
- case PHASE_MAKEBACKUP:
- content = this._renderBusyPhase(_td("Creating backup..."));
+ case PHASE_KEEPITSAFE:
+ content = this._renderPhaseKeepItSafe();
break;
- case PHASE_UPLOAD:
- content = this._renderBusyPhase(_td("Uploading keys..."));
+ case PHASE_BACKINGUP:
+ content = this._renderBusyPhase(_td("Backing up..."));
break;
case PHASE_DONE:
content = this._renderPhaseDone();
break;
+ case PHASE_OPTOUT_CONFIRM:
+ content = this._renderPhaseOptOutConfirm();
+ break;
}
}
return (
{content}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 3da5ff15a2..cac9b4ef59 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -252,6 +252,7 @@
"Room Colour": "Room Colour",
"Enable widget screenshots on supported widgets": "Enable widget screenshots on supported widgets",
"Show empty room list headings": "Show empty room list headings",
+ "Show developer tools": "Show developer tools",
"Collecting app version information": "Collecting app version information",
"Collecting logs": "Collecting logs",
"Uploading report": "Uploading report",
@@ -570,6 +571,7 @@
"Click here to fix": "Click here to fix",
"To send events of type , you must be a": "To send events of type , you must be a",
"Upgrade room to version %(ver)s": "Upgrade room to version %(ver)s",
+ "Open Devtools": "Open Devtools",
"Who can access this room?": "Who can access this room?",
"Only people who have been invited": "Only people who have been invited",
"Anyone who knows the room's link, apart from guests": "Anyone who knows the room's link, apart from guests",
@@ -959,30 +961,42 @@
"Share Room Message": "Share Room Message",
"Link to selected message": "Link to selected message",
"COPY": "COPY",
- "Restore encryption keys": "Restore encryption keys",
- "Verify this device": "Verify this device",
- "Restore from online backup": "Restore from online backup",
- "Restore from offline backup": "Restore from offline backup",
"You are currently blacklisting unverified devices; to send messages to these devices you must verify them.": "You are currently blacklisting unverified devices; to send messages to these devices you must verify them.",
"We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.": "We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.",
"Room contains unknown devices": "Room contains unknown devices",
"\"%(RoomName)s\" contains devices that you haven't seen before.": "\"%(RoomName)s\" contains devices that you haven't seen before.",
"Unknown devices": "Unknown devices",
- "Generate recovery key": "Generate recovery key",
- "I'll stick to manual backups": "I'll stick to manual backups",
- "Here is your recovery key:": "Here is your recovery key:",
- "This key can decrypt your full message history.": "This key can decrypt your full message history.",
- "When you've saved it somewhere safe, proceed to the next step where the key will be used to create an encrypted backup of your message keys and then destroyed.": "When you've saved it somewhere safe, proceed to the next step where the key will be used to create an encrypted backup of your message keys and then destroyed.",
+ "Secure your encrypted message history with a Recovery Passphrase.": "Secure your encrypted message history with a Recovery Passphrase.",
+ "You'll need it if you log out or lose access to this device.": "You'll need it if you log out or lose access to this device.",
+ "Enter a passphrase...": "Enter a passphrase...",
+ "Next": "Next",
+ "If you don't want encrypted message history to be availble on other devices, .": "If you don't want encrypted message history to be availble on other devices, .",
+ "Or, if you don't want to create a Recovery Passphrase, skip this step and .": "Or, if you don't want to create a Recovery Passphrase, skip this step and .",
+ "That matches!": "That matches!",
+ "That doesn't match.": "That doesn't match.",
+ "Go back to set it again.": "Go back to set it again.",
+ "Repeat your passphrase...": "Repeat your passphrase...",
+ "Make a copy of this Recovery Key and keep it safe.": "Make a copy of this Recovery Key and keep it safe.",
+ "As a safety net, you can use it to restore your encrypted message history if you forget your Recovery Passphrase.": "As a safety net, you can use it to restore your encrypted message history if you forget your Recovery Passphrase.",
+ "Your Recovery Key": "Your Recovery Key",
"Copy to clipboard": "Copy to clipboard",
- "Proceed": "Proceed",
+ "I've made a copy": "I've made a copy",
+ "Your Recovery Key has been copied to your clipboard, paste it to:": "Your Recovery Key has been copied to your clipboard, paste it to:",
+ "Print it and store it somewhere safe": "Print it and store it somewhere safe",
+ "Save it on a USB key or backup drive": "Save it on a USB key or backup drive",
+ "Copy it to your personal cloud storage": "Copy it to your personal cloud storage",
+ "Got it": "Got it",
"Backup created": "Backup created",
"Your encryption keys are now being backed up to your Homeserver.": "Your encryption keys are now being backed up to your Homeserver.",
+ "Set up Secure Message Recovery": "Set up Secure Message Recovery",
+ "Create a Recovery Passphrase": "Create a Recovery Passphrase",
+ "Confirm Recovery Passphrase": "Confirm Recovery Passphrase",
+ "Recovery Key": "Recovery Key",
+ "Keep it safe": "Keep it safe",
+ "Backing up...": "Backing up...",
+ "Create Key Backup": "Create Key Backup",
"Unable to create key backup": "Unable to create key backup",
"Retry": "Retry",
- "Generating recovery key...": "Generating recovery key...",
- "Creating backup...": "Creating backup...",
- "Uploading keys...": "Uploading keys...",
- "Create Key Backup": "Create Key Backup",
"Unable to load backup status": "Unable to load backup status",
"Unable to restore backup": "Unable to restore backup",
"No backup found!": "No backup found!",
@@ -1316,7 +1330,5 @@
"Import": "Import",
"Failed to set direct chat tag": "Failed to set direct chat tag",
"Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room",
- "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room",
- "Open Devtools": "Open Devtools",
- "Show developer tools": "Show developer tools"
+ "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room"
}
From 132408cf02512a90c97903714ee33c4217640ab6 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Tue, 20 Nov 2018 16:16:24 +0000
Subject: [PATCH 199/218] Add e2e backup recovery with passphrase
---
res/css/_components.scss | 1 +
.../keybackup/_RestoreKeyBackupDialog.scss | 29 +++
.../keybackup/RestoreKeyBackupDialog.js | 170 ++++++++++++++++--
src/i18n/strings/en_EN.json | 10 +-
4 files changed, 188 insertions(+), 22 deletions(-)
create mode 100644 res/css/views/dialogs/keybackup/_RestoreKeyBackupDialog.scss
diff --git a/res/css/_components.scss b/res/css/_components.scss
index 039bcd545b..083071ef6c 100644
--- a/res/css/_components.scss
+++ b/res/css/_components.scss
@@ -47,6 +47,7 @@
@import "./views/dialogs/_ShareDialog.scss";
@import "./views/dialogs/_UnknownDeviceDialog.scss";
@import "./views/dialogs/keybackup/_CreateKeyBackupDialog.scss";
+@import "./views/dialogs/keybackup/_RestoreKeyBackupDialog.scss";
@import "./views/directory/_NetworkDropdown.scss";
@import "./views/elements/_AccessibleButton.scss";
@import "./views/elements/_AddressSelector.scss";
diff --git a/res/css/views/dialogs/keybackup/_RestoreKeyBackupDialog.scss b/res/css/views/dialogs/keybackup/_RestoreKeyBackupDialog.scss
new file mode 100644
index 0000000000..612c921038
--- /dev/null
+++ b/res/css/views/dialogs/keybackup/_RestoreKeyBackupDialog.scss
@@ -0,0 +1,29 @@
+/*
+Copyright 2018 New Vector Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+.mx_RestoreKeyBackupDialog_primaryContainer {
+ /*FIXME: plinth colour in new theme(s). background-color: $accent-color;*/
+ padding: 20px
+}
+
+.mx_RestoreKeyBackupDialog_passPhraseInput,
+.mx_RestoreKeyBackupDialog_recoveryKeyInput {
+ width: 300px;
+ border: 1px solid $accent-color;
+ border-radius: 5px;
+ padding: 10px;
+}
+
diff --git a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js
index 9e5e61cb1a..e4250814d0 100644
--- a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js
+++ b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js
@@ -17,6 +17,7 @@ limitations under the License.
import React from 'react';
import sdk from '../../../../index';
import MatrixClientPeg from '../../../../MatrixClientPeg';
+import Modal from '../../../../Modal';
import { _t } from '../../../../languageHandler';
@@ -33,6 +34,9 @@ export default React.createClass({
recoveryKey: "",
recoverInfo: null,
recoveryKeyValid: false,
+ forceRecoveryKey: false,
+ passPhrase: '',
+ recoveryKey: '',
};
},
@@ -48,6 +52,18 @@ export default React.createClass({
this.props.onFinished(true);
},
+ _onUseRecoveryKeyClick: function() {
+ this.setState({
+ forceRecoveryKey: true,
+ });
+ },
+
+ _onResetRecoveryClick: function() {
+ this.props.onFinished(false);
+ const CreateKeyBackupDialog = sdk.getComponent("dialogs.keybackup.CreateKeyBackupDialog");
+ Modal.createTrackedDialog('Create Key Backup', '', CreateKeyBackupDialog, {});
+ },
+
_onRecoveryKeyChange: function(e) {
this.setState({
recoveryKey: e.target.value,
@@ -55,13 +71,35 @@ export default React.createClass({
});
},
- _onRecoverClick: async function() {
+ _onPassPhraseNext: async function() {
this.setState({
loading: true,
restoreError: null,
});
try {
- const recoverInfo = await MatrixClientPeg.get().restoreKeyBackups(
+ const recoverInfo = await MatrixClientPeg.get().restoreKeyBackupWithPassword(
+ this.state.passPhrase, undefined, undefined, this.state.backupInfo.version,
+ );
+ this.setState({
+ loading: false,
+ recoverInfo,
+ });
+ } catch (e) {
+ console.log("Error restoring backup", e);
+ this.setState({
+ loading: false,
+ restoreError: e,
+ });
+ }
+ },
+
+ _onRecoveryKeyNext: async function() {
+ this.setState({
+ loading: true,
+ restoreError: null,
+ });
+ try {
+ const recoverInfo = await MatrixClientPeg.get().restoreKeyBackupWithRecoveryKey(
this.state.recoveryKey, undefined, undefined, this.state.backupInfo.version,
);
this.setState({
@@ -77,6 +115,24 @@ export default React.createClass({
}
},
+ _onPassPhraseChange: function(e) {
+ this.setState({
+ passPhrase: e.target.value,
+ });
+ },
+
+ _onPassPhraseKeyPress: function(e) {
+ if (e.key === "Enter") {
+ this._onPassPhraseNext();
+ }
+ },
+
+ _onRecoveryKeyKeyPress: function(e) {
+ if (e.key === "Enter" && this.state.recoveryKeyValid) {
+ this._onRecoveryKeyNext();
+ }
+ },
+
_loadBackupStatus: async function() {
this.setState({
loading: true,
@@ -102,16 +158,29 @@ export default React.createClass({
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
const Spinner = sdk.getComponent("elements.Spinner");
+ const backupHasPassphrase = (
+ this.state.backupInfo &&
+ this.state.backupInfo.auth_data &&
+ this.state.backupInfo.auth_data.private_key_salt &&
+ this.state.backupInfo.auth_data.private_key_iterations
+ );
+
let content;
+ let title;
if (this.state.loading) {
+ title = _t("Loading...");
content = ;
} else if (this.state.loadError) {
+ title = _t("Error");
content = _t("Unable to load backup status");
} else if (this.state.restoreError) {
+ title = _t("Error");
content = _t("Unable to restore backup");
} else if (this.state.backupInfo === null) {
+ title = _t("Error");
content = _t("No backup found!");
} else if (this.state.recoverInfo) {
+ title = _t("Backup Restored");
let failedToDecrypt;
if (this.state.recoverInfo.total > this.state.recoverInfo.imported) {
failedToDecrypt =
- {_t("Please enter the recovery key generated when you set up key backup")}
-
- {keyStatus}
-
+ {_t(
+ "Access your secure message history and set up secure " +
+ "messaging by entering your recovery key.",
+ )}
+
+
+
+ {keyStatus}
+
+
+ {_t(
+ "If you've forgotten your recovery passphrase you can "+
+ ""
+ , {}, {
+ button: s =>
+ {s}
+ ,
+ })}
;
}
return (
{content}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index cac9b4ef59..58e10ff149 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -1000,13 +1000,17 @@
"Unable to load backup status": "Unable to load backup status",
"Unable to restore backup": "Unable to restore backup",
"No backup found!": "No backup found!",
+ "Backup Restored": "Backup Restored",
"Failed to decrypt %(failedCount)s sessions!": "Failed to decrypt %(failedCount)s sessions!",
"Restored %(sessionCount)s session keys": "Restored %(sessionCount)s session keys",
+ "Enter Recovery Passphrase": "Enter Recovery Passphrase",
+ "Access your secure message history and set up secure messaging by entering your recovery passphrase.": "Access your secure message history and set up secure messaging by entering your recovery passphrase.",
+ "If you've forgotten your recovery passphrase you can use your recovery key or set up new recovery options": "If you've forgotten your recovery passphrase you can use your recovery key or set up new recovery options",
+ "Enter Recovery Key": "Enter Recovery Key",
"This looks like a valid recovery key!": "This looks like a valid recovery key!",
"Not a valid recovery key": "Not a valid recovery key",
- "Please enter the recovery key generated when you set up key backup": "Please enter the recovery key generated when you set up key backup",
- "Recover": "Recover",
- "Restore Key Backup": "Restore Key Backup",
+ "Access your secure message history and set up secure messaging by entering your recovery key.": "Access your secure message history and set up secure messaging by entering your recovery key.",
+ "If you've forgotten your recovery passphrase you can ": "If you've forgotten your recovery passphrase you can ",
"Private Chat": "Private Chat",
"Public Chat": "Public Chat",
"Custom": "Custom",
From 63a7ff5273185aca994ab5b3c3c6a2589ed6a354 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Tue, 20 Nov 2018 16:20:31 +0000
Subject: [PATCH 200/218] lint
---
.../dialogs/keybackup/CreateKeyBackupDialog.js | 17 ++++++++++++++---
.../dialogs/keybackup/RestoreKeyBackupDialog.js | 1 -
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
index ad68e15293..aeb0c33b67 100644
--- a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
+++ b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
@@ -17,7 +17,6 @@ limitations under the License.
import React from 'react';
import sdk from '../../../../index';
import MatrixClientPeg from '../../../../MatrixClientPeg';
-import Promise from 'bluebird';
import { _t, _td } from '../../../../languageHandler';
@@ -196,7 +195,13 @@ export default React.createClass({
".",
{},
{
- button: sub => {sub},
+ button: sub =>
+ {sub}
+ ,
},
)}
+ {
+ // FIXME REDESIGN: buttons should be adjacent but insufficient room in current design
+ }
+
+
{this._keyBackupInfo.recovery_key}
+ copied to your clipboard, paste it to:",
+ {}, {b: s => {s}},
+ );
+ } else if (this.state.downloaded) {
+ introText = _t(
+ "Your Recovery Key is in your Downloads folder.",
+ {}, {b: s => {s}},
+ );
}
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
return
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index be713bdb37..20618e305e 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -986,8 +986,10 @@
"As a safety net, you can use it to restore your encrypted message history if you forget your Recovery Passphrase.": "As a safety net, you can use it to restore your encrypted message history if you forget your Recovery Passphrase.",
"Your Recovery Key": "Your Recovery Key",
"Copy to clipboard": "Copy to clipboard",
+ "Download": "Download",
"I've made a copy": "I've made a copy",
- "Your Recovery Key has been copied to your clipboard, paste it to:": "Your Recovery Key has been copied to your clipboard, paste it to:",
+ "Your Recovery Key has been copied to your clipboard, paste it to:": "Your Recovery Key has been copied to your clipboard, paste it to:",
+ "Your Recovery Key is in your Downloads folder.": "Your Recovery Key is in your Downloads folder.",
"Print it and store it somewhere safe": "Print it and store it somewhere safe",
"Save it on a USB key or backup drive": "Save it on a USB key or backup drive",
"Copy it to your personal cloud storage": "Copy it to your personal cloud storage",
From 985966f8beada6d3d0c47d173ab871c2d4e6a377 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Wed, 21 Nov 2018 16:56:44 +0000
Subject: [PATCH 202/218] Update async dialog interface to use promises
Hopefully makes the syntax a bit nicer. Also uses ES6 async import
rather than require.ensure which is now deprecated. Also also
displays an error if the component fails to load rather than falling
over in a heap, which is nice.
---
.babelrc | 2 +-
package.json | 1 +
src/Modal.js | 46 ++++++++++++++-----
src/components/structures/UserSettings.js | 26 +++++------
.../structures/login/ForgotPassword.js | 13 +++---
src/components/views/rooms/EventTile.js | 9 ++--
.../views/settings/ChangePassword.js | 13 +++---
src/i18n/strings/en_EN.json | 3 +-
8 files changed, 66 insertions(+), 47 deletions(-)
diff --git a/.babelrc b/.babelrc
index 6ba0e0dae0..fc5bd1788f 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,4 +1,4 @@
{
"presets": ["react", "es2015", "es2016"],
- "plugins": ["transform-class-properties", "transform-object-rest-spread", "transform-async-to-bluebird", "transform-runtime", "add-module-exports"]
+ "plugins": ["transform-class-properties", "transform-object-rest-spread", "transform-async-to-bluebird", "transform-runtime", "add-module-exports", "syntax-dynamic-import"]
}
diff --git a/package.json b/package.json
index d2e54a2621..b0b3f57746 100644
--- a/package.json
+++ b/package.json
@@ -53,6 +53,7 @@
"test-multi": "karma start"
},
"dependencies": {
+ "babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-runtime": "^6.26.0",
"bluebird": "^3.5.0",
"blueimp-canvas-to-blob": "^3.5.0",
diff --git a/src/Modal.js b/src/Modal.js
index 06a96824a7..f7b10041a6 100644
--- a/src/Modal.js
+++ b/src/Modal.js
@@ -23,6 +23,7 @@ import PropTypes from 'prop-types';
import Analytics from './Analytics';
import sdk from './index';
import dis from './dispatcher';
+import { _t } from './languageHandler';
const DIALOG_CONTAINER_ID = "mx_Dialog_Container";
@@ -32,15 +33,15 @@ const DIALOG_CONTAINER_ID = "mx_Dialog_Container";
*/
const AsyncWrapper = React.createClass({
propTypes: {
- /** A function which takes a 'callback' argument which it will call
- * with the real component once it loads.
+ /** A promise which resolves with the real component
*/
- loader: PropTypes.func.isRequired,
+ prom: PropTypes.object.isRequired,
},
getInitialState: function() {
return {
component: null,
+ error: null,
};
},
@@ -49,14 +50,20 @@ const AsyncWrapper = React.createClass({
// XXX: temporary logging to try to diagnose
// https://github.com/vector-im/riot-web/issues/3148
console.log('Starting load of AsyncWrapper for modal');
- this.props.loader((e) => {
+ this.props.prom.then((result) => {
// XXX: temporary logging to try to diagnose
// https://github.com/vector-im/riot-web/issues/3148
- console.log('AsyncWrapper load completed with '+e.displayName);
+ console.log('AsyncWrapper load completed with '+result.displayName);
if (this._unmounted) {
return;
}
- this.setState({component: e});
+ // Take the 'default' member if it's there, then we support
+ // passing in just an import()ed module, since ES6 async import
+ // always returns a module *namespace*.
+ const component = result.default ? result.default : result;
+ this.setState({component});
+ }).catch((e) => {
+ this.setState({error: e});
});
},
@@ -64,11 +71,27 @@ const AsyncWrapper = React.createClass({
this._unmounted = true;
},
+ _onWrapperCancelClick: function() {
+ this.props.onFinished(false);
+ },
+
render: function() {
const {loader, ...otherProps} = this.props;
if (this.state.component) {
const Component = this.state.component;
return ;
+ } else if (this.state.error) {
+ const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
+ const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
+ return
+ {_t("Unable to load! Check your network connectivity and try again.")}
+
+ ;
} else {
// show a spinner until the component is loaded.
const Spinner = sdk.getComponent("elements.Spinner");
@@ -115,7 +138,7 @@ class ModalManager {
}
createDialog(Element, ...rest) {
- return this.createDialogAsync((cb) => {cb(Element);}, ...rest);
+ return this.createDialogAsync(new Promise(resolve => resolve(Element)), ...rest);
}
createTrackedDialogAsync(analyticsAction, analyticsInfo, ...rest) {
@@ -133,9 +156,8 @@ class ModalManager {
* require([''], cb);
* }
*
- * @param {Function} loader a function which takes a 'callback' argument,
- * which it should call with a React component which will be displayed as
- * the modal view.
+ * @param {Promise} prom a promise which resolves with a React component
+ * which will be displayed as the modal view.
*
* @param {Object} props properties to pass to the displayed
* component. (We will also pass an 'onFinished' property.)
@@ -147,7 +169,7 @@ class ModalManager {
* Also, when closed, all modals will be removed
* from the stack.
*/
- createDialogAsync(loader, props, className, isPriorityModal) {
+ createDialogAsync(prom, props, className, isPriorityModal) {
const self = this;
const modal = {};
@@ -178,7 +200,7 @@ class ModalManager {
// FIXME: If a dialog uses getDefaultProps it clobbers the onFinished
// property set here so you can't close the dialog from a button click!
modal.elem = (
-
);
modal.onFinished = props ? props.onFinished : null;
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index db12515285..c02e482746 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -589,23 +589,21 @@ module.exports = React.createClass({
},
_onExportE2eKeysClicked: function() {
- Modal.createTrackedDialogAsync('Export E2E Keys', '', (cb) => {
- require.ensure(['../../async-components/views/dialogs/ExportE2eKeysDialog'], () => {
- cb(require('../../async-components/views/dialogs/ExportE2eKeysDialog'));
- }, "e2e-export");
- }, {
- matrixClient: MatrixClientPeg.get(),
- });
+ Modal.createTrackedDialogAsync('Export E2E Keys', '',
+ import('../../async-components/views/dialogs/ExportE2eKeysDialog'),
+ {
+ matrixClient: MatrixClientPeg.get(),
+ },
+ );
},
_onImportE2eKeysClicked: function() {
- Modal.createTrackedDialogAsync('Import E2E Keys', '', (cb) => {
- require.ensure(['../../async-components/views/dialogs/ImportE2eKeysDialog'], () => {
- cb(require('../../async-components/views/dialogs/ImportE2eKeysDialog'));
- }, "e2e-export");
- }, {
- matrixClient: MatrixClientPeg.get(),
- });
+ Modal.createTrackedDialogAsync('Import E2E Keys', '',
+ import('../../async-components/views/dialogs/ImportE2eKeysDialog'),
+ {
+ matrixClient: MatrixClientPeg.get(),
+ },
+ );
},
_renderGroupSettings: function() {
diff --git a/src/components/structures/login/ForgotPassword.js b/src/components/structures/login/ForgotPassword.js
index 7e0cd5da8e..444f391258 100644
--- a/src/components/structures/login/ForgotPassword.js
+++ b/src/components/structures/login/ForgotPassword.js
@@ -121,13 +121,12 @@ module.exports = React.createClass({
},
_onExportE2eKeysClicked: function() {
- Modal.createTrackedDialogAsync('Export E2E Keys', 'Forgot Password', (cb) => {
- require.ensure(['../../../async-components/views/dialogs/ExportE2eKeysDialog'], () => {
- cb(require('../../../async-components/views/dialogs/ExportE2eKeysDialog'));
- }, "e2e-export");
- }, {
- matrixClient: MatrixClientPeg.get(),
- });
+ Modal.createTrackedDialogAsync('Export E2E Keys', 'Forgot Password',
+ import('../../../async-components/views/dialogs/ExportE2eKeysDialog'),
+ {
+ matrixClient: MatrixClientPeg.get(),
+ },
+ );
},
onInputChanged: function(stateKey, ev) {
diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js
index 53c73c8f84..e978bf438a 100644
--- a/src/components/views/rooms/EventTile.js
+++ b/src/components/views/rooms/EventTile.js
@@ -416,11 +416,10 @@ module.exports = withMatrixClient(React.createClass({
onCryptoClicked: function(e) {
const event = this.props.mxEvent;
- Modal.createTrackedDialogAsync('Encrypted Event Dialog', '', (cb) => {
- require(['../../../async-components/views/dialogs/EncryptedEventDialog'], cb);
- }, {
- event: event,
- });
+ Modal.createTrackedDialogAsync('Encrypted Event Dialog', '',
+ import('../../../async-components/views/dialogs/EncryptedEventDialog'),
+ {event},
+ );
},
onRequestKeysClick: function() {
diff --git a/src/components/views/settings/ChangePassword.js b/src/components/views/settings/ChangePassword.js
index b2ffe531b5..77c7810436 100644
--- a/src/components/views/settings/ChangePassword.js
+++ b/src/components/views/settings/ChangePassword.js
@@ -179,13 +179,12 @@ module.exports = React.createClass({
},
_onExportE2eKeysClicked: function() {
- Modal.createTrackedDialogAsync('Export E2E Keys', 'Change Password', (cb) => {
- require.ensure(['../../../async-components/views/dialogs/ExportE2eKeysDialog'], () => {
- cb(require('../../../async-components/views/dialogs/ExportE2eKeysDialog'));
- }, "e2e-export");
- }, {
- matrixClient: MatrixClientPeg.get(),
- });
+ Modal.createTrackedDialogAsync('Export E2E Keys', 'Change Password',
+ import('../../../async-components/views/dialogs/ExportE2eKeysDialog'),
+ {
+ matrixClient: MatrixClientPeg.get(),
+ },
+ );
},
onClickChange: function(ev) {
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 3dc0bb6b0a..01c4926467 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -82,6 +82,8 @@
"Failed to invite users to community": "Failed to invite users to community",
"Failed to invite users to %(groupId)s": "Failed to invite users to %(groupId)s",
"Failed to add the following rooms to %(groupId)s:": "Failed to add the following rooms to %(groupId)s:",
+ "Unable to load! Check your network connectivity and try again.": "Unable to load! Check your network connectivity and try again.",
+ "Dismiss": "Dismiss",
"Riot does not have permission to send you notifications - please check your browser settings": "Riot does not have permission to send you notifications - please check your browser settings",
"Riot was not given permission to send notifications - please try again": "Riot was not given permission to send notifications - please try again",
"Unable to enable Notifications": "Unable to enable Notifications",
@@ -644,7 +646,6 @@
"You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.": "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.",
"This allows you to use this app with an existing Matrix account on a different home server.": "This allows you to use this app with an existing Matrix account on a different home server.",
"You can also set a custom identity server but this will typically prevent interaction with users based on email address.": "You can also set a custom identity server but this will typically prevent interaction with users based on email address.",
- "Dismiss": "Dismiss",
"To continue, please enter your password.": "To continue, please enter your password.",
"Password:": "Password:",
"Please review and accept all of the homeserver's policies": "Please review and accept all of the homeserver's policies",
From 2ba4d8a2d912ea407ca2dbaf8b92a4d5d82bc27d Mon Sep 17 00:00:00 2001
From: David Baker
Date: Wed, 21 Nov 2018 17:35:28 +0000
Subject: [PATCH 203/218] Remove outdated logging & log on failure
---
src/Modal.js | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/Modal.js b/src/Modal.js
index f7b10041a6..960e0e5c30 100644
--- a/src/Modal.js
+++ b/src/Modal.js
@@ -51,9 +51,6 @@ const AsyncWrapper = React.createClass({
// https://github.com/vector-im/riot-web/issues/3148
console.log('Starting load of AsyncWrapper for modal');
this.props.prom.then((result) => {
- // XXX: temporary logging to try to diagnose
- // https://github.com/vector-im/riot-web/issues/3148
- console.log('AsyncWrapper load completed with '+result.displayName);
if (this._unmounted) {
return;
}
@@ -63,6 +60,7 @@ const AsyncWrapper = React.createClass({
const component = result.default ? result.default : result;
this.setState({component});
}).catch((e) => {
+ console.warn('AsyncWrapper promise failed', e);
this.setState({error: e});
});
},
From 08e2ba8c6c704aa1ad7e3aab76918ffbca3aa889 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Wed, 21 Nov 2018 18:02:58 +0000
Subject: [PATCH 204/218] Don't allow enter to submit if field invalid
---
.../views/dialogs/keybackup/CreateKeyBackupDialog.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
index aeb0c33b67..eec4c9f414 100644
--- a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
+++ b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
@@ -122,7 +122,7 @@ export default React.createClass({
},
_onPassPhraseKeyPress: function(e) {
- if (e.key === 'Enter') {
+ if (e.key === 'Enter' && this._passPhraseIsValid()) {
this._onPassPhraseNextClick();
}
},
@@ -136,7 +136,7 @@ export default React.createClass({
},
_onPassPhraseConfirmKeyPress: function(e) {
- if (e.key === 'Enter') {
+ if (e.key === 'Enter' && this.state.passPhrase === this.state.passPhraseConfirm) {
this._onPassPhraseConfirmNextClick();
}
},
@@ -167,6 +167,10 @@ export default React.createClass({
});
},
+ _passPhraseIsValid: function() {
+ return this.state.passPhrase !== '';
+ },
+
_renderPhasePassPhrase: function() {
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
@@ -187,7 +191,7 @@ export default React.createClass({
- Type in your Recovery Passphrase to confirm you remember it.
- If it helps, add it to your password manager or store it
- somewhere safe.
-
+
{_t(
+ "Type in your Recovery Passphrase to confirm you remember it. " +
+ "If it helps, add it to your password manager or store it " +
+ "somewhere safe.",
+ )}
{passPhraseMatch}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index be713bdb37..ba2df1052a 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -981,6 +981,7 @@
"That matches!": "That matches!",
"That doesn't match.": "That doesn't match.",
"Go back to set it again.": "Go back to set it again.",
+ "Type in your Recovery Passphrase to confirm you remember it. If it helps, add it to your password manager or store it somewhere safe.": "Type in your Recovery Passphrase to confirm you remember it. If it helps, add it to your password manager or store it somewhere safe.",
"Repeat your passphrase...": "Repeat your passphrase...",
"Make a copy of this Recovery Key and keep it safe.": "Make a copy of this Recovery Key and keep it safe.",
"As a safety net, you can use it to restore your encrypted message history if you forget your Recovery Passphrase.": "As a safety net, you can use it to restore your encrypted message history if you forget your Recovery Passphrase.",
From 40ef2e0cf4d42f36d4ba51eef9b14d69c0efc42a Mon Sep 17 00:00:00 2001
From: David Baker
Date: Wed, 21 Nov 2018 18:08:44 +0000
Subject: [PATCH 206/218] another missed translation
---
.../views/dialogs/keybackup/CreateKeyBackupDialog.js | 6 ++++--
src/i18n/strings/en_EN.json | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
index 4a5ba67514..8601463e80 100644
--- a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
+++ b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
@@ -340,8 +340,10 @@ export default React.createClass({
_renderPhaseOptOutConfirm: function() {
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
return
- Without setting up Secure Message Recovery, you won't be able to restore your
- encrypted message history if you log out or use another device.
+ {_t(
+ "Without setting up Secure Message Recovery, you won't be able to restore your " +
+ "encrypted message history if you log out or use another device."
+ )}
Date: Wed, 21 Nov 2018 18:17:26 +0000
Subject: [PATCH 207/218] lint
---
src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
index 8601463e80..a3ef8e7f19 100644
--- a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
+++ b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
@@ -342,7 +342,7 @@ export default React.createClass({
return
{_t(
"Without setting up Secure Message Recovery, you won't be able to restore your " +
- "encrypted message history if you log out or use another device."
+ "encrypted message history if you log out or use another device.",
)}
Date: Wed, 21 Nov 2018 18:53:18 +0000
Subject: [PATCH 208/218] Let's use a version of node we can download rather
than dig up
---
jenkins.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jenkins.sh b/jenkins.sh
index 8cf5ee4a1f..f4bb8da449 100755
--- a/jenkins.sh
+++ b/jenkins.sh
@@ -4,7 +4,7 @@ set -e
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
-nvm use 6
+nvm use 10
set -x
From 4cfefe4c3c58bca6a19ed12b06fa8df86fcd875d Mon Sep 17 00:00:00 2001
From: Travis Ralston
Date: Wed, 21 Nov 2018 14:13:56 -0700
Subject: [PATCH 209/218] Introduce an onUsernameBlur and fix hostname parsing
---
src/components/structures/login/Login.js | 20 +++++++++++++++++---
src/components/views/login/PasswordLogin.js | 5 +++--
src/i18n/strings/en_EN.json | 1 +
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js
index 67d9bb7d38..fae7cc37df 100644
--- a/src/components/structures/login/Login.js
+++ b/src/components/structures/login/Login.js
@@ -232,11 +232,24 @@ module.exports = React.createClass({
}).done();
},
- onUsernameChanged: function(username, endOfInput) {
+ onUsernameChanged: function(username) {
this.setState({ username: username });
- if (username[0] === "@" && endOfInput) {
+ },
+
+ onUsernameBlur: function(username) {
+ this.setState({ username: username });
+ if (username[0] === "@") {
const serverName = username.split(':').slice(1).join(':');
- this._tryWellKnownDiscovery(serverName);
+ try {
+ // we have to append 'https://' to make the URL constructor happy
+ // otherwise we get things like 'protocol: matrix.org, pathname: 8448'
+ const url = new URL("https://" + serverName);
+ this._tryWellKnownDiscovery(url.hostname);
+ } catch (e) {
+ console.error("Problem parsing URL or unhandled error doing .well-known discovery");
+ console.error(e);
+ this.setState({discoveryError: _t("Failed to perform homeserver discovery")});
+ }
}
},
@@ -531,6 +544,7 @@ module.exports = React.createClass({
initialPhoneCountry={this.state.phoneCountry}
initialPhoneNumber={this.state.phoneNumber}
onUsernameChanged={this.onUsernameChanged}
+ onUsernameBlur={this.onUsernameBlur}
onPhoneCountryChanged={this.onPhoneCountryChanged}
onPhoneNumberChanged={this.onPhoneNumberChanged}
onForgotPasswordClick={this.props.onForgotPasswordClick}
diff --git a/src/components/views/login/PasswordLogin.js b/src/components/views/login/PasswordLogin.js
index 0e3aed1187..6a5577fb62 100644
--- a/src/components/views/login/PasswordLogin.js
+++ b/src/components/views/login/PasswordLogin.js
@@ -30,6 +30,7 @@ class PasswordLogin extends React.Component {
static defaultProps = {
onError: function() {},
onUsernameChanged: function() {},
+ onUsernameBlur: function() {},
onPasswordChanged: function() {},
onPhoneCountryChanged: function() {},
onPhoneNumberChanged: function() {},
@@ -122,11 +123,11 @@ class PasswordLogin extends React.Component {
onUsernameChanged(ev) {
this.setState({username: ev.target.value});
- this.props.onUsernameChanged(ev.target.value, false);
+ this.props.onUsernameChanged(ev.target.value);
}
onUsernameBlur(ev) {
- this.props.onUsernameChanged(this.state.username, true);
+ this.props.onUsernameBlur(this.state.username);
}
onLoginTypeChange(loginType) {
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index eb0a7fb1db..f9980f5645 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -1288,6 +1288,7 @@
"Incorrect username and/or password.": "Incorrect username and/or password.",
"Please note you are logging into the %(hs)s server, not matrix.org.": "Please note you are logging into the %(hs)s server, not matrix.org.",
"Guest access is disabled on this Home Server.": "Guest access is disabled on this Home Server.",
+ "Failed to perform homeserver discovery": "Failed to perform homeserver discovery",
"The phone number entered looks invalid": "The phone number entered looks invalid",
"Invalid homeserver discovery response": "Invalid homeserver discovery response",
"Cannot find homeserver": "Cannot find homeserver",
From 5600a9d02adc61f9420234a4090d9342743443db Mon Sep 17 00:00:00 2001
From: Travis Ralston
Date: Wed, 21 Nov 2018 14:14:08 -0700
Subject: [PATCH 210/218] Validate the identity server
---
src/components/structures/login/Login.js | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js
index fae7cc37df..6002f058f4 100644
--- a/src/components/structures/login/Login.js
+++ b/src/components/structures/login/Login.js
@@ -115,11 +115,6 @@ module.exports = React.createClass({
// discovery went wrong
if (this.state.discoveryError) return;
- if (this.state.discoveredHsUrl) {
- console.log("Rewriting username because the homeserver was discovered");
- username = username.substring(1).split(":")[0];
- }
-
this.setState({
busy: true,
errorText: null,
@@ -327,16 +322,13 @@ module.exports = React.createClass({
return;
}
- // XXX: We don't verify the identity server URL because sydent doesn't register
- // the route we need.
-
- // console.log("Verifying identity server URL: " + isUrl);
- // const isResponse = await this._getWellKnownObject(`${isUrl}/_matrix/identity/api/v1`);
- // if (!isResponse) {
- // console.error("Invalid /api/v1 response");
- // this.setState({discoveryError: _t("Invalid homeserver discovery response")});
- // return;
- // }
+ console.log("Verifying identity server URL: " + isUrl);
+ const isResponse = await this._getWellKnownObject(`${isUrl}/_matrix/identity/api/v1`);
+ if (!isResponse) {
+ console.error("Invalid /api/v1 response");
+ this.setState({discoveryError: _t("Invalid homeserver discovery response")});
+ return;
+ }
}
this.setState({discoveredHsUrl: hsUrl, discoveredIsUrl: isUrl, discoveryError: ""});
From a8db02ff0253332fd532719a2fe19ddae49a5be9 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Fri, 16 Nov 2018 11:31:46 +0000
Subject: [PATCH 211/218] Handle crypto db version upgrade
Display a dialog telling the user what the situation is with
options to sign out or continue withwout e2e.
Requires https://github.com/matrix-org/matrix-js-sdk/pull/785
---
src/MatrixClientPeg.js | 10 ++++++++++
src/i18n/strings/en_EN.json | 18 +++++++++++-------
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js
index 04b3b47e43..9a77901d2e 100644
--- a/src/MatrixClientPeg.js
+++ b/src/MatrixClientPeg.js
@@ -23,10 +23,12 @@ import Matrix from 'matrix-js-sdk';
import utils from 'matrix-js-sdk/lib/utils';
import EventTimeline from 'matrix-js-sdk/lib/models/event-timeline';
import EventTimelineSet from 'matrix-js-sdk/lib/models/event-timeline-set';
+import sdk from './index';
import createMatrixClient from './utils/createMatrixClient';
import SettingsStore from './settings/SettingsStore';
import MatrixActionCreators from './actions/MatrixActionCreators';
import {phasedRollOutExpiredForUser} from "./PhasedRollOut";
+import Modal from './Modal';
interface MatrixClientCreds {
homeserverUrl: string,
@@ -116,6 +118,14 @@ class MatrixClientPeg {
await this.matrixClient.initCrypto();
}
} catch (e) {
+ if (e.name === 'InvalidCryptoStoreError') {
+ // The js-sdk found a crypto DB too new for it to use
+ const CryptoStoreTooNewDialog =
+ sdk.getComponent("views.dialogs.CryptoStoreTooNewDialog");
+ Modal.createDialog(CryptoStoreTooNewDialog, {
+ host: window.location.host,
+ });
+ }
// this can happen for a number of reasons, the most likely being
// that the olm library was missing. It's not fatal.
console.warn("Unable to initialise e2e: " + e);
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 572cc0d2b3..06f834503b 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -249,10 +249,11 @@
"Enable URL previews for this room (only affects you)": "Enable URL previews for this room (only affects you)",
"Enable URL previews by default for participants in this room": "Enable URL previews by default for participants in this room",
"Room Colour": "Room Colour",
- "Pin unread rooms to the top of the room list": "Pin unread rooms to the top of the room list",
"Pin rooms I'm mentioned in to the top of the room list": "Pin rooms I'm mentioned in to the top of the room list",
+ "Pin unread rooms to the top of the room list": "Pin unread rooms to the top of the room list",
"Enable widget screenshots on supported widgets": "Enable widget screenshots on supported widgets",
"Show empty room list headings": "Show empty room list headings",
+ "Show developer tools": "Show developer tools",
"Collecting app version information": "Collecting app version information",
"Collecting logs": "Collecting logs",
"Uploading report": "Uploading report",
@@ -553,6 +554,7 @@
"Click here to fix": "Click here to fix",
"To send events of type , you must be a": "To send events of type , you must be a",
"Upgrade room to version %(ver)s": "Upgrade room to version %(ver)s",
+ "Open Devtools": "Open Devtools",
"Who can access this room?": "Who can access this room?",
"Only people who have been invited": "Only people who have been invited",
"Anyone who knows the room's link, apart from guests": "Anyone who knows the room's link, apart from guests",
@@ -849,6 +851,11 @@
"Advanced options": "Advanced options",
"Block users on other matrix homeservers from joining this room": "Block users on other matrix homeservers from joining this room",
"This setting cannot be changed later!": "This setting cannot be changed later!",
+ "Sign out": "Sign out",
+ "To avoid losing your chat history, you must export your room keys before logging out. You will need to go back to the newer version of Riot to do this": "To avoid losing your chat history, you must export your room keys before logging out. You will need to go back to the newer version of Riot to do this",
+ "You've previously used a newer version of Riot on %(host)s. To use this version again with end to end encryption, you will need to sign out and back in again. ": "You've previously used a newer version of Riot on %(host)s. To use this version again with end to end encryption, you will need to sign out and back in again. ",
+ "Incompatible Database": "Incompatible Database",
+ "Continue With Encryption Disabled": "Continue With Encryption Disabled",
"Failed to indicate account erasure": "Failed to indicate account erasure",
"Unknown error": "Unknown error",
"Incorrect password": "Incorrect password",
@@ -903,7 +910,6 @@
"Update any local room aliases to point to the new room": "Update any local room aliases to point to the new room",
"Stop users from speaking in the old version of the room, and post a message advising users to move to the new room": "Stop users from speaking in the old version of the room, and post a message advising users to move to the new room",
"Put a link back to the old room at the start of the new room so people can see old messages": "Put a link back to the old room at the start of the new room so people can see old messages",
- "Sign out": "Sign out",
"Log out and remove encryption keys?": "Log out and remove encryption keys?",
"Clear Storage and Sign Out": "Clear Storage and Sign Out",
"Send Logs": "Send Logs",
@@ -927,9 +933,7 @@
"Username available": "Username available",
"To get started, please pick a username!": "To get started, please pick a username!",
"This will be your account name on the homeserver, or you can pick a different server.": "This will be your account name on the homeserver, or you can pick a different server.",
- "If you would like to create a Matrix account you can register now.": "If you would like to create a Matrix account you can register now.",
"If you already have a Matrix account you can log in instead.": "If you already have a Matrix account you can log in instead.",
- "You are currently using Riot anonymously as a guest.": "You are currently using Riot anonymously as a guest.",
"You have successfully set a password!": "You have successfully set a password!",
"You have successfully set a password and an email address!": "You have successfully set a password and an email address!",
"You can now return to your account after signing out, and sign in on other devices.": "You can now return to your account after signing out, and sign in on other devices.",
@@ -1036,6 +1040,8 @@
"This Home server does not support communities": "This Home server does not support communities",
"Failed to load %(groupId)s": "Failed to load %(groupId)s",
"Couldn't load home page": "Couldn't load home page",
+ "You are currently using Riot anonymously as a guest.": "You are currently using Riot anonymously as a guest.",
+ "If you would like to create a Matrix account you can register now.": "If you would like to create a Matrix account you can register now.",
"Login": "Login",
"Failed to reject invitation": "Failed to reject invitation",
"This room is not public. You will not be able to rejoin without an invite.": "This room is not public. You will not be able to rejoin without an invite.",
@@ -1272,7 +1278,5 @@
"Import": "Import",
"Failed to set direct chat tag": "Failed to set direct chat tag",
"Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room",
- "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room",
- "Open Devtools": "Open Devtools",
- "Show developer tools": "Show developer tools"
+ "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room"
}
From ab40a0b264e90b51024df3a88e35cc413109b635 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Fri, 16 Nov 2018 11:33:09 +0000
Subject: [PATCH 212/218] Actually add the dialog
---
.../views/dialogs/CryptoStoreTooNewDialog.js | 71 +++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 src/components/views/dialogs/CryptoStoreTooNewDialog.js
diff --git a/src/components/views/dialogs/CryptoStoreTooNewDialog.js b/src/components/views/dialogs/CryptoStoreTooNewDialog.js
new file mode 100644
index 0000000000..0146420f46
--- /dev/null
+++ b/src/components/views/dialogs/CryptoStoreTooNewDialog.js
@@ -0,0 +1,71 @@
+/*
+Copyright 2018 New Vector Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import React from 'react';
+import sdk from '../../../index';
+import dis from '../../../dispatcher';
+import { _t } from '../../../languageHandler';
+import Modal from '../../../Modal';
+
+export default (props) => {
+ const _onLogoutClicked = () => {
+ const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
+ Modal.createTrackedDialog('Logout e2e db too new', '', QuestionDialog, {
+ title: _t("Sign out"),
+ description: _t(
+ "To avoid losing your chat history, you must export your room keys " +
+ "before logging out. You will need to go back to the newer version of " +
+ "Riot to do this",
+ ),
+ button: _t("Sign out"),
+ focus: false,
+ onFinished: (doLogout) => {
+ if (doLogout) {
+ dis.dispatch({action: 'logout'});
+ props.onFinished();
+ }
+ },
+ });
+ };
+
+ const description =
+ _t("You've previously used a newer version of Riot on %(host)s. " +
+ "To use this version again with end to end encryption, you will " +
+ "need to sign out and back in again. ",
+ {host: props.host},
+ );
+
+ const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
+ const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
+ return (
+
+ { description }
+
+
+
+
+ );
+};
From a25ae924b12d32a04237eb156a9f1e3286298b88 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Thu, 22 Nov 2018 16:49:20 +0000
Subject: [PATCH 213/218] js-sdk v0.14.1
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index d2e54a2621..bf44460f80 100644
--- a/package.json
+++ b/package.json
@@ -75,7 +75,7 @@
"linkifyjs": "^2.1.6",
"lodash": "^4.13.1",
"lolex": "2.3.2",
- "matrix-js-sdk": "0.14.0",
+ "matrix-js-sdk": "0.14.1",
"optimist": "^0.6.1",
"pako": "^1.0.5",
"prop-types": "^15.5.8",
From e27a4af8179fc40c67c487dfda5e86c39e5f379b Mon Sep 17 00:00:00 2001
From: David Baker
Date: Thu, 22 Nov 2018 16:54:21 +0000
Subject: [PATCH 214/218] Prepare changelog for v0.14.6
---
CHANGELOG.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1486578025..eea47dcb8f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+Changes in [0.14.6](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.14.6) (2018-11-22)
+=====================================================================================================
+[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.14.5...v0.14.6)
+
+ * Warning when crypto DB is too new to use.
+
Changes in [0.14.5](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.14.5) (2018-11-19)
=====================================================================================================
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.14.5-rc.2...v0.14.5)
From 60e22b7e0fdf7a117357b6a8813935c57cf2a090 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Thu, 22 Nov 2018 16:54:53 +0000
Subject: [PATCH 215/218] v0.14.6
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index bf44460f80..b356c72d03 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "matrix-react-sdk",
- "version": "0.14.5",
+ "version": "0.14.6",
"description": "SDK for matrix.org using React",
"author": "matrix.org",
"repository": {
From d443d6173dc5f4a2e23589d0138f7602f5196884 Mon Sep 17 00:00:00 2001
From: David Baker
Date: Thu, 22 Nov 2018 19:06:58 +0000
Subject: [PATCH 216/218] Forgot to enable continue button on download
---
src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
index 046f1d703e..2f43d18072 100644
--- a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
+++ b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js
@@ -315,7 +315,7 @@ export default React.createClass({