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
10 KiB
2 lines
10 KiB
2 years ago
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{912:function(e,a,t){"use strict";t.r(a),t.d(a,"default",(function(){return f}));var s,r=t(13),n=t.n(r),i=t(120),c=t.n(i),o=t(400),l=t.n(o),h=t(1),u=t(122),p=t(121),m=t(250),y=t(123),d=t(228),k=t(345),b=t(134),P=t(135),C=t(145);!function(e){e.Passphrase="passphrase",e.PassphraseConfirm="passphrase_confirm",e.ShowKey="show_key",e.KeepItSafe="keep_it_safe",e.BackingUp="backing_up",e.Done="done",e.OptOutConfirm="opt_out_confirm"}(s||(s={}));class f extends c.a.PureComponent{constructor(e){super(e),n()(this,"keyBackupInfo",void 0),n()(this,"recoveryKeyNode",Object(i.createRef)()),n()(this,"passphraseField",Object(i.createRef)()),n()(this,"onCopyClick",(()=>{Object(d.a)(this.recoveryKeyNode.current)&&this.setState({copied:!0,phase:s.KeepItSafe})})),n()(this,"onDownloadClick",(()=>{const e=new Blob([this.keyBackupInfo.recovery_key],{type:"text/plain;charset=us-ascii"});l.a.saveAs(e,"security-key.txt"),this.setState({downloaded:!0,phase:s.KeepItSafe})})),n()(this,"createBackup",(async()=>{const{secureSecretStorage:e}=this.state;let a;this.setState({phase:s.BackingUp,error:void 0});try{e?await Object(m.b)((async()=>{a=await u.a.get().prepareKeyBackupVersion(null,{secureSecretStorage:!0}),a=await u.a.get().createKeyBackupVersion(a)})):a=await u.a.get().createKeyBackupVersion(this.keyBackupInfo),await u.a.get().scheduleAllGroupSessionsForBackup(),this.setState({phase:s.Done})}catch(e){h.a.error("Error creating key backup",e),a&&u.a.get().deleteKeyBackupVersion(a.version),this.setState({error:e})}})),n()(this,"onCancel",(()=>{this.props.onFinished(!1)})),n()(this,"onDone",(()=>{this.props.onFinished(!0)})),n()(this,"onSetUpClick",(()=>{this.setState({phase:s.Passphrase})})),n()(this,"onSkipPassPhraseClick",(async()=>{this.keyBackupInfo=await u.a.get().prepareKeyBackupVersion(),this.setState({copied:!1,downloaded:!1,phase:s.ShowKey})})),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:s.PassphraseConfirm})}})),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:s.ShowKey}))})),n()(this,"onSetAgainClick",(()=>{this.setState({passPhrase:"",passPhraseValid:!1,passPhraseConfirm:"",phase:s.Passphrase})})),n()(this,"onKeepItSafeBackClick",(()=>{this.setState({phase:s.ShowKey})})),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.state={secureSecretStorage:null,phase:s.Passphrase,passPhrase:"",passPhraseValid:!1,passPhraseConfirm:"",copied:!1,downloaded:!1}}async componentDidMount(){const e=u.a.get(),a=await e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing");this.setState({secureSecretStorage:a}),a&&(this.setState({phase:s.BackingUp}),this.createBackup())}renderPhasePassPhrase(){return c.a.createElement("form",{onSubmit:this.onPassPhraseNextClick},c.a.createElement("p",null,Object(p.a)("<b>Warning</b>: you should only set up key backup from a trusted computer.",{},{b:e=>c.a.createElement("b",null,e)})),c.a.createElement("p",null,Object(p.a)("We'll store an encrypted copy of your keys on our server. Secure your backup with a Security Phrase.")),c.a.createElement("p",null,Object(p.a)("For maximum security, this should be different from your account password.")),c.a.createElement("div",{className:"mx_CreateKeyBackupDialog_primaryContainer"},c.a.createElement("div",{className:"mx_CreateKeyBackupDialog_passPhraseContainer"},c.a.createElement(k.a,{className:"mx_CreateKeyBackupDialog_p
|
||
|
//# sourceMappingURL=8.js.map
|