Skip to content

Commit b90b9ab

Browse files
committed
Refactor JWT token type to use standard claims and improve documentation
- Replace direct embedding of jwt.RegisteredClaims with type alias - Add documentation link to RFC 7519 for claims standard - Clarify Token struct's purpose and metadata handling
1 parent c14190e commit b90b9ab

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

authkit/jwtkit/jwt.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ type TokenManager interface {
2121
ParseVerify(token string) (*Token, error)
2222
}
2323

24-
// Token is a struct that holds the token and its claims.
24+
// Claims represents claims for JWT.
25+
// See: https://tools.ietf.org/html/rfc7519#section-4.1
26+
type Claims = jwt.RegisteredClaims
27+
28+
// Token represents claims for JWT with additional metadata.
2529
type Token struct {
26-
jwt.RegisteredClaims
30+
Claims
2731
Meta map[string]any `json:"meta,omitempty"`
2832

2933
raw *jwt.Token

0 commit comments

Comments
 (0)