MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / DeterministicProtectionEventID

Function DeterministicProtectionEventID

internal/identity/screening.go:57–60  ·  view source on GitHub ↗

DeterministicProtectionEventID derives a stable id from the dedupe key (message + source + reason + detector) so that re-screening the same message — e.g. an MTA-retried inbound delivery — inserts the SAME row via ON CONFLICT DO NOTHING instead of a duplicate. Mirrors webhookpub.DeterministicEventID

(messageID, source, reason, detector string)

Source from the content-addressed store, hash-verified

55// an MTA-retried inbound delivery — inserts the SAME row via ON CONFLICT DO NOTHING
56// instead of a duplicate. Mirrors webhookpub.DeterministicEventID.
57func DeterministicProtectionEventID(messageID, source, reason, detector string) string {
58 h := sha256.Sum256([]byte(messageID + "|" + source + "|" + reason + "|" + detector))
59 return "scr_" + hex.EncodeToString(h[:16])
60}
61
62// CreateProtectionEvent appends a screening event. The insert is idempotent on the
63// primary key: callers that set a DeterministicProtectionEventID get exactly-once

Callers 4

screenInboundMethod · 0.92
screeningEventsMethod · 0.92

Calls

no outgoing calls