aboutsummaryrefslogtreecommitdiff
path: root/lib/paseto/payload.go
AgeCommit message (Collapse)Author
14 dayspaseto/v4: allow empty Footer and empty data in PayloadShulhan
If the footer is empty then the message will be unpacked with its own public key, instead of sender public key.
2026-03-31lib/paseto: move [Message.Unpack] to [v4.UnpackPublicToken]Shulhan
Unpacking v4 public protocol on parent package seems wrong. Only v4 package should know how to unpack it regarding the available fields in the Message.
2026-03-30lib/paseto: make the DriftSeconds changeableShulhan
This is to make user can increases or decreases the leeway during Payload Validate.
2026-03-30lib/paseto: add unit tests for Payload and Message typesShulhan
2026-03-30lib/paseto: predefines errors variablesShulhan
Instead of fixed strings, predefined the error variables so the caller can check the actual error.
2026-03-30lib/paseto: store the time as Unix epoch inside PayloadShulhan
Previously, we use time.Time to store the value for ExpiredAt, NotBefore, and IssuedAt. Even thought this is allowed (see RFC 7519 section 2, NumericDate) but it is not a standard practices. This changes them to store Unix epoch with int64.
2026-03-29lib/paseto: move message, payload, footer, and key type from v2Shulhan
The [v2/PublicToken] has been moved and renamed as [paseto.Message]. The Data field in the Message is removed since its duplicate with [Payload.Data]. The [v2/JSONToken] has been moved and renamed as [paseto.Payload]. In the [Payload.Validate] method, we remove the validation for IssuedAt field, since its usage is to store the time the token is created. The Data field type in the Payload changes from string to any. The [v2/JSONFooter] has been moved and renamed as [paseto.Footer]. The type of Data field in Footer changes from map[string]any to any. The KID field in the Footer has been renamed to PeerID along with its json identifer. The [v2/Key] has been moved and renamed as [paseto.Peer].