fix: change randomId generator

This commit is contained in:
prafull-opensignlabs
2024-03-07 13:20:26 +05:30
parent 9bda7dee7f
commit f57fcd25c9
3 changed files with 12 additions and 11 deletions
+6 -1
View File
@@ -479,7 +479,12 @@ export const signPdfFun = async (
return response;
};
export const randomId = () => Math.floor(1000 + Math.random() * 9000);
export const randomId = () => {
const randomBytes = crypto.getRandomValues(new Uint16Array(1));
const randomValue = randomBytes[0];
const randomDigit = 1000 + (randomValue % 9000);
return randomDigit;
};
export const createDocument = async (template, placeholders, signerData) => {
if (template && template.length > 0) {