diff --git a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js index a3ef8e7f19..046f1d703e 100644 --- a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js +++ b/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js @@ -18,6 +18,8 @@ import React from 'react'; import sdk from '../../../../index'; import MatrixClientPeg from '../../../../MatrixClientPeg'; +import FileSaver from 'file-saver'; + import { _t, _td } from '../../../../languageHandler'; const PHASE_PASSPHRASE = 0; @@ -49,6 +51,7 @@ export default React.createClass({ passPhrase: '', passPhraseConfirm: '', copied: false, + downloaded: false, }; }, @@ -72,6 +75,18 @@ export default React.createClass({ } }, + _onDownloadClick: function() { + const blob = new Blob([this._keyBackupInfo.recovery_key], { + type: 'text/plain;charset=us-ascii', + }); + FileSaver.saveAs(blob, 'recovery-key.txt'); + + this.setState({ + downloaded: true, + phase: PHASE_KEEPITSAFE, + }); + }, + _createBackup: function() { this.setState({ phase: PHASE_BACKINGUP, @@ -282,13 +297,21 @@ export default React.createClass({
{_t("Your Recovery Key")}
+ { + // 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 f11c5e22f4..8de1404508 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -987,8 +987,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",