signing

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignedString

func SignedString(header map[string]any, claims any, method Method, key any) (string, error)

Types

type Method

type Method interface {
	// Alg returns the algorithm name (e.g., "HS256")
	Alg() string

	// Sign creates a signature for the given signing string
	Sign(signingString string, key any) (string, error)

	// Verify verifies a signature against the signing string
	Verify(signingString string, signature string, key any) error

	// Hash returns the crypto.Hash used by this method
	Hash() crypto.Hash
}

Method represents a signing method for JWT tokens. Implementations must be thread-safe for concurrent use.

func GetHMACMethod

func GetHMACMethod(alg string) Method

GetHMACMethod returns the HMAC signing method for the given algorithm

func GetInternalSigningMethod

func GetInternalSigningMethod(alg string) (Method, error)

Jump to

Keyboard shortcuts

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