|
1 | | -'use client' |
| 1 | +import { Box, Typography } from '@mui/material' |
| 2 | +import MessageLinkFooter from "@/common/ui/MessageLinkFooter" |
| 3 | +import { EncryptionForm } from "@/features/encrypt/view/EncryptionForm" |
| 4 | +import { env } from '@/common' |
2 | 5 |
|
3 | | -import { useState } from 'react' |
4 | | -import { encrypt } from './action' |
5 | | -import { Box, Button, TextareaAutosize, Typography } from '@mui/material' |
6 | | - |
7 | | -export default function EncryptPage() { |
8 | | - const [inputText, setInputText] = useState('') |
9 | | - const [encryptedText, setEncryptedText] = useState('') |
10 | | - |
11 | | - const handleSubmit = async (event: React.FormEvent) => { |
12 | | - event.preventDefault() |
13 | | - const encrypted = await encrypt(inputText) |
14 | | - setEncryptedText(encrypted) |
15 | | - } |
| 6 | +const HELP_URL = env.getOrThrow("FRAMNA_DOCS_HELP_URL") |
| 7 | +const SITE_NAME = env.getOrThrow("FRAMNA_DOCS_TITLE") |
16 | 8 |
|
| 9 | +export default async function EncryptPage() { |
17 | 10 | return ( |
18 | 11 | <Box |
19 | 12 | display="flex" |
20 | | - alignItems="center" |
21 | 13 | justifyContent="center" |
22 | | - flexDirection="column" |
23 | | - height={1} |
| 14 | + alignItems="center" |
24 | 15 | width={1} |
25 | | - gap={6} |
26 | 16 | > |
27 | | - <Typography variant="h4"> |
28 | | - Encrypt text for remote config |
29 | | - </Typography> |
30 | | - <Typography variant="body1"> |
31 | | - Use this to encrypt values to be used in the configuration file.<br /> |
32 | | - The input text is encrypted using the public key of the server. |
33 | | - </Typography> |
34 | | - <form onSubmit={handleSubmit}> |
35 | | - <TextareaAutosize |
36 | | - value={inputText} |
37 | | - onChange={(e) => setInputText(e.target.value)} |
38 | | - cols={50} |
39 | | - minRows={10} |
40 | | - /> |
41 | | - <br /> |
42 | | - <Button type="submit" variant="outlined" |
43 | | - color="primary" |
44 | | - size="large" |
45 | | - sx={{ height: 56, width: 1 }} |
46 | | - >Encrypt</Button> |
47 | | - </form> |
48 | | - {encryptedText && ( |
49 | | - <textarea readOnly value={encryptedText} rows={10} cols={50} /> |
50 | | - )} |
| 17 | + <Box |
| 18 | + display="flex" |
| 19 | + alignItems="center" |
| 20 | + flexDirection="column" |
| 21 | + gap={6} |
| 22 | + sx={{ width: '80%', maxWidth: '600px' }} |
| 23 | + > |
| 24 | + <Typography variant="h4"> |
| 25 | + Encrypt secrets for remote config |
| 26 | + </Typography> |
| 27 | + <Typography sx={{ textAlign: "center" }}> |
| 28 | + When adding authentication information to remote specifications it |
| 29 | + is required to encrypt the authentication information with our public |
| 30 | + key before storing it in the repository.<br /> |
| 31 | + <br /> |
| 32 | + This page allows you to encrypt the secret using {SITE_NAME}{SITE_NAME.endsWith('s') ? "'" : "'s"} |
| 33 | + public key, which means only {SITE_NAME} can decrypt it. |
| 34 | + </Typography> |
| 35 | + <EncryptionForm /> |
| 36 | + {HELP_URL && |
| 37 | + <MessageLinkFooter |
| 38 | + url={HELP_URL} |
| 39 | + content="Need help? Explore our wiki for more info." |
| 40 | + /> |
| 41 | + } |
| 42 | + </Box> |
51 | 43 | </Box> |
52 | 44 | ) |
53 | 45 | } |
0 commit comments