summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-09-15 12:35:05 +0700
committerShulhan <m.shulhan@gmail.com>2020-09-15 12:35:05 +0700
commitd4c49078f260b3b899cdfce0c824d499ef49a7e3 (patch)
tree7f79eaebc05d098f432383fc47c82f5f84337c0c
parent8a4a80a0a2f0eec69f886187f58a5b9db7083916 (diff)
downloadpakakeh.go-d4c49078f260b3b899cdfce0c824d499ef49a7e3.tar.xz
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
-rw-r--r--lib/paseto/public_mode.go2
1 files changed, 1 insertions, 1 deletions
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,