jwt

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecodedToken

type DecodedToken struct {
	Raw       string
	ExpiresAt time.Time
}

DecodedToken holds a raw JWT string alongside its expiration time so the payload is only parsed once and callers can check validity cheaply.

func (*DecodedToken) IsValid

func (t *DecodedToken) IsValid() bool

IsValid reports whether the token is non-nil and has more than expiryBuffer time remaining before expiration.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser wraps golang-jwt's parser and exposes convenience methods for working with JWTs. Each platform inspector creates its own instance and passes its own claims struct to ParseUnverified.

func NewParser

func NewParser() *Parser

NewParser creates a Parser with default options. concurrent safe

func (*Parser) ParseUnverified

func (p *Parser) ParseUnverified(raw string, claims jwt.Claims) (*DecodedToken, error)

ParseUnverified decodes raw into claims without verifying the signature. It extracts and returns the expiration time from the standard exp claim. claims must implement jwt.Claims — typically a struct that embeds jwt.RegisteredClaims plus any platform-specific fields.

Signature verification is intentionally skipped: we consume third-party tokens and do not have access to the signing key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL