Skip to content

Commit 60a701c

Browse files
authored
Merge pull request #27 from Cosmian/refactor/refactoring_hard_coded_paths
Refactor/refactoring navigation config
2 parents acf0288 + 20bccdc commit 60a701c

File tree

7 files changed

+990
-866
lines changed

7 files changed

+990
-866
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Adding new pages :
2+
3+
The single page tree structure is centralized in the following file : [`src/utils/routePathsConfig.tsx`](src/utils/routePathsConfig.tsx).
4+
5+
In order to add, remove or change the name/address a page, you will need to modify this file, as changing the logic of navigationConfig.tsx might introduce bugs.

package-lock.json

Lines changed: 700 additions & 573 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/actions/javascript/summarizeDocumentContent.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { MSE_APP_URL } from "./backendConfig";
22

3-
export const summarizeDocumentContent = async (textInput: string): Promise<{ summary: string } | Error> => {
3+
export const summarizeDocumentContent = async (textInput: string, userToken: string): Promise<{ summary: string } | Error> => {
44
const formData = new FormData();
55
formData.append("doc", textInput);
66
const response = await fetch(`${MSE_APP_URL}/summarize`, {
77
method: "POST",
8+
headers: {
9+
Authorization: "Bearer " + userToken,
10+
},
811
body: formData,
912
});
1013
if (!response.ok) {

src/Router.tsx

Lines changed: 3 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,11 @@
11
import { Navigate, Route, RouterProvider, createBrowserRouter, createRoutesFromElements } from "react-router-dom";
22
import Layout from "./component/Layout";
3-
import OverView from "./pages/OverView";
4-
import AuditSnapshot from "./pages/confidentialVm/AuditSnapshot";
5-
import DeployApplication from "./pages/confidentialVm/DeployApplication";
6-
import DetectMalware from "./pages/confidentialVm/DetectMalware";
7-
import SnapshotVm from "./pages/confidentialVm/SnapshotVm";
8-
import UseConfidentialVm from "./pages/confidentialVm/UseConfidentialVm";
9-
import VerifyIntegrity from "./pages/confidentialVm/VerifyIntegrity";
10-
import AboutCovercrypt from "./pages/covercrypt/AboutCovercrypt";
11-
import CreateEncryptionPolicy from "./pages/covercrypt/CreateEncryptionPolicy";
12-
import CreateMasterKeyPair from "./pages/covercrypt/CreateMasterKeyPair";
13-
import DecryptData from "./pages/covercrypt/DecryptData";
14-
import EncryptData from "./pages/covercrypt/EncryptData";
15-
import GenerateUDK from "./pages/covercrypt/GenerateUDK";
16-
import SetupCovercrypt from "./pages/covercrypt/SetupCovercrypt";
17-
import AboutCse from "./pages/cse/AboutCse";
18-
import SetupCse from "./pages/cse/SetupCse";
19-
import SummarizeDocument from "./pages/cse/SummarizeDocument";
20-
import AboutFindex from "./pages/findex/AboutFindex";
21-
import IndexDatabase from "./pages/findex/IndexDatabase";
22-
import InstantiateFindex from "./pages/findex/InstantiateFindex";
23-
import SearchInDatabase from "./pages/findex/SearchInDatabase";
24-
import SetupFindex from "./pages/findex/SetupFindex";
25-
import AboutPKI from "./pages/pki/AboutPKI";
26-
import DecryptDataPKI from "./pages/pki/DecryptDataPKI";
27-
import EncryptDataPki from "./pages/pki/EncryptDataPki";
28-
import GetCertificate from "./pages/pki/GetCertificate";
29-
import GrantAccess from "./pages/pki/GrantAccess";
30-
import ImportAndUnwrapUDK from "./pages/pki/ImportAndUnwrapUDK";
31-
import SendWrappedDecryptionKey from "./pages/pki/SendWrappedDecryptionKey";
32-
import SetupPki from "./pages/pki/SetupPki";
33-
import UploadCert from "./pages/pki/UploadCert";
34-
import { navigationConfig } from "./utils/navigationConfig";
3+
import { generateComponentsList, navigationConfig } from "./utils/navigationConfig";
4+
import { routePathsConfig } from "./utils/routePathsConfig";
355

366
const componentsList: {
377
[key: string]: JSX.Element;
38-
} = {
39-
// Overview
40-
overview: <OverView />,
41-
// Covercrypt
42-
"encrypt-with-access-policies/about-covercrypt": <AboutCovercrypt />,
43-
"encrypt-with-access-policies/set-up-service": <SetupCovercrypt />,
44-
"encrypt-with-access-policies/create-policy": <CreateEncryptionPolicy />,
45-
"encrypt-with-access-policies/generate-master-key-pair": <CreateMasterKeyPair />,
46-
"encrypt-with-access-policies/encrypt-data": <EncryptData />,
47-
"encrypt-with-access-policies/user-decryption-key": <GenerateUDK />,
48-
"encrypt-with-access-policies/decrypt-data": <DecryptData />,
49-
// Findex
50-
"build-encrypted-indexes/about-findex": <AboutFindex />,
51-
"build-encrypted-indexes/set-up-service": <SetupFindex />,
52-
"build-encrypted-indexes/instantiate-findex": <InstantiateFindex />,
53-
"build-encrypted-indexes/index-database": <IndexDatabase />,
54-
"build-encrypted-indexes/search-in-database": <SearchInDatabase />,
55-
// PKI
56-
"distibute-keys/about-pki": <AboutPKI />,
57-
"distibute-keys/set-up-service": <SetupPki />,
58-
"distibute-keys/encrypt-data": <EncryptDataPki />,
59-
"distibute-keys/save-sk-publish-certificate": <UploadCert />,
60-
"distibute-keys/grant-access": <GrantAccess />,
61-
"distibute-keys/retrieve-wrapped-decryption-key": <GetCertificate />,
62-
"distibute-keys/send-key-in-kms": <SendWrappedDecryptionKey />,
63-
"distibute-keys/unwrap-decryption-key": <ImportAndUnwrapUDK />,
64-
"distibute-keys/decrypt-data": <DecryptDataPKI />,
65-
66-
// Confidential VM
67-
"confidential-vm/about-cosmian-vm": <UseConfidentialVm />,
68-
"confidential-vm/deploy-application": <DeployApplication />,
69-
"confidential-vm/snapshot-cosmian-vm": <SnapshotVm />,
70-
"confidential-vm/audit-snapshot": <AuditSnapshot />,
71-
"confidential-vm/verify-integrity": <VerifyIntegrity />,
72-
"confidential-vm/detect-malicious-activities": <DetectMalware />,
73-
74-
// CSE
75-
"client-side-encryption/about-cse": <AboutCse />,
76-
"client-side-encryption/set-up-service": <SetupCse />,
77-
"client-side-encryption/get-summary": <SummarizeDocument />,
78-
};
8+
} = generateComponentsList(routePathsConfig);
799

8010
const router = createBrowserRouter(
8111
createRoutesFromElements(

src/pages/OverView.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import TableReduced from "../assets/table-reduced-attackers.drawio.svg";
55
import { ImageWrapper, SingleContent } from "../component/Layout";
66

77
const OverView = (): JSX.Element => {
8-
// const origin = window.location.origin;
9-
108
return (
119
<SingleContent>
1210
<h1>Architecture - Attackers, Threats and Solutions</h1>
@@ -29,7 +27,7 @@ const OverView = (): JSX.Element => {
2927
data protection provides the highest assurance of data privacy and security. We providecode blocks, libraries and tools that make
3028
using its technologies to implement client-side encryption easy.
3129
<div style={{ marginTop: 20 }}>
32-
<Link to={origin + "/client-side-encryption/about-cse"}>→ Client-side encryption example</Link>
30+
<Link to={"/client-side-encryption/about-cse"}>→ Client-side encryption example</Link>
3331
</div>
3432
</div>
3533
<h2 style={{ marginTop: 50 }}>Protection against a reduced list of attackers</h2>

0 commit comments

Comments
 (0)