MCPcopy
hub / github.com/OpenSignLabs/OpenSign / randomId

Function randomId

apps/OpenSign/src/constant/Utils.js:130–143  ·  view source on GitHub ↗
(digit = 8)

Source from the content-addressed store, hash-verified

128});
129
130export const randomId = (digit = 8) => {
131 // 1. Grab a cryptographically-secure 32-bit random value
132 // Use crypto for stronger randomness
133 const randomBytes = crypto.getRandomValues(new Uint32Array(1));
134 const raw = randomBytes[0]; // 0 … 4,294,967,295
135
136 // Calculate the min and max for the given digit length
137 const min = Math.pow(10, digit - 1); // e.g., digit=3 → 100
138 const max = Math.pow(10, digit) - 1; // e.g., digit=3 → 999
139 const range = max - min + 1;
140
141 // Collapse random value into the range and shift
142 return min + (raw % range);
143};
144//function for create list of year for date widget
145export const range = (start, end, step) => {
146 const range = [];

Callers 13

copyPlaceholderFunction · 0.90
handleApplyCopyFunction · 0.90
prefillObjFunction · 0.90
getDocumentDetailsFunction · 0.90
getSignerPosFunction · 0.90
handleAddNewRecipientsFunction · 0.90
addPositionOfSignatureFunction · 0.90
TemplatePlaceholderFunction · 0.90
getSignerPosFunction · 0.90
handleAddRoleFunction · 0.90
getSignerPosFunction · 0.90
embedWidgetsToDocFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected