MCPcopy Create free account
hub / github.com/aetherstate/GODMOD3.AI / deriveSessionKey

Function deriveSessionKey

functions/api/telemetry.ts:79–86  ·  view source on GitHub ↗

Derive a fallback key when session_id is missing.

(event: TelemetryEvent)

Source from the content-addressed store, hash-verified

77
78/** Derive a fallback key when session_id is missing. */
79function deriveSessionKey(event: TelemetryEvent): string {
80 const raw = JSON.stringify(event)
81 let h = 0
82 for (let i = 0; i < raw.length; i++) {
83 h = ((h << 5) - h + raw.charCodeAt(i)) | 0
84 }
85 return `__derived_${Math.abs(h).toString(36)}`
86}
87
88// ── Event Schema Validation ──────────────────────────────────────────
89

Callers 1

onRequestPostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected