add ability to issue tokens with no expiry

This commit is contained in:
juancwu 2026-04-29 12:44:48 +00:00
commit de907d83cb
5 changed files with 76 additions and 9 deletions

View file

@ -41,7 +41,10 @@ func decodePayload(b []byte) (payload, error) {
// expired reports whether the payload's expiry has passed at the given time.
// Uses >= so a token expiring exactly at `now` is considered expired
// (the conservative choice).
// (the conservative choice). Exp == 0 means the token never expires.
func (p payload) expired(now time.Time) bool {
if p.Exp == 0 {
return false
}
return now.Unix() >= p.Exp
}