Documentation
¶
Index ¶
- Constants
- Variables
- func WriteJwkSetJson(w io.Writer, issuers []*Issuer) error
- type BaseTypeClaims
- type Claims
- type EmptyClaims
- type Issuer
- type KeyStore
- func (k *KeyStore) ClearKeys()
- func (k *KeyStore) GetPrivateKey(kid string) (*rsa.PrivateKey, error)
- func (k *KeyStore) GetPublicKey(kid string) (*rsa.PublicKey, error)
- func (k *KeyStore) HasPrivateKey(kid string) bool
- func (k *KeyStore) HasPublicKey(kid string) bool
- func (k *KeyStore) ListKeys() []string
- func (k *KeyStore) LoadPrivateKey(kid string, key *rsa.PrivateKey)
- func (k *KeyStore) LoadPublicKey(kid string, key *rsa.PublicKey)
- func (k *KeyStore) RemoveKey(kid string)
- func (k *KeyStore) SaveKeys() error
- func (k *KeyStore) SaveSingleKey(kid string) error
- func (k *KeyStore) VerifyJwt(token string, claims baseTypeClaim) (*jwt.Token, error)
Constants ¶
View Source
const PemExt = ".pem"
View Source
const PrivatePemExt = PrivateStr + PemExt
View Source
const PrivateStr = ".private"
View Source
const PublicPemExt = PublicStr + PemExt
View Source
const PublicStr = ".public"
Variables ¶
View Source
var ErrClaimTypeMismatch = errors.New("claim type mismatch")
View Source
var ErrMissingKeyPair = errors.New("missing key pair")
View Source
var ErrMissingPrivateKey = errors.New("missing private key")
View Source
var ErrMissingPublicKey = errors.New("missing public key")
Functions ¶
Types ¶
type BaseTypeClaims ¶
type BaseTypeClaims[T Claims] struct { jwt.RegisteredClaims ClaimType string Claims T }
BaseTypeClaims is a wrapper for combining the jwt.RegisteredClaims with a ClaimType and generic Claims data
func ExtractClaims ¶
ExtractClaims uses a Verifier to validate the MJWT token and returns the parsed token and BaseTypeClaims
func (*BaseTypeClaims[T]) InternalClaimType ¶
func (b *BaseTypeClaims[T]) InternalClaimType() string
InternalClaimType returns the Type of the generic claim struct
func (*BaseTypeClaims[T]) MarshalJSON ¶
func (b *BaseTypeClaims[T]) MarshalJSON() ([]byte, error)
MarshalJSON converts the internalBaseTypeClaims and generic claim struct into a serialized JSON byte array
func (*BaseTypeClaims[T]) UnmarshalJSON ¶
func (b *BaseTypeClaims[T]) UnmarshalJSON(bytes []byte) error
UnmarshalJSON reads the internalBaseTypeClaims and generic claim struct from a serialized JSON byte array
func (*BaseTypeClaims[T]) Valid ¶
func (b *BaseTypeClaims[T]) Valid() error
Valid checks the InternalClaimType matches and the type claim type
type Claims ¶
Claims is a wrapper for jwt.Claims and adds a Type method to name internal claim structs
type EmptyClaims ¶ added in v0.4.0
type EmptyClaims struct{}
EmptyClaims contains no claims
func (EmptyClaims) Type ¶ added in v0.4.0
func (e EmptyClaims) Type() string
func (EmptyClaims) Valid ¶ added in v0.4.0
func (e EmptyClaims) Valid() error
type Issuer ¶ added in v0.4.0
type Issuer struct {
// contains filtered or unexported fields
}
func NewIssuer ¶ added in v0.4.0
func NewIssuer(name, kid string, signing jwt.SigningMethod) (*Issuer, error)
func NewIssuerWithKeyStore ¶ added in v0.4.0
func (*Issuer) GenerateJwt ¶ added in v0.4.0
func (*Issuer) PrivateKey ¶ added in v0.4.0
func (i *Issuer) PrivateKey() (*rsa.PrivateKey, error)
type KeyStore ¶ added in v0.3.0
type KeyStore struct {
// contains filtered or unexported fields
}
func NewKeyStore ¶ added in v0.4.0
func NewKeyStore() *KeyStore
func NewKeyStoreWithDir ¶ added in v0.4.0
func (*KeyStore) GetPrivateKey ¶ added in v0.4.0
func (k *KeyStore) GetPrivateKey(kid string) (*rsa.PrivateKey, error)
func (*KeyStore) GetPublicKey ¶ added in v0.4.0
func (*KeyStore) HasPrivateKey ¶ added in v0.4.0
func (*KeyStore) HasPublicKey ¶ added in v0.4.0
func (*KeyStore) LoadPrivateKey ¶ added in v0.4.0
func (k *KeyStore) LoadPrivateKey(kid string, key *rsa.PrivateKey)
func (*KeyStore) LoadPublicKey ¶ added in v0.4.0
func (*KeyStore) SaveSingleKey ¶ added in v0.4.0
Click to show internal directories.
Click to hide internal directories.