MCPcopy
hub / github.com/codedogQBY/ReadAny / generateId

Function generateId

packages/core/src/utils/generate-id.ts:7–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5 * Does NOT rely on crypto.randomUUID() which is unavailable in RN.
6 */
7export function generateId(): string {
8 const bytes = new Uint8Array(16);
9 crypto.getRandomValues(bytes);
10 // Set version 4 (0100) in byte 6
11 bytes[6] = (bytes[6] & 0x0f) | 0x40;
12 // Set variant 10xx in byte 8
13 bytes[8] = (bytes[8] & 0x3f) | 0x80;
14
15 const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
16 return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
17}

Callers 12

library-store.tsFile · 0.90
useReaderBookmarkFunction · 0.90
createEmptyBookReviewFunction · 0.90
normalizeReviewsFunction · 0.90
buildBookMetadataUpdateFunction · 0.90
normalizeMetadataReviewsFunction · 0.90
createLANQRDataFunction · 0.90
getDeviceIdFunction · 0.90
insertGroupFunction · 0.90
handleToggleBookmarkFunction · 0.90

Calls 2

fromMethod · 0.80
sliceMethod · 0.80

Tested by

no test coverage detected