(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func 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 | |
| 129 | func TestSignVerifyWithDomainCheck(t *testing.T) { |
| 130 | s := NewSigner("test-secret") |
nothing calls this directly
no test coverage detected