Documentation ¶
Index ¶
- Constants
- Variables
- func ClearFilename(filename string) string
- func DecryptData(key, data []byte) ([]byte, error)
- func DeriveKey(pass, salt []byte) []byte
- func EncryptData(key, data []byte) ([]byte, error)
- func Env(name string, def string) string
- func EnvBool(env string) bool
- func EnvInt[V Integer](env string, def V) V
- func HandleError(err error, message string)
- func IfThenElse[V any](cond bool, a, b V) V
- func Init()
- func NewSalt() ([]byte, error)
- type Cache
- type Float
- type Integer
- type Number
- type Ordered
- type Signed
- type Unsigned
Constants ¶
View Source
const ( DocFolderName = "/documents" SaltLength = 32 )
Variables ¶
Functions ¶
func ClearFilename ¶
Removes spaces and converts filename to lowercase
func DecryptData ¶
Decrypts data with the given key using AES-256-GCM
func DeriveKey ¶
Derives a key from the password and salt using Argon2id, retrieves from the cache if already did before
func EncryptData ¶
Encrypts data with the given key using AES-256-GCM
func HandleError ¶
If err is not nil and message is not empty, prints the message. If message is empty, prints the error
func IfThenElse ¶
Returns the first argument if the condition is true, the second if false.
Original from https://github.com/shomali11/util/blob/f0771b70947f1d04b0e6826d333ab3ed295b05a0/xconditions/xconditions.go#L12. Modified for generics
Types ¶
Click to show internal directories.
Click to hide internal directories.