jwtutils
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Constants
- Variables
- func Decrypt(ctx context.Context, d DecryptKeyProvider, token string, claims Claims, ...) error
- func Encrypt(ctx context.Context, e EncryptKeyProvider, claims Claims) (string, error)
- func Sign(ctx context.Context, s SigningKeyProvider, claims Claims) (string, error)
- func Verify(ctx context.Context, v VerifyKeyProvider, token string, claims Claims, ...) error
- func WithDecryptExpected(expected jwt.Expected) func(*DecryptOptions)
- func WithVerifyExpected(expected jwt.Expected) func(*VerifyOptions)
- type Claims
- type DecryptKeyProvider
- type DecryptOptions
- type EncryptKeyProvider
- type RegisteredClaims
- type SigningKeyManager
- type SigningKeyProvider
- type StaticKey
- func (StaticKey) Close() error
- func (s StaticKey) DecryptingKey(_ context.Context, id string) (interface{}, error)
- func (s StaticKey) EncryptingKey(_ context.Context) (string, interface{}, error)
- func (s StaticKey) SigningKey(_ context.Context) (string, interface{}, error)
- func (s StaticKey) VerifyingKey(_ context.Context, id string) (interface{}, error)
- type VerifyKeyProvider
- type VerifyOptions
Constants¶
const (SigningAlgo = jose.HS512)Variables¶
var ErrMissingKeyID =xerrors.New("missing key ID")Functions¶
funcDecrypt¶
func Decrypt(ctxcontext.Context, dDecryptKeyProvider, tokenstring, claimsClaims, opts ...func(*DecryptOptions))error
Decrypt decrypts the token using the provided key. It unmarshals into the provided claims.
funcVerify¶
func Verify(ctxcontext.Context, vVerifyKeyProvider, tokenstring, claimsClaims, opts ...func(*VerifyOptions))error
Verify verifies that a token was signed by the provided key. It unmarshals into the provided claims.
funcWithDecryptExpected¶
func WithDecryptExpected(expectedjwt.Expected) func(*DecryptOptions)
funcWithVerifyExpected¶
func WithVerifyExpected(expectedjwt.Expected) func(*VerifyOptions)
Types¶
typeDecryptOptions¶
type DecryptOptions struct {RegisteredClaimsjwt.ExpectedKeyAlgorithm jose.KeyAlgorithmContentEncryptionAlgorithm jose.ContentEncryption}DecryptOptions are options for decrypting a JWE.
typeRegisteredClaims¶
RegisteredClaims is a convenience type for embedding jwt.Claims. It should bepreferred over embedding jwt.Claims directly since it will ensure that certain fields are set.
typeSigningKeyManager¶
type SigningKeyManager interface {SigningKeyProviderVerifyKeyProvider}typeStaticKey¶
type StaticKey struct {IDstringKey interface{}}StaticKey fulfills the SigningKeycache and EncryptionKeycache interfaces. Useful for testing.
func (StaticKey)DecryptingKey¶
func (StaticKey)EncryptingKey¶
func (StaticKey)SigningKey¶
typeVerifyOptions¶
VerifyOptions are options for verifying a JWT.