utils

package module
v0.0.0-...-1a78447 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Atoi

func Atoi(s string) int32

func BasicStringDecrypt

func BasicStringDecrypt(data string, masterKey []byte, code []byte) (string, error)

func BasicStringEncrypt

func BasicStringEncrypt(plaintext string, masterKey []byte, code []byte) (string, error)

func CheckValidApp

func CheckValidApp(app string) bool

func CheckValidBrief

func CheckValidBrief(brief string) bool

func CheckValidHex

func CheckValidHex(hex1 string) bool

func CheckValidUUID

func CheckValidUUID(uuidCode string) bool

func Decrypt

func Decrypt(masterKey []byte, userKey []byte, data []byte) ([]byte, error)

func Encrypt

func Encrypt(masterKey []byte, userKey []byte, plaintext []byte) ([]byte, error)

func GenerateMasterKey

func GenerateMasterKey() ([]byte, error)

generate master key - 24 bytes length

func GenerateRecordKey

func GenerateRecordKey() ([]byte, error)

func GetArgEnvFileVariable

func GetArgEnvFileVariable(vname string, masterKeyPtr *string) string

func GetExpirationNum

func GetExpirationNum(val interface{}) int32

func GetIndexString

func GetIndexString(val interface{}) string

func GetInt64Value

func GetInt64Value(records map[string]interface{}, key string) int64

func GetIntValue

func GetIntValue(r interface{}) int

func GetJSONPostData

func GetJSONPostData(r *http.Request) ([]byte, error)

func GetJSONPostMap

func GetJSONPostMap(r *http.Request) (map[string]interface{}, error)

func GetStringValue

func GetStringValue(r interface{}) string

func GetUuidString

func GetUuidString(u interface{}) string

func HashString

func HashString(salt []byte, src string) string

func LockMemory

func LockMemory() error

func NormalizeBrief

func NormalizeBrief(brief string) string

func NormalizeConsentValue

func NormalizeConsentValue(status string) string

func NormalizeEmail

func NormalizeEmail(email0 string) string

func NormalizeLegalBasisType

func NormalizeLegalBasisType(status string) string

func NormalizePhone

func NormalizePhone(phone string, defaultCountry string) string

func ParseExpiration

func ParseExpiration(expiration interface{}) (int32, error)

func ParseExpiration0

func ParseExpiration0(expiration string) (int32, error)

func ParseFields

func ParseFields(fields string) []string

func RandNum

func RandNum(n int) int32

func RandSeq

func RandSeq(n int) string

func ReturnUUID

func ReturnUUID(w http.ResponseWriter, code string)

func SetExpiration

func SetExpiration(maxExpiration interface{}, userExpiration interface{}) int32

func SliceContains

func SliceContains(slice []string, item string) bool

func StringPatternMatch

func StringPatternMatch(pattern string, value string) bool

StringPatternMatch looks for basic human patterns like "*", "*abc*", etc...

func ValidateMode

func ValidateMode(index string) bool

Types

type UserJSONStruct

type UserJSONStruct struct {
	JsonData  []byte
	LoginIdx  string
	EmailIdx  string
	PhoneIdx  string
	CustomIdx string
	Token     string
}

UserJSON used to parse user POST

func GetUserJSONStruct

func GetUserJSONStruct(r *http.Request, defaultCountry string) (UserJSONStruct, error)

Jump to

Keyboard shortcuts

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