Skip to content

A local-first personal finance app

[Mobile] Fix encryption modals for mobile (#2633)

Joel Jeremy Marquez978a658c1e43
diff --git a/packages/desktop-client/src/components/Modals.tsx b/packages/desktop-client/src/components/Modals.tsx
index a08467e3f8..21845c0fb0 100644
--- a/packages/desktop-client/src/components/Modals.tsx
+++ b/packages/desktop-client/src/components/Modals.tsx
@@ -24,11 +24,11 @@ import { ConfirmTransactionEdit } from './modals/ConfirmTransactionEdit';
import { ConfirmUnlinkAccount } from './modals/ConfirmUnlinkAccount';
import { CoverModal } from './modals/CoverModal';
import { CreateAccount } from './modals/CreateAccount';
-import { CreateEncryptionKey } from './modals/CreateEncryptionKey';
+import { CreateEncryptionKeyModal } from './modals/CreateEncryptionKeyModal';
import { CreateLocalAccount } from './modals/CreateLocalAccount';
import { EditField } from './modals/EditField';
import { EditRule } from './modals/EditRule';
-import { FixEncryptionKey } from './modals/FixEncryptionKey';
+import { FixEncryptionKeyModal } from './modals/FixEncryptionKeyModal';
import { GoCardlessExternalMsg } from './modals/GoCardlessExternalMsg';
import { GoCardlessInitialise } from './modals/GoCardlessInitialise';
import { HoldBufferModal } from './modals/HoldBufferModal';
@@ -251,20 +251,18 @@ export function Modals() {
case 'create-encryption-key':
return (
- <CreateEncryptionKey
+ <CreateEncryptionKeyModal
key={name}
modalProps={modalProps}
- actions={actions}
options={options}
/>
);
case 'fix-encryption-key':
return (
- <FixEncryptionKey
+ <FixEncryptionKeyModal
key={name}
modalProps={modalProps}
- actions={actions}
options={options}
/>
);
diff --git a/packages/desktop-client/src/components/common/Modal.tsx b/packages/desktop-client/src/components/common/Modal.tsx
index 7fecf3dd2e..68912ae303 100644
--- a/packages/desktop-client/src/components/common/Modal.tsx
+++ b/packages/desktop-client/src/components/common/Modal.tsx
@@ -136,6 +136,7 @@ export const Modal = ({
willChange: 'opacity, transform',
maxWidth: '90vw',
minWidth: '90vw',
+ maxHeight: '90vh',
minHeight: 0,
borderRadius: 4,
//border: '1px solid ' + theme.modalBorder,
diff --git a/packages/desktop-client/src/components/manager/Modals.jsx b/packages/desktop-client/src/components/manager/Modals.jsx
index be2fca077e..ebd20585a5 100644
--- a/packages/desktop-client/src/components/manager/Modals.jsx
+++ b/packages/desktop-client/src/components/manager/Modals.jsx
@@ -3,8 +3,8 @@ import { useSelector } from 'react-redux';
import { useActions } from '../../hooks/useActions';
import { View } from '../common/View';
-import { CreateEncryptionKey } from '../modals/CreateEncryptionKey';
-import { FixEncryptionKey } from '../modals/FixEncryptionKey';
+import { CreateEncryptionKeyModal } from '../modals/CreateEncryptionKeyModal';
+import { FixEncryptionKeyModal } from '../modals/FixEncryptionKeyModal';
import { LoadBackup } from '../modals/LoadBackup';
import { DeleteFile } from './DeleteFile';
@@ -67,19 +67,17 @@ export function Modals() {
}
case 'create-encryption-key':
return (
- <CreateEncryptionKey
+ <CreateEncryptionKeyModal
key={name}
modalProps={modalProps}
- actions={actions}
options={options}
/>
);
case 'fix-encryption-key':
return (
- <FixEncryptionKey
+ <FixEncryptionKeyModal
key={name}
modalProps={modalProps}
- actions={actions}
options={options}
/>
);
diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx b/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx
deleted file mode 100644
index 1e9c5f74d5..0000000000
--- a/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx
+++ /dev/null
@@ -1,188 +0,0 @@
-// @ts-strict-ignore
-import React, { useState } from 'react';
-
-import { css } from 'glamor';
-
-import { send } from 'loot-core/src/platform/client/fetch';
-import { getCreateKeyError } from 'loot-core/src/shared/errors';
-
-import { type BoundActions } from '../../hooks/useActions';
-import { theme } from '../../style';
-import { ButtonWithLoading } from '../common/Button';
-import { InitialFocus } from '../common/InitialFocus';
-import { Input } from '../common/Input';
-import { Link } from '../common/Link';
-import { Modal, ModalButtons } from '../common/Modal';
-import { Paragraph } from '../common/Paragraph';
-import { Text } from '../common/Text';
-import { View } from '../common/View';
-import { type CommonModalProps } from '../Modals';
-
-type CreateEncryptionKeyProps = {
- modalProps: CommonModalProps;
- actions: BoundActions;
- options: {
- recreate?: boolean;
- };
-};
-
-export function CreateEncryptionKey({
- modalProps,
- actions,
- options = {},
-}: CreateEncryptionKeyProps) {
- const [password, setPassword] = useState('');
- const [loading, setLoading] = useState(false);
- const [error, setError] = useState('');
- const [showPassword, setShowPassword] = useState(false);
-
- const isRecreating = options.recreate;
-
- async function onCreateKey() {
- if (password !== '' && !loading) {
- setLoading(true);
- setError(null);
-
- const res = await send('key-make', { password });
- if (res.error) {
- setLoading(null);
- setError(getCreateKeyError(res.error));
- return;
- }
-
- actions.loadGlobalPrefs();
- actions.loadAllFiles();
- actions.sync();
-
- setLoading(false);
- actions.popModal();
- }
- }
-
- return (
- <Modal
- {...modalProps}
- style={{ width: 600 }}
- title={isRecreating ? 'Generate new key' : 'Enable encryption'}
- onClose={() => actions.popModal()}
- >
- {() => (
- <>
- {!isRecreating ? (
- <>
- <Paragraph style={{ marginTop: 5 }}>
- To enable end-to-end encryption, you need to create a key. We
- will generate a key based on a password and use it to encrypt
- from now on. <strong>This requires a sync reset</strong> and all
- other devices will have to revert to this version of your data.{' '}
- <Link
- variant="external"
- to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- linkColor="purple"
- >
- Learn more
- </Link>
- </Paragraph>
- <Paragraph>
- <ul
- className={`${css({
- marginTop: 0,
- '& li': { marginBottom: 8 },
- })}`}
- >
- <li>
- <strong>Important:</strong> if you forget this password{' '}
- <em>and</em> you don’t have any local copies of your data,
- you will lose access to all your data. The data cannot be
- decrypted without the password.
- </li>
- <li>
- This key only applies to this file. You will need to
- generate a new key for each file you want to encrypt.
- </li>
- <li>
- If you’ve already downloaded your data on other devices, you
- will need to reset them. Actual will automatically take you
- through this process.
- </li>
- <li>
- It is recommended for the encryption password to be
- different than the log-in password in order to better
- protect your data.
- </li>
- </ul>
- </Paragraph>
- </>
- ) : (
- <>
- <Paragraph style={{ marginTop: 5 }}>
- This will generate a new key for encrypting your data.{' '}
- <strong>This requires a sync reset</strong> and all other
- devices will have to revert to this version of your data. Actual
- will take you through that process on those devices.{' '}
- <Link
- variant="external"
- to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- linkColor="purple"
- >
- Learn more
- </Link>
- </Paragraph>
- <Paragraph>
- Key generation is randomized. The same password will create
- different keys, so this will change your key regardless of the
- password being different.
- </Paragraph>
- </>
- )}
- <form
- onSubmit={e => {
- e.preventDefault();
- onCreateKey();
- }}
- >
- <View style={{ alignItems: 'center' }}>
- <Text style={{ fontWeight: 600, marginBottom: 3 }}>Password</Text>
-
- {error && (
- <View
- style={{
- color: theme.errorText,
- textAlign: 'center',
- fontSize: 13,
- marginBottom: 3,
- }}
- >
- {error}
- </View>
- )}
-
- <InitialFocus>
- <Input
- type={showPassword ? 'text' : 'password'}
- style={{ width: 300 }}
- onChange={e => setPassword(e.target.value)}
- />
- </InitialFocus>
- <Text style={{ marginTop: 5 }}>
- <label style={{ userSelect: 'none' }}>
- <input
- type="checkbox"
- onClick={() => setShowPassword(!showPassword)}
- />{' '}
- Show password
- </label>
- </Text>
- </View>
-
- <ModalButtons style={{ marginTop: 20 }}>
- <ButtonWithLoading loading={loading} type="primary">
- Enable
- </ButtonWithLoading>
- </ModalButtons>
- </form>
- </>
- )}
- </Modal>
- );
-}
diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx b/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx
new file mode 100644
index 0000000000..20cfa1317c
--- /dev/null
+++ b/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx
@@ -0,0 +1,208 @@
+// @ts-strict-ignore
+import React, { useState } from 'react';
+import { useDispatch } from 'react-redux';
+
+import { css } from 'glamor';
+
+import { loadAllFiles, loadGlobalPrefs, sync } from 'loot-core/client/actions';
+import { send } from 'loot-core/src/platform/client/fetch';
+import { getCreateKeyError } from 'loot-core/src/shared/errors';
+
+import { useResponsive } from '../../ResponsiveProvider';
+import { styles, theme } from '../../style';
+import { ButtonWithLoading } from '../common/Button';
+import { InitialFocus } from '../common/InitialFocus';
+import { Input } from '../common/Input';
+import { Link } from '../common/Link';
+import { Modal, ModalButtons } from '../common/Modal';
+import { Paragraph } from '../common/Paragraph';
+import { Text } from '../common/Text';
+import { View } from '../common/View';
+import { type CommonModalProps } from '../Modals';
+
+type CreateEncryptionKeyModalProps = {
+ modalProps: CommonModalProps;
+ options: {
+ recreate?: boolean;
+ };
+};
+
+export function CreateEncryptionKeyModal({
+ modalProps,
+ options = {},
+}: CreateEncryptionKeyModalProps) {
+ const [password, setPassword] = useState('');
+ const [loading, setLoading] = useState(false);
+ const [error, setError] = useState('');
+ const [showPassword, setShowPassword] = useState(false);
+ const { isNarrowWidth } = useResponsive();
+ const dispatch = useDispatch();
+
+ const isRecreating = options.recreate;
+
+ async function onCreateKey() {
+ if (password !== '' && !loading) {
+ setLoading(true);
+ setError(null);
+
+ const res = await send('key-make', { password });
+ if (res.error) {
+ setLoading(null);
+ setError(getCreateKeyError(res.error));
+ return;
+ }
+
+ dispatch(loadGlobalPrefs());
+ dispatch(loadAllFiles());
+ dispatch(sync());
+
+ setLoading(false);
+ modalProps.onClose();
+ }
+ }
+
+ return (
+ <Modal
+ {...modalProps}
+ style={{
+ flex: 1,
+ padding: '0 10px',
+ borderRadius: '6px',
+ }}
+ padding={10}
+ title={isRecreating ? 'Generate new key' : 'Enable encryption'}
+ onClose={modalProps.onClose}
+ >
+ <View
+ style={{
+ maxWidth: 600,
+ overflowX: 'hidden',
+ overflowY: 'auto',
+ flex: 1,
+ }}
+ >
+ {!isRecreating ? (
+ <>
+ <Paragraph style={{ marginTop: 5 }}>
+ To enable end-to-end encryption, you need to create a key. We will
+ generate a key based on a password and use it to encrypt from now
+ on. <strong>This requires a sync reset</strong> and all other
+ devices will have to revert to this version of your data.{' '}
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
+ linkColor="purple"
+ >
+ Learn more
+ </Link>
+ </Paragraph>
+ <Paragraph>
+ <ul
+ className={`${css({
+ marginTop: 0,
+ '& li': { marginBottom: 8 },
+ })}`}
+ >
+ <li>
+ <strong>Important:</strong> if you forget this password{' '}
+ <em>and</em> you don’t have any local copies of your data, you
+ will lose access to all your data. The data cannot be
+ decrypted without the password.
+ </li>
+ <li>
+ This key only applies to this file. You will need to generate
+ a new key for each file you want to encrypt.
+ </li>
+ <li>
+ If you’ve already downloaded your data on other devices, you
+ will need to reset them. Actual will automatically take you
+ through this process.
+ </li>
+ <li>
+ It is recommended for the encryption password to be different
+ than the log-in password in order to better protect your data.
+ </li>
+ </ul>
+ </Paragraph>
+ </>
+ ) : (
+ <>
+ <Paragraph style={{ marginTop: 5 }}>
+ This will generate a new key for encrypting your data.{' '}
+ <strong>This requires a sync reset</strong> and all other devices
+ will have to revert to this version of your data. Actual will take
+ you through that process on those devices.{' '}
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
+ linkColor="purple"
+ >
+ Learn more
+ </Link>
+ </Paragraph>
+ <Paragraph>
+ Key generation is randomized. The same password will create
+ different keys, so this will change your key regardless of the
+ password being different.
+ </Paragraph>
+ </>
+ )}
+ </View>
+ <form
+ onSubmit={e => {
+ e.preventDefault();
+ onCreateKey();
+ }}
+ >
+ <View style={{ alignItems: 'center' }}>
+ <Text style={{ fontWeight: 600, marginBottom: 3 }}>Password</Text>
+
+ {error && (
+ <View
+ style={{
+ color: theme.errorText,
+ textAlign: 'center',
+ fontSize: 13,
+ marginBottom: 3,
+ }}
+ >
+ {error}
+ </View>
+ )}
+
+ <InitialFocus>
+ <Input
+ type={showPassword ? 'text' : 'password'}
+ style={{
+ width: isNarrowWidth ? '100%' : '50%',
+ height: isNarrowWidth ? styles.mobileMinHeight : undefined,
+ }}
+ onChange={e => setPassword(e.target.value)}
+ />
+ </InitialFocus>
+ <Text style={{ marginTop: 5 }}>
+ <label style={{ userSelect: 'none' }}>
+ <input
+ type="checkbox"
+ onClick={() => setShowPassword(!showPassword)}
+ />{' '}
+ Show password
+ </label>
+ </Text>
+ </View>
+
+ <ModalButtons style={{ marginTop: 20 }}>
+ <ButtonWithLoading
+ style={{
+ height: isNarrowWidth ? styles.mobileMinHeight : undefined,
+ }}
+ loading={loading}
+ type="primary"
+ >
+ Enable
+ </ButtonWithLoading>
+ </ModalButtons>
+ </form>
+ </Modal>
+ );
+}
diff --git a/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx b/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx
deleted file mode 100644
index 236a5a32fc..0000000000
--- a/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx
+++ /dev/null
@@ -1,163 +0,0 @@
-// @ts-strict-ignore
-import React, { useState } from 'react';
-
-import { type FinanceModals } from 'loot-core/src/client/state-types/modals';
-import { send } from 'loot-core/src/platform/client/fetch';
-import { getTestKeyError } from 'loot-core/src/shared/errors';
-
-import { type BoundActions } from '../../hooks/useActions';
-import { theme } from '../../style';
-import { Button, ButtonWithLoading } from '../common/Button';
-import { InitialFocus } from '../common/InitialFocus';
-import { Input } from '../common/Input';
-import { Link } from '../common/Link';
-import { Modal, ModalButtons } from '../common/Modal';
-import { Paragraph } from '../common/Paragraph';
-import { Text } from '../common/Text';
-import { View } from '../common/View';
-import { type CommonModalProps } from '../Modals';
-
-type FixEncryptionKeyProps = {
- modalProps: CommonModalProps;
- actions: BoundActions;
- options: FinanceModals['fix-encryption-key'];
-};
-
-export function FixEncryptionKey({
- modalProps,
- actions,
- options = {},
-}: FixEncryptionKeyProps) {
- const { hasExistingKey, cloudFileId, onSuccess } = options;
-
- const [password, setPassword] = useState('');
- const [error, setError] = useState('');
- const [loading, setLoading] = useState(false);
- const [showPassword, setShowPassword] = useState(false);
-
- async function onUpdateKey() {
- if (password !== '' && !loading) {
- setLoading(true);
- setError(null);
-
- const { error } = await send('key-test', {
- password,
- fileId: cloudFileId,
- });
- if (error) {
- setError(getTestKeyError(error));
- setLoading(false);
- return;
- }
-
- actions.popModal();
- onSuccess?.();
- }
- }
-
- return (
- <Modal {...modalProps} showHeader={false} style={{ width: 600 }}>
- {() => (
- <View style={{ flex: 1 }}>
- <Text
- style={{
- fontSize: 25,
- fontWeight: 700,
- color: theme.pageTextDark,
- margin: '20px 0',
- }}
- >
- {hasExistingKey
- ? 'Unable to decrypt file'
- : 'This file is encrypted'}
- </Text>
- {hasExistingKey ? (
- <Paragraph>
- This file was encrypted with a different key than you are
- currently using. This probably means you changed your password.
- Enter your current password to update your key.{' '}
- <Link
- variant="external"
- to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- >
- Learn more
- </Link>
- </Paragraph>
- ) : (
- <Paragraph>
- We don’t have a key that encrypts or decrypts this file. Enter the
- password for this file to create the key for encryption.{' '}
- <Link
- variant="external"
- to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- >
- Learn more
- </Link>
- </Paragraph>
- )}
- <form
- onSubmit={e => {
- e.preventDefault();
- onUpdateKey();
- }}
- >
- <View
- style={{
- marginTop: 15,
- flexDirection: 'column',
- alignItems: 'center',
- }}
- >
- <Text style={{ fontWeight: 600, marginBottom: 5 }}>Password</Text>{' '}
- {error && (
- <View
- style={{
- color: theme.errorText,
- textAlign: 'center',
- fontSize: 13,
- marginBottom: 3,
- }}
- >
- {error}
- </View>
- )}
- <InitialFocus>
- <Input
- type={showPassword ? 'text' : 'password'}
- style={{ width: '50%' }}
- onChange={e => setPassword(e.target.value)}
- />
- </InitialFocus>
- <Text style={{ marginTop: 5 }}>
- <label style={{ userSelect: 'none' }}>
- <input
- type="checkbox"
- onClick={() => setShowPassword(!showPassword)}
- />{' '}
- Show password
- </label>
- </Text>
- </View>
-
- <ModalButtons style={{ marginTop: 20 }}>
- <Button
- style={{ marginRight: 10 }}
- onClick={() => modalProps.onBack()}
- type="normal"
- >
- Back
- </Button>
- <ButtonWithLoading
- type="primary"
- loading={loading}
- onClick={onUpdateKey}
- >
- {hasExistingKey ? 'Update key' : 'Create key'}
- </ButtonWithLoading>
- </ModalButtons>
- </form>
- </View>
- )}
- </Modal>
- );
-}
diff --git a/packages/desktop-client/src/components/modals/FixEncryptionKeyModal.tsx b/packages/desktop-client/src/components/modals/FixEncryptionKeyModal.tsx
new file mode 100644
index 0000000000..30446306d5
--- /dev/null
+++ b/packages/desktop-client/src/components/modals/FixEncryptionKeyModal.tsx
@@ -0,0 +1,176 @@
+// @ts-strict-ignore
+import React, { useState } from 'react';
+
+import { type FinanceModals } from 'loot-core/src/client/state-types/modals';
+import { send } from 'loot-core/src/platform/client/fetch';
+import { getTestKeyError } from 'loot-core/src/shared/errors';
+
+import { useResponsive } from '../../ResponsiveProvider';
+import { styles, theme } from '../../style';
+import { Button, ButtonWithLoading } from '../common/Button';
+import { InitialFocus } from '../common/InitialFocus';
+import { Input } from '../common/Input';
+import { Link } from '../common/Link';
+import { Modal, ModalButtons } from '../common/Modal';
+import { Paragraph } from '../common/Paragraph';
+import { Text } from '../common/Text';
+import { View } from '../common/View';
+import { type CommonModalProps } from '../Modals';
+
+type FixEncryptionKeyModalProps = {
+ modalProps: CommonModalProps;
+ options: FinanceModals['fix-encryption-key'];
+};
+
+export function FixEncryptionKeyModal({
+ modalProps,
+ options = {},
+}: FixEncryptionKeyModalProps) {
+ const { hasExistingKey, cloudFileId, onSuccess } = options;
+
+ const [password, setPassword] = useState('');
+ const [error, setError] = useState('');
+ const [loading, setLoading] = useState(false);
+ const [showPassword, setShowPassword] = useState(false);
+ const { isNarrowWidth } = useResponsive();
+
+ async function onUpdateKey() {
+ if (password !== '' && !loading) {
+ setLoading(true);
+ setError(null);
+
+ const { error } = await send('key-test', {
+ password,
+ fileId: cloudFileId,
+ });
+ if (error) {
+ setError(getTestKeyError(error));
+ setLoading(false);
+ return;
+ }
+
+ modalProps.onClose();
+ onSuccess?.();
+ }
+ }
+
+ return (
+ <Modal
+ {...modalProps}
+ title={
+ hasExistingKey ? 'Unable to decrypt file' : 'This file is encrypted'
+ }
+ style={{
+ flex: 1,
+ padding: '0 10px',
+ borderRadius: '6px',
+ }}
+ padding={10}
+ onClose={modalProps.onClose}
+ >
+ <View
+ style={{
+ maxWidth: 500,
+ overflowX: 'hidden',
+ overflowY: 'auto',
+ flex: 1,
+ }}
+ >
+ {hasExistingKey ? (
+ <Paragraph>
+ This file was encrypted with a different key than you are currently
+ using. This probably means you changed your password. Enter your
+ current password to update your key.{' '}
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
+ >
+ Learn more
+ </Link>
+ </Paragraph>
+ ) : (
+ <Paragraph>
+ We don’t have a key that encrypts or decrypts this file. Enter the
+ password for this file to create the key for encryption.{' '}
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
+ >
+ Learn more
+ </Link>
+ </Paragraph>
+ )}
+ </View>
+ <form
+ onSubmit={e => {
+ e.preventDefault();
+ onUpdateKey();
+ }}
+ >
+ <View
+ style={{
+ marginTop: 15,
+ flexDirection: 'column',
+ alignItems: 'center',
+ }}
+ >
+ <Text style={{ fontWeight: 600, marginBottom: 5 }}>Password</Text>{' '}
+ {error && (
+ <View
+ style={{
+ color: theme.errorText,
+ textAlign: 'center',
+ fontSize: 13,
+ marginBottom: 3,
+ }}
+ >
+ {error}
+ </View>
+ )}
+ <InitialFocus>
+ <Input
+ type={showPassword ? 'text' : 'password'}
+ style={{
+ width: isNarrowWidth ? '100%' : '50%',
+ height: isNarrowWidth ? styles.mobileMinHeight : undefined,
+ }}
+ onChange={e => setPassword(e.target.value)}
+ />
+ </InitialFocus>
+ <Text style={{ marginTop: 5 }}>
+ <label style={{ userSelect: 'none' }}>
+ <input
+ type="checkbox"
+ onClick={() => setShowPassword(!showPassword)}
+ />{' '}
+ Show password
+ </label>
+ </Text>
+ </View>
+
+ <ModalButtons style={{ marginTop: 20 }}>
+ <Button
+ style={{
+ height: isNarrowWidth ? styles.mobileMinHeight : undefined,
+ marginRight: 10,
+ }}
+ onClick={() => modalProps.onBack()}
+ type="normal"
+ >
+ Back
+ </Button>
+ <ButtonWithLoading
+ type="primary"
+ style={{
+ height: isNarrowWidth ? styles.mobileMinHeight : undefined,
+ }}
+ loading={loading}
+ onClick={onUpdateKey}
+ >
+ {hasExistingKey ? 'Update key' : 'Create key'}
+ </ButtonWithLoading>
+ </ModalButtons>
+ </form>
+ </Modal>
+ );
+}
diff --git a/upcoming-release-notes/2633.md b/upcoming-release-notes/2633.md
new file mode 100644
index 0000000000..25f2d22a49
--- /dev/null
+++ b/upcoming-release-notes/2633.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [joel-jeremy]
+---
+
+Fix encryption modals for mobile.