jwtinspect

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllSignatureAlgorithms = maps.Keys(SignatureAlgorithmDescriptions)
View Source
var FormatMap = map[string]inspect.Formatter[*jwt.JSONWebToken, JwtInspectOutputOptions]{
	"json":    {Label: "JSON", Lexer: "json", Converter: ConvertTokenToJson},
	"yaml":    {Label: "YAML", Lexer: "yaml", Converter: ConvertTokenToYaml},
	"summary": {Label: "Summary", Lexer: "text", Converter: ConvertTokenToSummary},
}
View Source
var SignatureAlgorithmDescriptions = map[jose.SignatureAlgorithm]string{
	jose.ES256: "ECDSA using P-256 curve and SHA-256",
	jose.ES384: "ECDSA using P-384 curve and SHA-384",
	jose.ES512: "ECDSA using P-521 curve and SHA-512",
	jose.RS256: "RSASSA-PKCS1-v1_5 using SHA-256",
	jose.RS384: "RSASSA-PKCS1-v1_5 using SHA-384",
	jose.RS512: "RSASSA-PKCS1-v1_5 using SHA-512",
	jose.PS256: "RSASSA-PSS using SHA-256 and MGF1-SHA-256",
	jose.PS384: "RSASSA-PSS using SHA-384 and MGF1-SHA-384",
	jose.PS512: "RSASSA-PSS using SHA-512 and MGF1-SHA-512",
	jose.EdDSA: "EdDSA using Ed25519",
	jose.HS256: "HMAC using SHA-256",
	jose.HS384: "HMAC using SHA-384",
	jose.HS512: "HMAC using SHA-512",
}

This includes that are not supported by JWT-SVID

Supported as per JWT-SVID spec

Functions

func ConvertTokenToJson

func ConvertTokenToJson(tok *jwt.JSONWebToken, options JwtInspectOutputOptions) (string, error)

func ConvertTokenToSummary

func ConvertTokenToSummary(tok *jwt.JSONWebToken, options JwtInspectOutputOptions) (string, error)

func ConvertTokenToYaml

func ConvertTokenToYaml(tok *jwt.JSONWebToken, options JwtInspectOutputOptions) (string, error)

func DeserializeJwt

func DeserializeJwt(serialized string) (*jwt.JSONWebToken, error)

TODO: At some point we'll want to add support for encrypted JWTs, as well as "none" JWTs. We'd want to detect either of these. For encrypted JWTs the user would have to pass a key.

Types

type JwtInspectOutputOptions

type JwtInspectOutputOptions struct {
	Header   bool
	Indent   bool
	Color    bool
	TimeZone string
}

func (JwtInspectOutputOptions) InColor

func (o JwtInspectOutputOptions) InColor() bool

type JwtInspector

type JwtInspector struct {
	Filename      string
	IsSvid        bool
	OutputFormat  string
	OutputOptions JwtInspectOutputOptions
}

func (*JwtInspector) Inspect

func (i *JwtInspector) Inspect() (string, error)

Jump to

Keyboard shortcuts

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