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

Function DeterministicEventID

internal/webhookpub/event.go:218–228  ·  view source on GitHub ↗

DeterministicEventID derives a stable event id from the trigger context. Per design §5.1, the input formula per event type is: email.received: sha256(message_id || "|" || event_type) email.sent: sha256(message_id || "|" || event_type) pending_review/review_approved/review_rejected: sha256(pe

(parts ...string)

Source from the content-addressed store, hash-verified

216// SMTP retries: the retried trigger produces the same id, and the
217// outbox INSERT no-ops via ON CONFLICT (id) DO NOTHING.
218func DeterministicEventID(parts ...string) string {
219 h := sha256.New()
220 for i, p := range parts {
221 if i > 0 {
222 h.Write([]byte("|"))
223 }
224 h.Write([]byte(p))
225 }
226 sum := h.Sum(nil)
227 return "evt_" + hex.EncodeToString(sum[:16])
228}

Calls 1

WriteMethod · 0.45