Documentation ¶
Index ¶
- Constants
- Variables
- func GetKey(key string) ([]byte, error)
- func GetRSAPrivateKey(key string) (*rsa.PrivateKey, error)
- func GetRSAPublicKey(key string) (*rsa.PublicKey, error)
- func ParseRSAPrivateKeyFromPEM(key []byte) (pkey *rsa.PrivateKey, err error)
- func ParseRSAPublicKeyFromPEM(key []byte) (pkey *rsa.PublicKey, err error)
- func RegisteredClaims(id string, ttl time.Duration) jwt.RegisteredClaims
- type Signer
- type UserClaims
- type Verifier
Constants ¶
View Source
const Audience = "Rumors"
Variables ¶
View Source
var ( ErrTokenInvalidAudience = errors.New("token has invalid audience") ErrTokenExpired = errors.New("token is expired") ErrTokenUsedBeforeIssued = errors.New("token used before issued") ErrTokenNotValidYet = errors.New("token is not valid yet") )
View Source
var ( ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key") ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key") )
View Source
var ( ErrNoPrivKeyFile = errors.New("private key file unreadable") ErrInvalidPrivKey = errors.New("RSA private key invalid") ErrNoPubKeyFile = errors.New("public key file unreadable") ErrInvalidPubKey = errors.New("RSA public key invalid") )
View Source
var ( ErrInvalidSigningAlgorithm = errors.New("invalid signing algorithm") ErrTokenInvalidClaims = errors.New("token has invalid claims") )
Functions ¶
func GetRSAPrivateKey ¶
func GetRSAPrivateKey(key string) (*rsa.PrivateKey, error)
func ParseRSAPrivateKeyFromPEM ¶
func ParseRSAPrivateKeyFromPEM(key []byte) (pkey *rsa.PrivateKey, err error)
ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key
func ParseRSAPublicKeyFromPEM ¶
ParseRSAPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key
func RegisteredClaims ¶
Types ¶
type UserClaims ¶
type UserClaims struct { jwt.RegisteredClaims Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` Roles []models.Role `json:"roles,omitempty"` Providers []models.ProviderData `json:"providers,omitempty"` Metadata any `json:"metadata,omitempty"` }
func Unmarshal ¶
func Unmarshal(claims json.RawMessage) (UserClaims, error)
func (UserClaims) Validate ¶
func (uc UserClaims) Validate() error
Click to show internal directories.
Click to hide internal directories.