From d4c49078f260b3b899cdfce0c824d499ef49a7e3 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Tue, 15 Sep 2020 12:35:05 +0700 Subject: paseto: round the time to second to prevent sub-second precision Without rounding it will marshal the time value into, 2020-09-15T11:55:50.847276+07:00 This changes, round current time values to second so we can get value 2020-09-15T11:55:50+07:00 --- lib/paseto/public_mode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/paseto/public_mode.go b/lib/paseto/public_mode.go index 36b1f535..fdbbfc9f 100644 --- a/lib/paseto/public_mode.go +++ b/lib/paseto/public_mode.go @@ -124,7 +124,7 @@ func (auth *PublicMode) RemovePeer(id string) { func (auth *PublicMode) Pack(audience, subject string, data []byte, footer map[string]interface{}) ( token string, err error, ) { - now := time.Now() + now := time.Now().Round(time.Second) expiredAt := now.Add(DefaultTTL) jsonToken := JSONToken{ Issuer: auth.our.ID, -- cgit v1.3