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
19 KiB
3 lines
19 KiB
5 years ago
|
/*! For license information please see 2.js.LICENSE.txt */
|
||
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{1182:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return f}));var s=a(3),r=a.n(s),n=a(33),o=a.n(n),i=a(35),c=a.n(i),l=a(36),u=a(37),h=a(198),p=a.n(h),d=a(34),m=a(41),y=a(90),g=a(235),b=a(129),k=a(234);const S=3;class f extends o.a.PureComponent{constructor(e){super(e),r()(this,"_onKeyBackupStatusChange",()=>{2===this.state.phase&&this._fetchBackupInfo()}),r()(this,"_collectRecoveryKeyNode",e=>{this._recoveryKeyNode=e}),r()(this,"_onUseKeyBackupChange",e=>{this.setState({useKeyBackup:e})}),r()(this,"_onMigrateFormSubmit",e=>{e.preventDefault(),this.state.backupSigStatus.usable?this._bootstrapSecretStorage():this._restoreBackup()}),r()(this,"_onCopyClick",()=>{Object(g.a)(this._recoveryKeyNode)&&this.setState({copied:!0,phase:6})}),r()(this,"_onDownloadClick",()=>{const e=new Blob([this._recoveryKey.encodedPrivateKey],{type:"text/plain;charset=us-ascii"});p.a.saveAs(e,"recovery-key.txt"),this.setState({downloaded:!0,phase:6})}),r()(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"),a={[b.c.PHASE_PREAUTH]:{title:Object(d.a)("Use Single Sign On to continue"),body:Object(d.a)("To continue, use Single Sign On to prove your identity."),continueText:Object(d.a)("Single Sign On"),continueKind:"primary"},[b.c.PHASE_POSTAUTH]:{title:Object(d.a)("Confirm encryption setup"),body:Object(d.a)("Click the button below to confirm setting up encryption."),continueText:Object(d.a)("Confirm"),continueKind:"primary"}},{finished:s}=m.a.createTrackedDialog("Cross-signing keys dialog","",t,{title:Object(d.a)("Setting up keys"),matrixClient:u.a.get(),makeRequest:e,aestheticsForStagePhases:{[b.c.LOGIN_TYPE]:a,[b.c.UNSTABLE_LOGIN_TYPE]:a}}),[r]=await s;if(!r)throw new Error("Cross-signing key upload auth canceled")}}),r()(this,"_bootstrapSecretStorage",async()=>{this.setState({phase:7,error:null});const e=u.a.get(),{force:t}=this.props;try{t?(console.log("Forcing secret storage reset"),await e.bootstrapSecretStorage({authUploadDeviceSigningKeys:this._doBootstrapUIAuth,createSecretStorageKey:async()=>this._recoveryKey,setupNewKeyBackup:this.state.useKeyBackup,setupNewSecretStorage:!0}),!this.state.useKeyBackup&&this.state.backupInfo&&(console.log("Deleting invalid key backup (secrets have been reset; key backup not requested)"),await e.deleteKeyBackupVersion(this.state.backupInfo.version))):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(y.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)}}),r()(this,"_onCancel",()=>{this.props.onFinished(!1)}),r()(this,"_onDone",()=>{this.props.onFinished(!0)}),r()(this,"_restoreBackup",async()=>{const e=l.getComponent("dialogs.keybackup.RestoreKeyBackupDialog"),{finished:t}=m.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()}),r()(this,"_onLoadRetryClick",()=>{this.setState({phase:0}),this._fetchBackupInfo()}),r()(this,"_onSkipSetupClick",()=>{this.setState({phase:9})}),r()(this,"_onSetUpClick",()=>{this.setState({phase:S})}),r()(this,"_onSkipPassPhraseClick",async()=>{this._recoveryKey=await u.a.get().createRecoveryKeyFromPassphrase(),this.setState({copied:!1,downloaded:!1,phase:5})})
|
||
|
//# sourceMappingURL=2.js.map
|