(t *testing.T)
| 106 | } |
| 107 | |
| 108 | func TestVerifyRejectsExpired(t *testing.T) { |
| 109 | s := approvaltoken.NewSigner(testSecret) |
| 110 | past := time.Now().Add(-1 * time.Second) |
| 111 | tok, _ := s.Sign("msg_x", approvaltoken.ActionApprove, past) |
| 112 | |
| 113 | _, err := s.Verify(tok) |
| 114 | if !errors.Is(err, approvaltoken.ErrTokenExpired) { |
| 115 | t.Errorf("expired token: err = %v, want ErrTokenExpired", err) |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | func TestVerifyRejectsWrongSecret(t *testing.T) { |
| 120 | issuer := approvaltoken.NewSigner("secret-a") |