Documentation ¶
Overview ¶
Package security is func library that implement security standard.
Package security is func library that implement security standard.
Package security is func library that implement security standard.
Package security is func library that implement security standard. # This manifest was generated by ymir. DO NOT EDIT.
Index ¶
- func DateRangeValidation(fl validator.FieldLevel) bool
- func DateValidation(fl validator.FieldLevel) bool
- func DatetimeValidation(fl validator.FieldLevel) bool
- func Decrypt(cipherText string, key string) ([]byte, error)
- func Encrypt(data []byte, key string) (string, error)
- func GenID() (string, error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomEmail(n int) string
- func GenerateRandomInt(max *big.Int) int64
- func GenerateRandomString(n int) string
- func ParseDate(dtStr string) time.Time
- func ParseDatetime(dtStr string) time.Time
- func ParseDefault(fl validator.FieldLevel) bool
- func ParseTags(fl validator.FieldLevel) bool
- func S256Challenge(code string) string
- type ErrorValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DateRangeValidation ¶
func DateRangeValidation(fl validator.FieldLevel) bool
DateRangeValidation custom validator for `daterange` tag.
func DateValidation ¶
func DateValidation(fl validator.FieldLevel) bool
DateValidation custom validator for `datetime` tag.
func DatetimeValidation ¶
func DatetimeValidation(fl validator.FieldLevel) bool
DatetimeValidation custom validator for `date` tag.
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomEmail ¶
GenerateRandomEmail generates a random email.
func GenerateRandomInt ¶
GenerateRandomInt generates a random integer between min and max.
func GenerateRandomString ¶
GenerateRandomString generates a random string of length n.
func ParseDatetime ¶
ParseDatetime return time.Time convert datetime string.
func ParseDefault ¶
func ParseDefault(fl validator.FieldLevel) bool
ParseDefault custom validator for `default` tag.
func ParseTags ¶
func ParseTags(fl validator.FieldLevel) bool
ParseTags custom validator for `enum` tag.
func S256Challenge ¶
S256Challenge creates base64 encoded sha256 challenge string derived from code. The padding of the result base64 string is stripped per RFC 7636.
Types ¶
type ErrorValidator ¶
type ErrorValidator struct { Type string `json:"error_type,omitempty"` Tag string `json:"error_tag,omitempty"` Field string `json:"error_field,omitempty"` Value string `json:"error_value,omitempty"` Message string `json:"error_message,omitempty"` }
ErrorValidator data struct error.
func Validate ¶
func Validate(s any) (errors []ErrorValidator)
Validate returns ErrorValidator implements value validations for structs and individual fields based on tags.