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

(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{1571:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return F}));var s,r=a(13),o=a.n(r),n=a(120),i=a.n(n),c=a(400),l=a.n(c),h=a(1),u=a(174),p=a(126),d=a.n(p),m=a(122),y=a(121),g=a(127),S=a(250),b=a(228),P=a(319),f=a(345),C=a(258),w=a(123),k=a(145),v=a(206),E=a(367),O=a(241),K=a(292),_=a(139),j=a(135),B=a(134),x=a(256);function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},D.apply(this,arguments)}function N(e){return n.createElement("svg",D({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18.864 14.318",role:"presentation","aria-hidden":!0},e),s||(s=n.createElement("path",{d:"M1.25 8.037l4.886 5.031L17.614 1.25",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round"})))}var U;!function(e){e.Loading="loading",e.LoadError="load_error",e.ChooseKeyPassphrase="choose_key_passphrase",e.Migrate="migrate",e.Passphrase="passphrase",e.PassphraseConfirm="passphrase_confirm",e.ShowKey="show_key",e.Storing="storing",e.Stored="stored",e.ConfirmSkip="confirm_skip"}(U||(U={}));class F extends i.a.PureComponent{constructor(e){let t;super(e),o()(this,"recoveryKey",void 0),o()(this,"backupKey",void 0),o()(this,"recoveryKeyNode",Object(n.createRef)()),o()(this,"passphraseField",Object(n.createRef)()),o()(this,"onKeyBackupStatusChange",(()=>{this.state.phase===U.Migrate&&this.fetchBackupInfo()})),o()(this,"onKeyPassphraseChange",(e=>{this.setState({passPhraseKeySelected:e.target.value})})),o()(this,"onChooseKeyPassphraseFormSubmit",(async()=>{this.state.passPhraseKeySelected===O.a.Key?(this.recoveryKey=await m.a.get().createRecoveryKeyFromPassphrase(),this.setState({copied:!1,downloaded:!1,setPassphrase:!1,phase:U.ShowKey})):this.setState({copied:!1,downloaded:!1,phase:U.Passphrase})})),o()(this,"onMigrateFormSubmit",(e=>{var t;e.preventDefault(),null!==(t=this.state.backupSigStatus)&&void 0!==t&&t.usable?this.bootstrapSecretStorage():this.restoreBackup()})),o()(this,"onCopyClick",(()=>{Object(b.a)(this.recoveryKeyNode.current)&&this.setState({copied:!0})})),o()(this,"onDownloadClick",(()=>{const e=new Blob([this.recoveryKey.encodedPrivateKey],{type:"text/plain;charset=us-ascii"});l.a.saveAs(e,"security-key.txt"),this.setState({downloaded:!0})})),o()(this,"doBootstrapUIAuth",(async e=>{if(this.state.canUploadKeysWithPasswordOnly&&this.state.accountPassword)await e({type:"m.login.password",identifier:{type:"m.id.user",user:m.a.get().getUserId()},user:m.a.get().getUserId(),password:this.state.accountPassword});else{const t={[P.c.PHASE_PREAUTH]:{title:Object(y.a)("Use Single Sign On to continue"),body:Object(y.a)("To continue, use Single Sign On to prove your identity."),continueText:Object(y.a)("Single Sign On"),continueKind:"primary"},[P.c.PHASE_POSTAUTH]:{title:Object(y.a)("Confirm encryption setup"),body:Object(y.a)("Click the button below to confirm setting up encryption."),continueText:Object(y.a)("Confirm"),continueKind:"primary"}},{finished:a}=g.b.createDialog(x.a,{title:Object(y.a)("Setting up keys"),matrixClient:m.a.get(),makeRequest:e,aestheticsForStagePhases:{[P.c.LOGIN_TYPE]:t,[P.c.UNSTABLE_LOGIN_TYPE]:t}}),[s]=await a;if(!s)throw new Error("Cross-signing key upload auth canceled")}})),o()(this,"bootstrapSecretStorage",(async()=>{this.setState({phase:U.Storing,error:void 0});const e=m.a.get(),{forceReset:t}=this.props;try{t?(h.a.log("Forcing secret storage reset"),await e.bootstrapSecretStorage({createSecretStorageKey:async()=>this.recoveryKey,setupNewKeyBackup:!0,setupNewSecretStorage:!0})):(await e.bootstrapCrossSigning({authUploadDeviceSigningKeys:this.doBootstrapUIAuth}),await e.bootstrapSecretStorage({createSecretStorageKey:async()=>this.recoveryKey,keyBackupInfo:this.state.backupInfo,setupNewKeyBackup:!this.state.backupInfo,getKeyBackupPassphrase:async()=>this.backupKey?this.backupKey:Object(S.e)()})),this.setState({phase:U.Stored})}catch(e){this.state.canUploadKeysWi
//# sourceMappingURL=33.js.map