Documentation ¶
Index ¶
- func EncodePrivatePEM(pk *rsa.PrivateKey) ([]byte, error)
- func EncodePublicPEM(pk *rsa.PrivateKey) ([]byte, error)
- func GeneratePrivateKey() (*rsa.PrivateKey, error)
- func GenerateToken(pk *rsa.PrivateKey, rc jwt.RegisteredClaims, roles []string) (string, error)
- func MakeClaimSet(subject string, issuer string, lifespan time.Duration) jwt.RegisteredClaims
- func ReadKeyFromFile()
- func ReadKeyFromVault()
- func ValidateToken(token string, pub *rsa.PublicKey) error
- func WriteToFile(data []byte, path string) error
- func WriteToStdout(data []byte) error
- func WriteToVault()
- func WriteTokenToFile(token, path string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodePrivatePEM ¶
func EncodePrivatePEM(pk *rsa.PrivateKey) ([]byte, error)
EncodePrivatePEM encodes a Private Key PEM block into bytes.
func EncodePublicPEM ¶
func EncodePublicPEM(pk *rsa.PrivateKey) ([]byte, error)
EncodePublicKey encodes a Public Key PEM block into bytes from a private key.
func GeneratePrivateKey ¶
func GeneratePrivateKey() (*rsa.PrivateKey, error)
GeneratePrivateKey creates a random 2048-bit RSA Key.
func GenerateToken ¶
func GenerateToken(pk *rsa.PrivateKey, rc jwt.RegisteredClaims, roles []string) (string, error)
GenerateToken provides an rsa token with the given claim set and roles.
func MakeClaimSet ¶
ClaimSets a JWT registered claim set based with the given lifespan.
func ReadKeyFromFile ¶
func ReadKeyFromFile()
func ReadKeyFromVault ¶
func ReadKeyFromVault()
func ValidateToken ¶
ValidateToken verifies a token's signature via an RSA public key.
func WriteToFile ¶
KeyTofile writes a Key as bytes to the given path.
func WriteToStdout ¶
func WriteToVault ¶
func WriteToVault()
func WriteTokenToFile ¶
func WriteTokenToFile(token, path string)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.