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

Function TestVerifyRejectsFutureTimestamp

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

Source from the content-addressed store, hash-verified

62}
63
64func TestVerifyRejectsFutureTimestamp(t *testing.T) {
65 s := NewSigner("test-secret")
66 h := s.Sign(AuthPayload{
67 Verified: true,
68 Sender: "alice@example.com",
69 EntityType: "human",
70 })
71
72 // Overwrite timestamp to 2 minutes in the future (beyond 30s grace)
73 h[HeaderTimestamp] = time.Now().UTC().Add(2 * time.Minute).Format(time.RFC3339)
74
75 if s.Verify(h) {
76 t.Error("expected Verify to reject future timestamp")
77 }
78}
79
80func TestVerifyRejectsTamperedHeader(t *testing.T) {
81 s := NewSigner("test-secret")

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