Skip to content

Commit

Permalink
Refactor JWT token type to use standard claims and improve documentation
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
heartwilltell committed Feb 6, 2025
1 parent c14190e commit b90b9ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions authkit/jwtkit/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ type TokenManager interface {
ParseVerify(token string) (*Token, error)
}

// Token is a struct that holds the token and its claims.
// Claims represents claims for JWT.
// See: https://tools.ietf.org/html/rfc7519#section-4.1
type Claims = jwt.RegisteredClaims

// Token represents claims for JWT with additional metadata.
type Token struct {
jwt.RegisteredClaims
Claims
Meta map[string]any `json:"meta,omitempty"`

raw *jwt.Token
Expand Down

0 comments on commit b90b9ab

Please sign in to comment.