Skip to content

Commit

Permalink
Merge pull request #27 from Cosmian/refactor/refactoring_hard_coded_p…
Browse files Browse the repository at this point in the history
…aths

Refactor/refactoring navigation config
  • Loading branch information
HatemMn authored Mar 20, 2024
2 parents acf0288 + 20bccdc commit 60a701c
Show file tree
Hide file tree
Showing 7 changed files with 990 additions and 866 deletions.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Adding new pages :

The single page tree structure is centralized in the following file : [`src/utils/routePathsConfig.tsx`](src/utils/routePathsConfig.tsx).

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.
1,273 changes: 700 additions & 573 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion public/actions/javascript/summarizeDocumentContent.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { MSE_APP_URL } from "./backendConfig";

export const summarizeDocumentContent = async (textInput: string): Promise<{ summary: string } | Error> => {
export const summarizeDocumentContent = async (textInput: string, userToken: string): Promise<{ summary: string } | Error> => {
const formData = new FormData();
formData.append("doc", textInput);
const response = await fetch(`${MSE_APP_URL}/summarize`, {
method: "POST",
headers: {
Authorization: "Bearer " + userToken,
},
body: formData,
});
if (!response.ok) {
Expand Down
76 changes: 3 additions & 73 deletions src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,81 +1,11 @@
import { Navigate, Route, RouterProvider, createBrowserRouter, createRoutesFromElements } from "react-router-dom";
import Layout from "./component/Layout";
import OverView from "./pages/OverView";
import AuditSnapshot from "./pages/confidentialVm/AuditSnapshot";
import DeployApplication from "./pages/confidentialVm/DeployApplication";
import DetectMalware from "./pages/confidentialVm/DetectMalware";
import SnapshotVm from "./pages/confidentialVm/SnapshotVm";
import UseConfidentialVm from "./pages/confidentialVm/UseConfidentialVm";
import VerifyIntegrity from "./pages/confidentialVm/VerifyIntegrity";
import AboutCovercrypt from "./pages/covercrypt/AboutCovercrypt";
import CreateEncryptionPolicy from "./pages/covercrypt/CreateEncryptionPolicy";
import CreateMasterKeyPair from "./pages/covercrypt/CreateMasterKeyPair";
import DecryptData from "./pages/covercrypt/DecryptData";
import EncryptData from "./pages/covercrypt/EncryptData";
import GenerateUDK from "./pages/covercrypt/GenerateUDK";
import SetupCovercrypt from "./pages/covercrypt/SetupCovercrypt";
import AboutCse from "./pages/cse/AboutCse";
import SetupCse from "./pages/cse/SetupCse";
import SummarizeDocument from "./pages/cse/SummarizeDocument";
import AboutFindex from "./pages/findex/AboutFindex";
import IndexDatabase from "./pages/findex/IndexDatabase";
import InstantiateFindex from "./pages/findex/InstantiateFindex";
import SearchInDatabase from "./pages/findex/SearchInDatabase";
import SetupFindex from "./pages/findex/SetupFindex";
import AboutPKI from "./pages/pki/AboutPKI";
import DecryptDataPKI from "./pages/pki/DecryptDataPKI";
import EncryptDataPki from "./pages/pki/EncryptDataPki";
import GetCertificate from "./pages/pki/GetCertificate";
import GrantAccess from "./pages/pki/GrantAccess";
import ImportAndUnwrapUDK from "./pages/pki/ImportAndUnwrapUDK";
import SendWrappedDecryptionKey from "./pages/pki/SendWrappedDecryptionKey";
import SetupPki from "./pages/pki/SetupPki";
import UploadCert from "./pages/pki/UploadCert";
import { navigationConfig } from "./utils/navigationConfig";
import { generateComponentsList, navigationConfig } from "./utils/navigationConfig";
import { routePathsConfig } from "./utils/routePathsConfig";

const componentsList: {
[key: string]: JSX.Element;
} = {
// Overview
overview: <OverView />,
// Covercrypt
"encrypt-with-access-policies/about-covercrypt": <AboutCovercrypt />,
"encrypt-with-access-policies/set-up-service": <SetupCovercrypt />,
"encrypt-with-access-policies/create-policy": <CreateEncryptionPolicy />,
"encrypt-with-access-policies/generate-master-key-pair": <CreateMasterKeyPair />,
"encrypt-with-access-policies/encrypt-data": <EncryptData />,
"encrypt-with-access-policies/user-decryption-key": <GenerateUDK />,
"encrypt-with-access-policies/decrypt-data": <DecryptData />,
// Findex
"build-encrypted-indexes/about-findex": <AboutFindex />,
"build-encrypted-indexes/set-up-service": <SetupFindex />,
"build-encrypted-indexes/instantiate-findex": <InstantiateFindex />,
"build-encrypted-indexes/index-database": <IndexDatabase />,
"build-encrypted-indexes/search-in-database": <SearchInDatabase />,
// PKI
"distibute-keys/about-pki": <AboutPKI />,
"distibute-keys/set-up-service": <SetupPki />,
"distibute-keys/encrypt-data": <EncryptDataPki />,
"distibute-keys/save-sk-publish-certificate": <UploadCert />,
"distibute-keys/grant-access": <GrantAccess />,
"distibute-keys/retrieve-wrapped-decryption-key": <GetCertificate />,
"distibute-keys/send-key-in-kms": <SendWrappedDecryptionKey />,
"distibute-keys/unwrap-decryption-key": <ImportAndUnwrapUDK />,
"distibute-keys/decrypt-data": <DecryptDataPKI />,

// Confidential VM
"confidential-vm/about-cosmian-vm": <UseConfidentialVm />,
"confidential-vm/deploy-application": <DeployApplication />,
"confidential-vm/snapshot-cosmian-vm": <SnapshotVm />,
"confidential-vm/audit-snapshot": <AuditSnapshot />,
"confidential-vm/verify-integrity": <VerifyIntegrity />,
"confidential-vm/detect-malicious-activities": <DetectMalware />,

// CSE
"client-side-encryption/about-cse": <AboutCse />,
"client-side-encryption/set-up-service": <SetupCse />,
"client-side-encryption/get-summary": <SummarizeDocument />,
};
} = generateComponentsList(routePathsConfig);

const router = createBrowserRouter(
createRoutesFromElements(
Expand Down
4 changes: 1 addition & 3 deletions src/pages/OverView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import TableReduced from "../assets/table-reduced-attackers.drawio.svg";
import { ImageWrapper, SingleContent } from "../component/Layout";

const OverView = (): JSX.Element => {
// const origin = window.location.origin;

return (
<SingleContent>
<h1>Architecture - Attackers, Threats and Solutions</h1>
Expand All @@ -29,7 +27,7 @@ const OverView = (): JSX.Element => {
data protection provides the highest assurance of data privacy and security. We providecode blocks, libraries and tools that make
using its technologies to implement client-side encryption easy.
<div style={{ marginTop: 20 }}>
<Link to={origin + "/client-side-encryption/about-cse"}>→ Client-side encryption example</Link>
<Link to={"/client-side-encryption/about-cse"}>→ Client-side encryption example</Link>
</div>
</div>
<h2 style={{ marginTop: 50 }}>Protection against a reduced list of attackers</h2>
Expand Down
Loading

0 comments on commit 60a701c

Please sign in to comment.