| 
						
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -1,8 +1,8 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { isEmpty } from 'lodash';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { useState } from 'react';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { useDispatch, useSelector } from 'react-redux';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import useMount from 'react-use/lib/useMount';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import styled from 'styled-components';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { useHotkey } from '../../../hooks/useHotkey';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { useIconToImageURL } from '../../../hooks/useIconToImageURL';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { usePasswordModal } from '../../../hooks/usePasswordModal';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { mnDecode } from '../../../session/crypto/mnemonic';
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -11,6 +11,7 @@ import {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  updateLightBoxOptions,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				} from '../../../state/ducks/modalDialog';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { showSettingsSection } from '../../../state/ducks/section';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { getIsModalVisble } from '../../../state/selectors/modal';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { useHideRecoveryPasswordEnabled } from '../../../state/selectors/settings';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { useIsDarkTheme } from '../../../state/selectors/theme';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { THEME_GLOBALS } from '../../../themes/globals';
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -28,8 +29,6 @@ import {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  SessionSettingsItemWrapper,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  StyledSettingItem,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				} from '../SessionSettingListItem';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { useHotkey } from '../../../hooks/useHotkey';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { getIsModalVisble } from '../../../state/selectors/modal';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				const StyledSettingsItemContainer = styled.div`
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  p {
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -68,9 +67,11 @@ const qrLogoProps: QRCodeLogoProps = {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				};
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				export const SettingsCategoryRecoveryPassword = () => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const [loadingSeed, setLoadingSeed] = useState(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const [recoveryPhrase, setRecoveryPhrase] = useState('');
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const [hexEncodedSeed, setHexEncodedSeed] = useState('');
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const recoveryPhrase = getCurrentRecoveryPhrase();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if (!recoveryPhrase || isEmpty(recoveryPhrase)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    throw new Error('SettingsCategoryRecoveryPassword recovery seed is empty');
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const hexEncodedSeed = mnDecode(recoveryPhrase, 'english');
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const [isQRVisible, setIsQRVisible] = useState(false);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const hideRecoveryPassword = useHideRecoveryPasswordEnabled();
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -82,27 +83,11 @@ export const SettingsCategoryRecoveryPassword = () => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const dispatch = useDispatch();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const { hasPassword, passwordValid } = usePasswordModal({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    title: window.i18n('sessionRecoveryPassword'),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    onClose: () => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      dispatch(showSettingsSection('privacy'));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    },
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  });
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const fetchRecoverPhrase = () => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    const newRecoveryPhrase = getCurrentRecoveryPhrase();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    setRecoveryPhrase(newRecoveryPhrase);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (!isEmpty(newRecoveryPhrase)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      setHexEncodedSeed(mnDecode(newRecoveryPhrase, 'english'));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    setLoadingSeed(false);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  };
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  useMount(() => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (!hasPassword || (hasPassword && passwordValid)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      fetchRecoverPhrase();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  });
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  useHotkey(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    'v',
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    () => {
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -110,10 +95,10 @@ export const SettingsCategoryRecoveryPassword = () => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        setIsQRVisible(!isQRVisible);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    },
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    (hasPassword && !passwordValid) || loadingSeed || hideRecoveryPassword
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    (hasPassword && !passwordValid) || hideRecoveryPassword
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  );
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if ((hasPassword && !passwordValid) || loadingSeed || hideRecoveryPassword) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if ((hasPassword && !passwordValid) || hideRecoveryPassword) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return null;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |