Documentation
¶
Index ¶
- func Base64URLDecode(input string) (string, error)
- func Base64URLEncode(input string) string
- func Decrypt(base64Ciphertext, base64Key string) (string, error)
- func DeriveKeyFromPassword(password string, salt string) string
- func Encrypt(plaintext, base64Key string) (string, error)
- func GenerateKey() (string, error)
- func GetJWTTokenExpirationUnix(token string) (*float64, error)
- type PasswordData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64URLDecode ¶
Base64URLDecode decodes the given URL-safe string using base64 and returns the result as a string
func Base64URLEncode ¶
Base64URLEncode encodes the given string using base64 and returns the result as a URL-safe string
func Decrypt ¶
Decrypt decrypts the given base64 encoded ciphertext using AES-GCM with the provided base64 encoded key and returns the plaintext
func DeriveKeyFromPassword ¶
DeriveKeyFromPassword generates an encryption key from a password using Argon2 and a provided salt
func Encrypt ¶
Encrypt encrypts the given plaintext using AES-GCM with the provided base64 encoded key and returns the ciphertext as a base64 encoded string
func GenerateKey ¶
GenerateKey generates a new AES key and returns it as a base64 encoded string
func GetJWTTokenExpirationUnix ¶
it took me an embarrising long time to learn that the jwt tokens encode the expiration time inside of them
Types ¶
type PasswordData ¶
func GeneratePasswordHash ¶
func GeneratePasswordHash(password string) (*PasswordData, error)
GeneratePasswordHash generates a secure hash of the password using bcrypt, returns hash and salt