Documentation
¶
Index ¶
- 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 ¶
This section is empty.
Variables ¶
View Source
var ErrMissingKeyID = xerrors.New("missing key ID")
Functions ¶
func Decrypt ¶
func Decrypt(ctx context.Context, d DecryptKeyProvider, token string, claims Claims, opts ...func(*DecryptOptions)) error
Decrypt decrypts the token using the provided key. It unmarshals into the provided claims.
func Verify ¶
func Verify(ctx context.Context, v VerifyKeyProvider, token string, claims Claims, opts ...func(*VerifyOptions)) error
Verify verifies that a token was signed by the provided key. It unmarshals into the provided claims.
func WithDecryptExpected ¶
func WithDecryptExpected(expected jwt.Expected) func(*DecryptOptions)
func WithVerifyExpected ¶
func WithVerifyExpected(expected jwt.Expected) func(*VerifyOptions)
Types ¶
type DecryptKeyProvider ¶
type DecryptOptions ¶
type DecryptOptions struct { RegisteredClaims jwt.Expected KeyAlgorithm jose.KeyAlgorithm ContentEncryptionAlgorithm jose.ContentEncryption }
DecryptOptions are options for decrypting a JWE.
type EncryptKeyProvider ¶
type RegisteredClaims ¶
RegisteredClaims is a convenience type for embedding jwt.Claims. It should be preferred over embedding jwt.Claims directly since it will ensure that certain fields are set.
type SigningKeyManager ¶
type SigningKeyManager interface { SigningKeyProvider VerifyKeyProvider }
type SigningKeyProvider ¶
type StaticKey ¶
type StaticKey struct { ID string Key interface{} }
StaticKey fulfills the SigningKeycache and EncryptionKeycache interfaces. Useful for testing.
func (StaticKey) DecryptingKey ¶
func (StaticKey) EncryptingKey ¶
func (StaticKey) SigningKey ¶
type VerifyKeyProvider ¶
type VerifyOptions ¶
type VerifyOptions struct { RegisteredClaims jwt.Expected SignatureAlgorithm jose.SignatureAlgorithm }
VerifyOptions are options for verifying a JWT.
Click to show internal directories.
Click to hide internal directories.