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
6.8 KiB
2 lines
6.8 KiB
2 years ago
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{1536:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return m}));var r,n=a(13),s=a.n(n),o=a(400),i=a.n(o),c=a(120),l=a.n(c),h=a(1),p=a(121),u=a(644),d=a(135),y=a(139);!function(e){e.Edit="edit",e.Exporting="exporting"}(r||(r={}));class m extends l.a.Component{constructor(e){super(e),s()(this,"unmounted",!1),s()(this,"onPassphraseFormSubmit",(e=>{e.preventDefault();const t=this.state.passphrase1;return t!==this.state.passphrase2?(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)})),s()(this,"onCancelClick",(e=>(e.preventDefault(),this.props.onFinished(!1),!1))),s()(this,"onPassphraseChange",((e,t)=>{this.setState({[t]:e.target.value})})),this.state={phase:r.Edit,errStr:null,passphrase1:"",passphrase2:""}}componentWillUnmount(){this.unmounted=!0}startExport(e){Promise.resolve().then((()=>this.props.matrixClient.exportRoomKeys())).then((t=>u.b(JSON.stringify(t),e))).then((e=>{const t=new Blob([e],{type:"text/plain;charset=us-ascii"});i.a.saveAs(t,"element-keys.txt"),this.props.onFinished(!0)})).catch((e=>{if(h.a.error("Error exporting e2e keys:",e),this.unmounted)return;const t=e.friendlyText||Object(p.a)("Unknown error");this.setState({errStr:t,phase:r.Edit})})),this.setState({errStr:null,phase:r.Exporting})}render(){const e=this.state.phase===r.Exporting;return l.a.createElement(d.a,{className:"mx_exportE2eKeysDialog",onFinished:this.props.onFinished,title:Object(p.a)("Export room keys")},l.a.createElement("form",{onSubmit:this.onPassphraseFormSubmit},l.a.createElement("div",{className:"mx_Dialog_content"},l.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.")),l.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.")),l.a.createElement("div",{className:"error"},this.state.errStr),l.a.createElement("div",{className:"mx_E2eKeysDialog_inputTable"},l.a.createElement("div",{className:"mx_E2eKeysDialog_inputRow"},l.a.createElement(y.a,{label:Object(p.a)("Enter passphrase"),value:this.state.passphrase1,onChange:e=>this.onPassphraseChange(e,"passphrase1"),autoFocus:!0,size:64,type:"password",disabled:e})),l.a.createElement("div",{className:"mx_E2eKeysDialog_inputRow"},l.a.createElement(y.a,{label:Object(p.a)("Confirm passphrase"),value:this.state.passphrase2,onChange:e=>this.onPassphraseChange(e,"passphrase2"),size:64,type:"password",disabled:e})))),l.a.createElement("div",{className:"mx_Dialog_buttons"},l.a.createElement("input",{className:"mx_Dialog_primary",type:"submit",value:Object(p.a)("Export"),disabled:e}),l.a.createElement("button",{onClick:this.onCancelClick,disabled:e},Object(p.a)("Cancel")))))}}},644:function(e,t,a){"use strict";a.d(t,"a",(function(){return l})),a.d(t,"b",(function(){return h}));var r=a(1),n=a(121),s=a(131);const o=window.crypto.subtle||window.crypto.webkitSubtle;function i(e,t){return{message:e,friendlyText:t}}function c(){return Object(n.a)("Your browser does not support the required cryptography extensions")}async function l(e,t){const a=function(e){const t=(new TextDecoder).decode(new Uint8Array(e));let a=0;for(;;){const e=t.indexOf("\n",a);if(e<0)throw new Error("Header line not found");const r=t.slice(a,e).trim();if(a=e+1,r===u)break}const r=a;for(;;){const e=t.indexOf("\n",a);if(t.slice(a,e<0?void 0:e).trim()===d)break;if(e<0)throw new Error("Trailer line not found");a=e+1}const n=a;return function(e){const t=window.atob(e),a=new Uint8Array(t.length);for(let e=0;e<t.
|
||
|
//# sourceMappingURL=7.js.map
|