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

Function TestSignVerifyWithDomainCheck

internal/headers/signer_test.go:129–150  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

127}
128
129func TestSignVerifyWithDomainCheck(t *testing.T) {
130 s := NewSigner("test-secret")
131 h := s.Sign(AuthPayload{
132 Verified: true,
133 Sender: "alice@example.com",
134 EntityType: "human",
135 DomainCheck: "spf=pass; dkim=none",
136 })
137
138 if h[HeaderDomainCheck] != "spf=pass; dkim=none" {
139 t.Errorf("DomainCheck = %q, want %q", h[HeaderDomainCheck], "spf=pass; dkim=none")
140 }
141 if !s.Verify(h) {
142 t.Error("expected Verify to return true with DomainCheck")
143 }
144
145 // Tampering with domain check should break signature
146 h[HeaderDomainCheck] = "spf=fail; dkim=fail"
147 if s.Verify(h) {
148 t.Error("expected Verify to reject tampered DomainCheck")
149 }
150}
151
152// TestMessageIDIsBound ensures auth headers cannot be lifted from one
153// message and reused on another within the replay window. Without

Callers

nothing calls this directly

Calls 4

SignMethod · 0.95
VerifyMethod · 0.95
NewSignerFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected