jwk

package
v0.36.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package jwk implements some common utilities for interacting with JWKs (mostly used with OIDC providers).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateTokenSignature

func ValidateTokenSignature(ctx context.Context, token string, jwksURL string) error

ValidateTokenSignature validates the signature of a token with the public key retrievied from a remote JWKS.

Types

type JWK

type JWK struct {
	Kty string `json:"kty"`
	Kid string `json:"kid"`
	Use string `json:"use"`
	Alg string `json:"alg"`
	// RS256 (RSA)
	E string `json:"e"`
	N string `json:"n"`
	// Ed25519 (OKP)
	Crv string `json:"crv"`
	X   string `json:"x"`
}

func Fetch

func Fetch(ctx context.Context, jwksURL string, kid string) (*JWK, error)

Fetch retrieves the JSON Web Key Set located at jwksURL and returns the first key that matches the specified kid.

func (*JWK) PublicKey

func (key *JWK) PublicKey() (any, error)

PublicKey reconstructs and returns the public key from the current JWK.

Jump to

Keyboard shortcuts

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