access

package
v0.0.0-...-941446c Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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

func MakeClaimSet(subject string, issuer string, lifespan time.Duration) jwt.RegisteredClaims

ClaimSets a JWT registered claim set based with the given lifespan.

func ReadKeyFromFile

func ReadKeyFromFile()

func ReadKeyFromVault

func ReadKeyFromVault()

func ValidateToken

func ValidateToken(token string, pub *rsa.PublicKey) error

ValidateToken verifies a token's signature via an RSA public key.

func WriteToFile

func WriteToFile(data []byte, path string) error

KeyTofile writes a Key as bytes to the given path.

func WriteToStdout

func WriteToStdout(data []byte) error

func WriteToVault

func WriteToVault()

func WriteTokenToFile

func WriteTokenToFile(token, path string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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