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
13 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{1321:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return C}));var s=a(83),n=a.n(s),r=a(82),o=a.n(r),i=a(289),c=a.n(i),l=a(86),u=a(87),h=a(85),p=a.n(h),m=a(84),d=a(165),y=a(92),b=a(340),f=a(288);const k=0,_=5;class C extends o.a.PureComponent{constructor(e){super(e),n()(this,"_collectRecoveryKeyNode",e=>{this._recoveryKeyNode=e}),n()(this,"_onCopyClick",()=>{Object(b.a)(this._recoveryKeyNode)&&this.setState({copied:!0,phase:3})}),n()(this,"_onDownloadClick",()=>{const e=new Blob([this._keyBackupInfo.recovery_key],{type:"text/plain;charset=us-ascii"});c.a.saveAs(e,"security-key.txt"),this.setState({downloaded:!0,phase:3})}),n()(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})}}),n()(this,"_onCancel",()=>{this.props.onFinished(!1)}),n()(this,"_onDone",()=>{this.props.onFinished(!0)}),n()(this,"_onOptOutClick",()=>{this.setState({phase:6})}),n()(this,"_onSetUpClick",()=>{this.setState({phase:k})}),n()(this,"_onSkipPassPhraseClick",async()=>{this._keyBackupInfo=await u.a.get().prepareKeyBackupVersion(),this.setState({copied:!1,downloaded:!1,phase:2})}),n()(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})}}),n()(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}))}),n()(this,"_onSetAgainClick",()=>{this.setState({passPhrase:"",passPhraseValid:!1,passPhraseConfirm:"",phase:k})}),n()(this,"_onKeepItSafeBackClick",()=>{this.setState({phase:2})}),n()(this,"_onPassPhraseValidate",e=>{this.setState({passPhraseValid:e.valid})}),n()(this,"_onPassPhraseChange",e=>{this.setState({passPhrase:e.target.value})}),n()(this,"_onPassPhraseConfirmChange",e=>{this.setState({passPhraseConfirm:e.target.value})}),this._recoveryKeyNode=null,this._keyBackupInfo=null,this.state={secureSecretStorage:null,phase:k,passPhrase:"",passPhraseValid:!1,passPhraseConfirm:"",copied:!1,downloaded:!1},this._passphraseField=Object(r.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 Security Phrase.")),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(f.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 Security
//# sourceMappingURL=4.js.map