(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestVerifyRejectsExpiredTimestamp(t *testing.T) { |
| 49 | s := NewSigner("test-secret") |
| 50 | h := s.Sign(AuthPayload{ |
| 51 | Verified: true, |
| 52 | Sender: "alice@example.com", |
| 53 | EntityType: "human", |
| 54 | }) |
| 55 | |
| 56 | // Overwrite timestamp to 10 minutes ago |
| 57 | h[HeaderTimestamp] = time.Now().UTC().Add(-10 * time.Minute).Format(time.RFC3339) |
| 58 | |
| 59 | if s.Verify(h) { |
| 60 | t.Error("expected Verify to reject expired timestamp") |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | func TestVerifyRejectsFutureTimestamp(t *testing.T) { |
| 65 | s := NewSigner("test-secret") |