MCPcopy Create free account
hub / github.com/EvoMap/evolver / generateUUIDv7

Function generateUUIDv7

src/proxy/mailbox/store.js:53–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51// Bits 64-65: var=0b10, Bits 66-127: rand_b
52
53function generateUUIDv7() {
54 const now = Date.now();
55 const msHex = now.toString(16).padStart(12, '0');
56
57 const bytes = crypto.randomBytes(10);
58 bytes[0] = (bytes[0] & 0x0f) | 0x70; // version 7
59 bytes[2] = (bytes[2] & 0x3f) | 0x80; // variant 10
60
61 const randHex = bytes.toString('hex');
62
63 // Standard UUID format: 8-4-4-4-12 (32 hex total)
64 return [
65 msHex.slice(0, 8),
66 msHex.slice(8, 12),
67 randHex.slice(0, 4),
68 randHex.slice(4, 8),
69 randHex.slice(8, 20),
70 ].join('-');
71}
72
73// --- JSONL file helpers ---
74

Callers 3

sendMethod · 0.85
writeInboundMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected