Skip to content

Commit 481c014

Browse files
fix: avoid generating repetitive widgets Id
1 parent 8788afa commit 481c014

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

apps/OpenSign/src/constant/Utils.jsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,10 +683,14 @@ export const signPdfFun = async (
683683
};
684684

685685
export const randomId = () => {
686-
const randomBytes = crypto.getRandomValues(new Uint16Array(1));
687-
const randomValue = randomBytes[0];
688-
const randomDigit = 1000 + (randomValue % 9000);
689-
return randomDigit;
686+
// 1. Grab a cryptographically-secure 32-bit random value
687+
const randomBytes = crypto.getRandomValues(new Uint32Array(1));
688+
const raw = randomBytes[0]; // 0 … 4 294 967 295
689+
690+
// 2. Collapse into a 90 000 000-wide band (0…89 999 999), then shift to 10 000 000…99 999 999
691+
const eightDigit = 10_000_000 + (raw % 90_000_000);
692+
693+
return eightDigit;
690694
};
691695

692696
export const createDocument = async (
@@ -1552,7 +1556,7 @@ export const multiSignEmbed = async (
15521556
let hasError = false;
15531557
for (let item of widgets) {
15541558
//pdfOriginalWH contained all pdf's pages width and height
1555-
//'getSize' is used to get particular pdf's page width and height
1559+
//'getSize' is used to get particular pdf's page width and height
15561560
const getSize = pdfOriginalWH.find(
15571561
(page) => page?.pageNumber === item?.pageNumber
15581562
);

apps/OpenSign/src/pages/Form.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ const Forms = (props) => {
455455
setBcc([]);
456456
setFolder({ ObjectId: "", Name: "" });
457457
const notifySign =
458-
extUserData?.NotifyOnSignatures
458+
extUserData?.NotifyOnSignatures !== undefined
459459
? extUserData?.NotifyOnSignatures
460460
: true;
461461
setFormData({
@@ -534,7 +534,7 @@ const Forms = (props) => {
534534
setBcc([]);
535535
setFolder({ ObjectId: "", Name: "" });
536536
const notifySign =
537-
extUserData?.NotifyOnSignatures
537+
extUserData?.NotifyOnSignatures !== undefined
538538
? extUserData?.NotifyOnSignatures
539539
: true;
540540
let obj = {

apps/OpenSignServer/Dockerhubfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Use an official Node runtime as the base image
22
FROM node:22.14.0
33

4+
RUN wget https://download.oracle.com/java/23/archive/jdk-23_linux-x64_bin.deb \
5+
&& dpkg -i jdk-23_linux-x64_bin.deb
46

57
# Set the working directory inside the container
68
WORKDIR /usr/src/app

0 commit comments

Comments
 (0)