You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
9.7 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{1402:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return f}));var a=n(18),r=n.n(a),o=n(314),s=n.n(o),i=n(87),c=n.n(i),l=n(91),u=n.n(l),p=n(88),d=n(178),h=n(507),m=n(90);class f extends c.a.Component{constructor(e){super(e),r()(this,"_onPassphraseFormSubmit",e=>{e.preventDefault();const t=this._passphrase1.current.value;return t!==this._passphrase2.current.value?(this.setState({errStr:Object(p.a)("Passphrases must match")}),!1):t?(this._startExport(t),!1):(this.setState({errStr:Object(p.a)("Passphrase must not be empty")}),!1)}),r()(this,"_onCancelClick",e=>(e.preventDefault(),this.props.onFinished(!1),!1)),this._unmounted=!1,this._passphrase1=Object(i.createRef)(),this._passphrase2=Object(i.createRef)(),this.state={phase:1,errStr:null}}componentWillUnmount(){this._unmounted=!0}_startExport(e){Promise.resolve().then(()=>this.props.matrixClient.exportRoomKeys()).then(t=>h.b(JSON.stringify(t),e)).then(e=>{const t=new Blob([e],{type:"text/plain;charset=us-ascii"});s.a.saveAs(t,"element-keys.txt"),this.props.onFinished(!0)}).catch(e=>{if(console.error("Error exporting e2e keys:",e),this._unmounted)return;const t=e.friendlyText||Object(p.a)("Unknown error");this.setState({errStr:t,phase:1})}),this.setState({errStr:null,phase:2})}render(){const e=m.getComponent("views.dialogs.BaseDialog"),t=2===this.state.phase;return c.a.createElement(e,{className:"mx_exportE2eKeysDialog",onFinished:this.props.onFinished,title:Object(p.a)("Export room keys")},c.a.createElement("form",{onSubmit:this._onPassphraseFormSubmit},c.a.createElement("div",{className:"mx_Dialog_content"},c.a.createElement("p",null,Object(p.a)("This process allows you to export the keys for messages you have received in encrypted rooms to a local file. You will then be able to import the file into another Matrix client in the future, so that client will also be able to decrypt these messages.")),c.a.createElement("p",null,Object(p.a)("The exported file will allow anyone who can read it to decrypt any encrypted messages that you can see, so you should be careful to keep it secure. To help with this, you should enter a passphrase below, which will be used to encrypt the exported data. It will only be possible to import the data by using the same passphrase.")),c.a.createElement("div",{className:"error"},this.state.errStr),c.a.createElement("div",{className:"mx_E2eKeysDialog_inputTable"},c.a.createElement("div",{className:"mx_E2eKeysDialog_inputRow"},c.a.createElement("div",{className:"mx_E2eKeysDialog_inputLabel"},c.a.createElement("label",{htmlFor:"passphrase1"},Object(p.a)("Enter passphrase"))),c.a.createElement("div",{className:"mx_E2eKeysDialog_inputCell"},c.a.createElement("input",{ref:this._passphrase1,id:"passphrase1",autoFocus:!0,size:"64",type:"password",disabled:t}))),c.a.createElement("div",{className:"mx_E2eKeysDialog_inputRow"},c.a.createElement("div",{className:"mx_E2eKeysDialog_inputLabel"},c.a.createElement("label",{htmlFor:"passphrase2"},Object(p.a)("Confirm passphrase"))),c.a.createElement("div",{className:"mx_E2eKeysDialog_inputCell"},c.a.createElement("input",{ref:this._passphrase2,id:"passphrase2",size:"64",type:"password",disabled:t}))))),c.a.createElement("div",{className:"mx_Dialog_buttons"},c.a.createElement("input",{className:"mx_Dialog_primary",type:"submit",value:Object(p.a)("Export"),disabled:t}),c.a.createElement("button",{onClick:this._onCancelClick,disabled:t},Object(p.a)("Cancel")))))}}r()(f,"propTypes",{matrixClient:u.a.instanceOf(d.b).isRequired,onFinished:u.a.func.isRequired})},314:function(e,t,n){(function(n){var a,r,o;r=[],void 0===(o="function"==typeof(a=function(){"use strict";function t(e,t,n){var a=new XMLHttpRequest;a.open("GET",e),a.responseType="blob",a.onload=function(){i(a.response,t,n)},a.onerror=function(){console.error("could not download file")},a.send()}function a(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function r(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=docu
//# sourceMappingURL=4.js.map