1
- import { useEffect } from "react"
2
- import { Link } from "react-router-dom"
1
+ import { message } from "antd"
2
+ import { useState } from "react"
3
+ import { Link , useNavigate } from "react-router-dom"
4
+ import Code from "../../component/Code"
3
5
import Split from "../../component/Split"
4
6
import { useBoundStore } from "../../store/store"
5
7
import { findCurrentNavigationItem , updateNavigationSteps } from "../../utils/navigationActions"
8
+ import { Language } from "../../utils/types"
9
+
10
+ const activeLanguageList : Language [ ] = [ ] ;
6
11
7
12
const ConfigureCse = ( ) : JSX . Element => {
8
13
const { steps, setSteps } = useBoundStore ( ( state ) => state ) ;
14
+ const [ key , setKey ] = useState < string | undefined > ( ) ;
15
+
16
+ const navigate = useNavigate ( ) ;
9
17
const currentItem = findCurrentNavigationItem ( steps ) ;
10
18
11
- useEffect ( ( ) => {
12
- return ( ) => {
19
+ const handleSetup = async ( ) : Promise < void > => {
20
+ try {
21
+ setKey ( "google_cse" ) ;
13
22
updateNavigationSteps ( steps , setSteps ) ;
14
- } ;
15
- } , [ ] ) ;
23
+ navigate ( "#" ) ;
24
+ } catch ( error ) {
25
+ message . error ( typeof error === "string" ? error : ( error as Error ) . message ) ;
26
+ }
27
+ } ;
16
28
17
29
return (
18
30
< Split >
@@ -35,39 +47,55 @@ const ConfigureCse = (): JSX.Element => {
35
47
< li > Choose and configure an < b > Identity Provider</ b > </ li >
36
48
< li > Instantiate and configure a < b > Key Management Server</ b > (Cosmian KMS)</ li >
37
49
< li > Generate < b > < i > google_cse</ i > key</ b > from the KMS</ li >
38
- < div className = "code-cmd" >
39
- < code >
40
- { GOOGLE_CSE_KEY }
41
- </ code >
42
- < br />
43
- < code >
44
- { GOOGLE_CSE_GRANT }
45
- </ code >
46
- </ div >
47
50
< li > Handle < b > guest Identity Providers</ b > for external users < i > (optional)</ i > </ li >
48
51
< li > Generate < b > Gmail S/MIME</ b > elements: users key-pairs and identities < i > (optional)</ i > </ li >
49
- < div className = "code-cmd" >
50
- < code >
51
- { GOOGLE_CSE_SMIME_KEYPAIR }
52
- </ code >
53
- < br />
54
- < code >
55
- { GOOGLE_CSE_SMIME_IDENTITY }
56
- </ code >
57
- </ div >
58
52
</ ul >
59
53
</ Split . Content >
54
+ < Split . Code >
55
+ < Code
56
+ activeLanguageList = { activeLanguageList }
57
+ codeInputList = { {
58
+ java : GOOGLE_CSE_KEY ,
59
+ javascript : GOOGLE_CSE_KEY ,
60
+ python : GOOGLE_CSE_KEY ,
61
+ } }
62
+ codeOutputList = {
63
+ key
64
+ ? {
65
+ java : GOOGLE_CSE_KEY_OUTPUT ,
66
+ javascript : GOOGLE_CSE_KEY_OUTPUT ,
67
+ python : GOOGLE_CSE_KEY_OUTPUT ,
68
+ }
69
+ : undefined
70
+ }
71
+ codeLanguage = "bash"
72
+ runCode = { handleSetup }
73
+ />
74
+ </ Split . Code >
60
75
</ Split >
61
76
) ;
62
77
} ;
63
78
64
79
export default ConfigureCse ;
65
80
66
81
67
- const GOOGLE_CSE_KEY = "> ckms sym keys create -t google_cse google_cse" ;
82
+ const GOOGLE_CSE_KEY = `# Generate google_cse symmetric key
83
+
84
+ ckms sym keys create -t google_cse google_cse
85
+
86
+
87
+ # Grant access to the generated key
88
+
89
+ ckms access-rights grant USER_ID google_cse get encrypt decrypt
90
+ ` ;
91
+
92
+ const GOOGLE_CSE_KEY_OUTPUT = `The symmetric key was successfully generated.
93
+ Unique identifier: google_cse
68
94
69
- const GOOGLE_CSE_GRANT = "> ckms access-rights grant USER_ID google_cse get encrypt decrypt" ;
95
+ Tags:
96
+ - google_cse` ;
70
97
71
- const GOOGLE_CSE_SMIME_KEYPAIR = "> ckms google key-pairs create --cse-key-id CSE_KEY_ID --subject-name \"C=FR, ST=IdF, L=Paris, O=YOUR_ORGANIZATION, OU=DEPARTMENT, CN=user@your_organization.com, emailAddress=user@your_organization.com\" -i ISSUER_PRIVATE_KEY_ID user@your_organization.com" ;
98
+ // const GOOGLE_CSE_SMIME = ` ckms google key-pairs create --cse-key-id CSE_KEY_ID --subject-name \"C=FR, ST=IdF, L=Paris, O=YOUR_ORGANIZATION, OU=DEPARTMENT, CN=user@your_organization.com, emailAddress=user@your_organization.com\" -i ISSUER_PRIVATE_KEY_ID user@your_organization.com
72
99
73
- const GOOGLE_CSE_SMIME_IDENTITY = "> ckms google identities insert --user-id user@your_organization.com CREATED_KEYPAIR_ID" ;
100
+ // ckms google identities insert --user-id user@your_organization.com CREATED_KEYPAIR_ID
101
+ // `;
0 commit comments