cryptoutil

package
v0.0.0-...-90e5bb7 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenExpired   = errors.New("token expired")
	ErrMalformedToken = errors.New("malformed token")
)

Functions

func Base62Hash

func Base62Hash(text string) string

func DecryptAES

func DecryptAES(encryptedData []byte, key []byte) ([]byte, error)

Decrypts data using AES algorithm. The key should be same key that was used to encrypt the data.

func EncryptAES

func EncryptAES(data []byte, key []byte) ([]byte, error)

Encrypts data using AES algorithm. The key should be 16, 24, or 32 for 128, 192, or 256 bit encryption respectively.

func GenerateAccessAndRefreshTokens

func GenerateAccessAndRefreshTokens(userId string, accessTokenExpiry time.Duration, refreshTokenExpiry time.Duration, secret string) (string, string)

func GenerateJWT

func GenerateJWT(userId string, expiresIn time.Duration, secret string) (string, error)

func RandomString

func RandomString() string

func VerifyJWT

func VerifyJWT(token string, secret string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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