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
19 KiB
2 lines
19 KiB
5 years ago
|
/*! For license information please see 3.js.LICENSE.txt */
|
||
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{1441:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return v}));var s=a(3),n=a.n(s),r=a(33),o=a.n(r),i=a(35),c=a.n(i),l=a(36),u=a(37),h=a(712),p=a(178),d=a.n(p),m=a(34),y=a(41),g=a(84);const b=3;class v extends o.a.PureComponent{constructor(e){super(e),n()(this,"_onKeyBackupStatusChange",()=>{2===this.state.phase&&this._fetchBackupInfo()}),n()(this,"_collectRecoveryKeyNode",e=>{this._recoveryKeyNode=e}),n()(this,"_onUseKeyBackupChange",e=>{this.setState({useKeyBackup:e})}),n()(this,"_onMigrateFormSubmit",e=>{e.preventDefault(),this.state.backupSigStatus.usable?this._bootstrapSecretStorage():this._restoreBackup()}),n()(this,"_onCopyClick",()=>{!function(e){const t=document.createRange();t.selectNodeContents(e);const a=window.getSelection();a.removeAllRanges(),a.addRange(t)}(this._recoveryKeyNode),document.execCommand("copy")&&this.setState({copied:!0,phase:6})}),n()(this,"_onDownloadClick",()=>{const e=new Blob([this._recoveryKey.encodedPrivateKey],{type:"text/plain;charset=us-ascii"});d.a.saveAs(e,"recovery-key.txt"),this.setState({downloaded:!0,phase:6})}),n()(this,"_doBootstrapUIAuth",async e=>{if(this.state.canUploadKeysWithPasswordOnly&&this.state.accountPassword)await e({type:"m.login.password",identifier:{type:"m.id.user",user:u.a.get().getUserId()},user:u.a.get().getUserId(),password:this.state.accountPassword});else{const t=l.getComponent("dialogs.InteractiveAuthDialog"),{finished:a}=y.a.createTrackedDialog("Cross-signing keys dialog","",t,{title:Object(m.a)("Setting up keys"),matrixClient:u.a.get(),makeRequest:e}),[s]=await a;if(!s)throw new Error("Cross-signing key upload auth canceled")}}),n()(this,"_bootstrapSecretStorage",async()=>{this.setState({phase:7,error:null});const e=u.a.get(),{force:t}=this.props;try{t?await e.bootstrapSecretStorage({authUploadDeviceSigningKeys:this._doBootstrapUIAuth,createSecretStorageKey:async()=>this._recoveryKey,setupNewKeyBackup:!0,setupNewSecretStorage:!0}):await e.bootstrapSecretStorage({authUploadDeviceSigningKeys:this._doBootstrapUIAuth,createSecretStorageKey:async()=>this._recoveryKey,keyBackupInfo:this.state.backupInfo,setupNewKeyBackup:!this.state.backupInfo&&this.state.useKeyBackup,getKeyBackupPassphrase:()=>this._backupKey?this._backupKey:Object(g.d)()}),this.setState({phase:8})}catch(e){this.state.canUploadKeysWithPasswordOnly&&401===e.httpStatus&&e.data.flows?this.setState({accountPassword:"",accountPasswordCorrect:!1,phase:2}):this.setState({error:e}),console.error("Error bootstrapping secret storage",e)}}),n()(this,"_onCancel",()=>{this.props.onFinished(!1)}),n()(this,"_onDone",()=>{this.props.onFinished(!0)}),n()(this,"_restoreBackup",async()=>{const e=l.getComponent("dialogs.keybackup.RestoreKeyBackupDialog"),{finished:t}=y.a.createTrackedDialog("Restore Backup","",e,{showSummary:!1,keyCallback:e=>this._backupKey=e},null,!1,!1);await t;const{backupSigStatus:a}=await this._fetchBackupInfo();a.usable&&this.state.canUploadKeysWithPasswordOnly&&this.state.accountPassword&&this._bootstrapSecretStorage()}),n()(this,"_onLoadRetryClick",()=>{this.setState({phase:0}),this._fetchBackupInfo()}),n()(this,"_onSkipSetupClick",()=>{this.setState({phase:9})}),n()(this,"_onSetUpClick",()=>{this.setState({phase:b})}),n()(this,"_onSkipPassPhraseClick",async()=>{this._recoveryKey=await u.a.get().createRecoveryKeyFromPassphrase(),this.setState({copied:!1,downloaded:!1,phase:5})}),n()(this,"_onPassPhraseNextClick",async e=>{e.preventDefault(),null!==this._setZxcvbnResultTimeout&&(clearTimeout(this._setZxcvbnResultTimeout),this._setZxcvbnResultTimeout=null,await new Promise(e=>{this.setState({zxcvbnResult:Object(h.scorePassword)(this.state.passPhrase)},e)})),this._passPhraseIsValid()&&this.setState({phase:4})}),n()(this,"_onPassPhraseConfirmNextClick",async e=>{e.preventDefault(),this.state.passPhrase===this.state.passPhraseConfirm&&(this._recoveryKey=await u.a.get().createRecoveryKeyFromPassphrase(this.state.passPhrase),this.setState({copied:!1,downloaded:!1,phase:5}))}),n()(this,"_onSetAgainClick",()=>{this.s
|