Commit 4d652001 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

feat: don't call time.Now() twice in succession in generating keyshare authentication JWT

parent 77d8ef0f
......@@ -65,11 +65,12 @@ func (c *Core) ValidatePin(secrets UserSecrets, pin string) (string, error) {
// Generate jwt token
id := s.id()
t := time.Now()
token := jwt.NewWithClaims(jwt.SigningMethodRS256, jwt.MapClaims{
"iss": c.jwtIssuer,
"sub": "auth_tok",
"iat": time.Now().Unix(),
"exp": time.Now().Add(time.Duration(c.jwtPinExpiry) * time.Second).Unix(),
"iat": t.Unix(),
"exp": t.Add(time.Duration(c.jwtPinExpiry) * time.Second).Unix(),
"token_id": base64.StdEncoding.EncodeToString(id[:]),
})
token.Header["kid"] = c.jwtPrivateKeyID
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment