Documentation
¶
Index ¶
- Constants
- func AesDecrypt(key, ciphertext []byte) ([]byte, error)
- func AesEncrypt(key, data []byte) ([]byte, error)
- func AssertEquals(firstValue, secondValue any)
- func AssertNotNil(value any)
- func AssertTrue(condition bool, message string)
- func CheckPasswordHash(password, hash string) bool
- func DeriveECDHSharedSecret(privKeyBytes []byte, peerPublicKeyBytes []byte) ([]byte, error)
- func GenerateAES256Key() ([]byte, error)
- func GenerateECDHKeyPair() ([]byte, []byte, error)
- func GetEnvBool(key string, fallback bool) bool
- func GetEnvInt(key string, fallback int) int
- func GetEnvString(key string, fallback string) string
- func HashPassword(password string) (string, error)
- func LoadAssembly(filePath string) ([]byte, error)
- func MapToStruct(input interface{}, output interface{}) error
- func NormalizeToSlice(input any) []string
- func RandomString(length int) string
- func Unzip(src string, dest string) error
- func WithResultTimeout[T any](ctx context.Context, db *sql.DB, query string, timeout int, ...) (T, error)
- func WithTimeout(ctx context.Context, db *sql.DB, query string, timeout int, ...) error
- func WithTransactionResultTimeout[T any](ctx context.Context, db *sql.DB, timeout int, txOpts sql.TxOptions, ...) (T, error)
- func WithTransactionTimeout(ctx context.Context, db *sql.DB, timeout int, txOpts sql.TxOptions, ...) error
- func Zip(src string, dest string) error
- type ModuleConfig
- type Validate
- type XORUtil
Constants ¶
View Source
const (
AES256KeySize = 32
)
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶
AesDecrypt decrypts data using AES-GCM with the provided key.
func AesEncrypt ¶
AesEncrypt encrypts data using AES-GCM with the provided key.
func AssertEquals ¶
func AssertEquals(firstValue, secondValue any)
func AssertNotNil ¶
func AssertNotNil(value any)
func AssertTrue ¶
func CheckPasswordHash ¶
CheckPasswords - compare hash password with user password
func DeriveECDHSharedSecret ¶
func GenerateAES256Key ¶
GenerateAES256Key returns a 32-byte AES key.
func GenerateECDHKeyPair ¶
Using a P256 curve to generate the public and private keys
func GetEnvBool ¶
func GetEnvString ¶
func HashPassword ¶
HashPassword - hashes the password of the users
func LoadAssembly ¶
func MapToStruct ¶
func MapToStruct(input interface{}, output interface{}) error
MapToStruct converts a map to a struct
func NormalizeToSlice ¶
func RandomString ¶
func WithResultTimeout ¶
func WithResultTimeout[T any]( ctx context.Context, db *sql.DB, query string, timeout int, fn func(context.Context, *sql.Stmt) (T, error), ) (T, error)
For simple db operations that make only one query
func WithTimeout ¶
func WithTimeout( ctx context.Context, db *sql.DB, query string, timeout int, fn func(context.Context, *sql.Stmt) error, ) error
For simple db operations that make only one query
func WithTransactionTimeout ¶
Types ¶
type ModuleConfig ¶
type ModuleConfig struct {
Module interface{} `json:"module"`
}
func LoadModuleConfig ¶
func LoadModuleConfig(path string) (*ModuleConfig, error)
type Validate ¶
type Validate struct {
// contains filtered or unexported fields
}
Validate struct holds a validator instance
func NewValidatorService ¶
func NewValidatorService() *Validate
NewValidatorService creates and returns a new Validate instance
func (*Validate) ValidateStruct ¶
ValidateStruct validates a struct and returns an error if validation fails
type XORUtil ¶
type XORUtil struct {
// contains filtered or unexported fields
}
func NewXorUtil ¶
func (*XORUtil) GenerateRandomKey ¶
Click to show internal directories.
Click to hide internal directories.