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

Function TestVerifyWithMaxAge

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

Source from the content-addressed store, hash-verified

107}
108
109func TestVerifyWithMaxAge(t *testing.T) {
110 s := NewSigner("test-secret")
111 h := s.Sign(AuthPayload{
112 Verified: true,
113 Sender: "alice@example.com",
114 EntityType: "human",
115 })
116
117 // Should pass with generous max age
118 if !s.VerifyWithMaxAge(h, 1*time.Hour) {
119 t.Error("expected VerifyWithMaxAge to pass with 1h window")
120 }
121
122 // Should fail with very tight max age after a small delay
123 time.Sleep(5 * time.Millisecond)
124 if s.VerifyWithMaxAge(h, 1*time.Millisecond) {
125 t.Error("expected VerifyWithMaxAge to reject with 1ms window")
126 }
127}
128
129func TestSignVerifyWithDomainCheck(t *testing.T) {
130 s := NewSigner("test-secret")

Callers

nothing calls this directly

Calls 4

SignMethod · 0.95
VerifyWithMaxAgeMethod · 0.95
NewSignerFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected