crypto

package
v0.0.0-...-8b7ce6b Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: AGPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccessToken

func CreateAccessToken(config config.Config, keyPairs []PublicPrivateRSAKeyPair, identifier string) (string, error)

func CreateRefreshToken

func CreateRefreshToken(config config.Config, keyPairs []PublicPrivateRSAKeyPair, identifier string) (string, error)

func GetAllPublicKeys

func GetAllPublicKeys(keyPairs []PublicPrivateRSAKeyPair) []rsa.PublicKey

Types

type AllParseAttemptsFailed

type AllParseAttemptsFailed struct{}

func (*AllParseAttemptsFailed) Error

func (e *AllParseAttemptsFailed) Error() string

type ByValidFrom

type ByValidFrom []PublicPrivateRSAKeyPair

func (ByValidFrom) Len

func (v ByValidFrom) Len() int

func (ByValidFrom) Less

func (v ByValidFrom) Less(i, j int) bool

func (ByValidFrom) Swap

func (v ByValidFrom) Swap(i, j int)

type DefaultClaims

type DefaultClaims struct {
	*jwt.StandardClaims
	TokenType string
	UserInfo
}

func ValidateAccessToken

func ValidateAccessToken(keyPairs []PublicPrivateRSAKeyPair, token string) (*DefaultClaims, error)

func ValidateRefreshToken

func ValidateRefreshToken(keyPairs []PublicPrivateRSAKeyPair, token string) (*DefaultClaims, error)

type InvalidTokenFound

type InvalidTokenFound struct{}

func (*InvalidTokenFound) Error

func (e *InvalidTokenFound) Error() string

type PublicPrivateRSAKeyPair

type PublicPrivateRSAKeyPair struct {
	ValidFrom    int64
	PrivateKey   *rsa.PrivateKey
	PublicKeyPEM string
	PublicKey    *rsa.PublicKey
}

func GetKeyForTime

func GetKeyForTime(keyPairs []PublicPrivateRSAKeyPair, time time.Time) *PublicPrivateRSAKeyPair

func KeyPairForTesting

func KeyPairForTesting() []PublicPrivateRSAKeyPair

func ReadRSAKeysFromPath

func ReadRSAKeysFromPath(path string) ([]PublicPrivateRSAKeyPair, error)

type TokenExpired

type TokenExpired struct{}

func (*TokenExpired) Error

func (e *TokenExpired) Error() string

type UserInfo

type UserInfo struct {
	Identifier string
}

Jump to

Keyboard shortcuts

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