jws

package
v0.0.66 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTokenReceived = errors.New(`jws: invalid token received, token must have 3 parts`)
	ErrInvalidKeyOption     = errors.New(`jws: invalid key option`)
)

Functions

func Parse

func Parse(jwt string) (headerEncoded, payloadEncoded, signatureEncoded string, err error)

func Sign

func Sign(alg string, keyOpt SigningKeyOption, signingInput string) (signatureEncoded string, err error)

func Verify

func Verify(keyOption VerificationKeyOption, jwt string) (header *jose.Header, err error)

Types

type SigningKeyOption

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

func WithECDSAKey

func WithECDSAKey(key *ecdsa.PrivateKey) SigningKeyOption

func WithHMACKey

func WithHMACKey(key []byte) SigningKeyOption

func WithKey

func WithKey(key any) SigningKeyOption

func WithRSAKey

func WithRSAKey(key *rsa.PrivateKey) SigningKeyOption

type VerificationKeyOption

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

func UseECDSAKey

func UseECDSAKey(key *ecdsa.PublicKey) VerificationKeyOption

func UseHMACKey

func UseHMACKey(key []byte) VerificationKeyOption

func UseJSONWebKey

func UseJSONWebKey() VerificationKeyOption

func UseJWKSetURL

func UseJWKSetURL(ctx context.Context, jwkSetURL string) VerificationKeyOption

UseJWKSetURL is a VerificationKeyOption to verify with jwkSetURL.

func UseJWKSetURLHeaderParameter

func UseJWKSetURLHeaderParameter(ctx context.Context) VerificationKeyOption

func UseKey

func UseKey(key any) VerificationKeyOption

func UseRSAKey

func UseRSAKey(key *rsa.PublicKey) VerificationKeyOption

Jump to

Keyboard shortcuts

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