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.

3 lines
13 KiB

/*! For license information please see 0.js.LICENSE.txt */
(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{1109:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return v}));var s=a(2),r=a.n(s),n=a(43),o=a.n(n),i=a(217),c=a.n(i),l=a(46),u=a(47),h=a(45),p=a.n(h),m=a(44),d=a(107),y=a(52),b=a(257),k=a(256);const f=0,_=5;class v extends o.a.PureComponent{constructor(e){super(e),r()(this,"_collectRecoveryKeyNode",e=>{this._recoveryKeyNode=e}),r()(this,"_onCopyClick",()=>{Object(b.a)(this._recoveryKeyNode)&&this.setState({copied:!0,phase:3})}),r()(this,"_onDownloadClick",()=>{const e=new Blob([this._keyBackupInfo.recovery_key],{type:"text/plain;charset=us-ascii"});c.a.saveAs(e,"recovery-key.txt"),this.setState({downloaded:!0,phase:3})}),r()(this,"_createBackup",async()=>{const{secureSecretStorage:e}=this.state;let t;this.setState({phase:4,error:null});try{e?await Object(d.b)(async()=>{t=await u.a.get().prepareKeyBackupVersion(null,{secureSecretStorage:!0}),t=await u.a.get().createKeyBackupVersion(t)}):t=await u.a.get().createKeyBackupVersion(this._keyBackupInfo),await u.a.get().scheduleAllGroupSessionsForBackup(),this.setState({phase:_})}catch(e){console.error("Error creating key backup",e),t&&u.a.get().deleteKeyBackupVersion(t.version),this.setState({error:e})}}),r()(this,"_onCancel",()=>{this.props.onFinished(!1)}),r()(this,"_onDone",()=>{this.props.onFinished(!0)}),r()(this,"_onOptOutClick",()=>{this.setState({phase:6})}),r()(this,"_onSetUpClick",()=>{this.setState({phase:f})}),r()(this,"_onSkipPassPhraseClick",async()=>{this._keyBackupInfo=await u.a.get().prepareKeyBackupVersion(),this.setState({copied:!1,downloaded:!1,phase:2})}),r()(this,"_onPassPhraseNextClick",async e=>{if(e.preventDefault(),this._passphraseField.current){if(await this._passphraseField.current.validate({allowEmpty:!1}),!this._passphraseField.current.state.valid)return this._passphraseField.current.focus(),void this._passphraseField.current.validate({allowEmpty:!1,focused:!0});this.setState({phase:1})}}),r()(this,"_onPassPhraseConfirmNextClick",async e=>{e.preventDefault(),this.state.passPhrase===this.state.passPhraseConfirm&&(this._keyBackupInfo=await u.a.get().prepareKeyBackupVersion(this.state.passPhrase),this.setState({copied:!1,downloaded:!1,phase:2}))}),r()(this,"_onSetAgainClick",()=>{this.setState({passPhrase:"",passPhraseValid:!1,passPhraseConfirm:"",phase:f})}),r()(this,"_onKeepItSafeBackClick",()=>{this.setState({phase:2})}),r()(this,"_onPassPhraseValidate",e=>{this.setState({passPhraseValid:e.valid})}),r()(this,"_onPassPhraseChange",e=>{this.setState({passPhrase:e.target.value})}),r()(this,"_onPassPhraseConfirmChange",e=>{this.setState({passPhraseConfirm:e.target.value})}),this._recoveryKeyNode=null,this._keyBackupInfo=null,this.state={secureSecretStorage:null,phase:f,passPhrase:"",passPhraseValid:!1,passPhraseConfirm:"",copied:!1,downloaded:!1},this._passphraseField=Object(n.createRef)()}async componentDidMount(){const e=u.a.get(),t=await e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing");this.setState({secureSecretStorage:t}),t&&(this.setState({phase:4}),this._createBackup())}_renderPhasePassPhrase(){const e=l.getComponent("views.elements.DialogButtons");return o.a.createElement("form",{onSubmit:this._onPassPhraseNextClick},o.a.createElement("p",null,Object(m.a)("<b>Warning</b>: You should only set up key backup from a trusted computer.",{},{b:e=>o.a.createElement("b",null,e)})),o.a.createElement("p",null,Object(m.a)("We'll store an encrypted copy of your keys on our server. Secure your backup with a recovery passphrase.")),o.a.createElement("p",null,Object(m.a)("For maximum security, this should be different from your account password.")),o.a.createElement("div",{className:"mx_CreateKeyBackupDialog_primaryContainer"},o.a.createElement("div",{className:"mx_CreateKeyBackupDialog_passPhraseContainer"},o.a.createElement(k.a,{className:"mx_CreateKeyBackupDialog_passPhraseInput",onChange:this._onPassPhraseChange,minScore:4,value:this.state.passPhrase,onValidate:this._onPassPhraseValidate,fieldRef:this._passphraseField,autoFocus:!0,label:Object(m.b)("Enter a recov
//# sourceMappingURL=0.js.map