Skip to content

Commit c736bbc

Browse files
authored
Merge pull request #145 from prafull-opensignlabs/staging
remove hardcoded pfx passphrase
2 parents 4bbf0d0 + f227b79 commit c736bbc

File tree

12 files changed

+130
-14
lines changed

12 files changed

+130
-14
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ [email protected]
4747

4848
# Base64 encoded PFX or p12 document signing certificate file *********************************************************************************************************************
4949
PFX_BASE64=
50+
51+
# Provide Pass pharse of above PFX or p12 document
52+
PASS_PHRASE=

.env.local_dev

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ [email protected]
5151

5252
# Base64 encoded PFX or p12 document signing certificate file *********************************************************************************************************************
5353
PFX_BASE64=
54+
55+
# Provide Pass pharse of above PFX or p12 document
56+
PASS_PHRASE=

apps/OpenSign/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"web-vitals": "^2.1.4"
4141
},
4242
"scripts": {
43-
"start": "mf-cra start",
44-
"start-prod": "serve -s build",
43+
"start": "serve -s build",
44+
"start-dev": "mf-cra start",
4545
"build": "rm -rf public/mfbuild && npm run micro && CI=false && mf-cra build",
4646
"micro": "cd ../../microfrontends/SignDocuments && npm install && npm run build",
4747
"test": "react-scripts test",

apps/OpenSign/src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import PageNotFound from "./routes/PageNotFound";
1414
import ForgetPassword from "./routes/ForgetPassword";
1515
import ChangePassword from "./routes/ChangePassword";
1616
import ReportMicroapp from "./components/ReportMicroapp";
17+
import LoadMf from "./routes/LoadMf";
1718

1819
function App() {
1920
const [isloading, setIsLoading] = useState(true);
@@ -59,6 +60,7 @@ function App() {
5960
<Routes>
6061
<Route exact path="/" element={<Login />} />
6162
<Route exact path="/signup" element={<Signup />} />
63+
<Route exact path="/loadmf/:remoteApp/*" element={<LoadMf />} />
6264
<Route exact path="/forgetpassword" element={<ForgetPassword />} />
6365
{process.env.REACT_APP_ENABLE_SUBSCRIPTION && (
6466
<>

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const ReportTable = ({
9393
{List?.length > 0 ? (
9494
<>
9595
{currentLists.map((item, index) => (
96-
<tr className="border-t-[1px]" key={index}>
96+
<tr className="border-y-[1px]" key={index}>
9797
<td className="px-4 py-2">{index + 1}</td>
9898
<td className="px-4 py-2 font-semibold">{item?.Name} </td>
9999
<td className="px-4 py-2">{item?.Note || "-"}</td>
@@ -153,7 +153,7 @@ const ReportTable = ({
153153
)}
154154
</tbody>
155155
</table>
156-
<div className="flex flex-wrap items-center gap-2 p-2 border-t-[1px]">
156+
<div className="flex flex-wrap items-center gap-2 p-2 ">
157157
{List.length > 10 && (
158158
<>
159159
{currentPage > 1 && (

apps/OpenSign/src/routes/LoadMf.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { Suspense } from "react";
2+
import { useParams } from "react-router-dom";
3+
import useFederatedComponent from "mf-cra";
4+
import React from "react";
5+
import Title from "../components/Title";
6+
function RemoteApp({ app }) {
7+
// console.log("app ", app);
8+
const { Component: RemoteComponent } = useFederatedComponent(app);
9+
// console.log("RemoteComponent ", RemoteComponent);
10+
return (
11+
<>
12+
<Title title={app.remoteName} />
13+
<Suspense
14+
fallback={
15+
<div style={{ height: "300px" }}>
16+
<div
17+
style={{
18+
marginLeft: "45%",
19+
marginTop: "150px",
20+
fontSize: "45px",
21+
color: "#3dd3e0"
22+
}}
23+
className="loader-37"
24+
></div>
25+
</div>
26+
}
27+
>
28+
<div
29+
style={{
30+
boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.33)",
31+
backgroundColor: "#ffffff",
32+
width: "100%",
33+
overflow: "hidden",
34+
borderRadius: 3,
35+
minHeight: "70vh"
36+
}}
37+
>
38+
{RemoteComponent && <RemoteComponent />}
39+
</div>
40+
</Suspense>
41+
</>
42+
);
43+
}
44+
function checkObjectProperties(obj) {
45+
// Check if all three properties exist in the object
46+
if (
47+
obj &&
48+
obj.remoteName !== undefined &&
49+
obj.remoteUrl !== undefined &&
50+
obj.moduleToLoad !== undefined
51+
) {
52+
return true; // All properties are present
53+
} else {
54+
return false; // At least one property is missing
55+
}
56+
}
57+
export default function RemoteAppContainer() {
58+
const { remoteApp } = useParams();
59+
60+
const obj = {
61+
remoteUrl: window.location.origin + "/mfbuild/remoteEntry.js",
62+
moduleToLoad: "./AppRoutes",
63+
remoteName: remoteApp
64+
};
65+
// console.log("obj ", obj);
66+
const isMf = checkObjectProperties(obj);
67+
if (isMf) {
68+
const appToLoad = obj;
69+
return <RemoteApp app={appToLoad} />;
70+
} else {
71+
return (
72+
<div className="flex items-center justify-center h-screen w-full bg-white rounded">
73+
<div className="text-center">
74+
<h1 className="text-[60px] lg:text-[120px] font-semibold text-black">
75+
404
76+
</h1>
77+
<p className="text-[30px] lg:text-[50px] text-black">
78+
Page Not Found
79+
</p>
80+
</div>
81+
</div>
82+
);
83+
}
84+
}

apps/OpenSign/src/routes/PlanSubscriptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const PlanSubscriptions = () => {
6464
style={{
6565
backgroundColor: "white",
6666
overflowY: "auto",
67-
maxHeight: "600px",
67+
maxHeight: "100%",
6868
"--theme-color": "#7952b3",
6969
"--plan-width": 30
7070
}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const signer=require("node-signpdf").default;class SignPDF{constructor(e,t){this.pdfDoc=e,this.certificate=t}async signPDF(){return signer.sign(this.pdfDoc,this.certificate,{passphrase:"emudhra"})}static unit8ToBuffer(e){var t=Buffer.alloc(e.byteLength),r=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=r[e];return t}}module.exports=SignPDF;
1+
const signer=require("node-signpdf").default;class SignPDF{constructor(e,t){this.pdfDoc=e,this.certificate=t}async signPDF(){return signer.sign(this.pdfDoc,this.certificate, process.env.PASS_PHRASE ? {passphrase : process.env.PASS_PHRASE}: null)}static unit8ToBuffer(e){var t=Buffer.alloc(e.byteLength),r=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=r[e];return t}}module.exports=SignPDF;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from "react";
2+
3+
const PageNotFound = () => {
4+
return (
5+
<div className="flex items-center justify-center h-screen w-full bg-white rounded">
6+
<div className="text-center">
7+
<h1 className="text-[60px] lg:text-[120px] font-semibold text-black">
8+
404
9+
</h1>
10+
<p className="text-[30px] lg:text-[50px] text-black">Page Not Found</p>
11+
</div>
12+
</div>
13+
);
14+
};
15+
16+
export default PageNotFound;

microfrontends/SignDocuments/src/Component/login.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ function Login() {
116116
localStorage.setItem("accesstoken", _user.sessionToken);
117117
setLoading(false);
118118
//navigate user to on signature page
119-
navigate(`/recipientSignPdf/${id}/${contactBookId}`);
119+
// navigate(`/recipientSignPdf/${id}/${contactBookId}`);
120+
navigate(`/loadmf/signmicroapp/recipientSignPdf/${id}/${contactBookId}`);
120121
}
121122
} catch (error) {}
122123
} else {

0 commit comments

Comments
 (0)