Implement Megolm key importing

This commit is contained in:
Richard van der Hoff 2017-01-24 15:57:42 +00:00
parent e23deac1bb
commit b85f53cadd
3 changed files with 194 additions and 15 deletions

View file

@ -396,7 +396,21 @@ module.exports = React.createClass({
_onExportE2eKeysClicked: function() {
Modal.createDialogAsync(
(cb) => {
require(['../../async-components/views/dialogs/ExportE2eKeysDialog'], cb);
require.ensure(['../../async-components/views/dialogs/ExportE2eKeysDialog'], () => {
cb(require('../../async-components/views/dialogs/ExportE2eKeysDialog'));
}, "e2e-export");
}, {
matrixClient: MatrixClientPeg.get(),
}
);
},
_onImportE2eKeysClicked: function() {
Modal.createDialogAsync(
(cb) => {
require.ensure(['../../async-components/views/dialogs/ImportE2eKeysDialog'], () => {
cb(require('../../async-components/views/dialogs/ImportE2eKeysDialog'));
}, "e2e-export");
}, {
matrixClient: MatrixClientPeg.get(),
}
@ -473,7 +487,8 @@ module.exports = React.createClass({
const deviceId = client.deviceId;
const identityKey = client.getDeviceEd25519Key() || "<not supported>";
let exportButton = null;
let exportButton = null,
importButton = null;
if (client.isCryptoEnabled) {
exportButton = (
@ -482,6 +497,12 @@ module.exports = React.createClass({
Export E2E room keys
</AccessibleButton>
);
importButton = (
<AccessibleButton className="mx_UserSettings_button"
onClick={this._onImportE2eKeysClicked}>
Import E2E room keys
</AccessibleButton>
);
}
return (
<div>
@ -492,6 +513,7 @@ module.exports = React.createClass({
<li><label>Device key:</label> <span><code><b>{identityKey}</b></code></span></li>
</ul>
{exportButton}
{importButton}
</div>
</div>
);