Documentation ¶
Index ¶
- func ConfigValidation() error
- func DatetimeChecker(a, b time.Time) bool
- func DecryptString(secretKey, encryptedText string) (string, error)
- func EncryptString(secretKey, text string) (string, error)
- func ExpiresDatetimeSwitcher(now time.Time, duration string) (time.Time, error)
- func GenerateQRCode(text string, size int) (barcode.Barcode, error)
- func Getenv(key, fallback string) string
- func HashString(size int, s ...string) string
- func IsExistInFolder(name string, isFolder bool) bool
- func IsSecretKeyValid(key string, length int) error
- func IsValidURL(uri string) error
- func StaticFileServerHandler(efs embed.FS) http.Handler
- func ValidateAddSecretForm(name, value string) (errorFields []*messages.ErrorField)
- func ValidateUserSignInForm(username, masterPassword string) (errorFields []*messages.ErrorField)
- func ValidateViewSecretForm(accessCode string) (errorFields []*messages.ErrorField)
- func WrapHTTPError(w http.ResponseWriter, r *http.Request, status int, ...)
- type ErrorField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigValidation ¶
func ConfigValidation() error
ConfigValidation validates the configuration settings.
This function checks the validity of various configuration settings such as the secret key, master username, master password, domain URL, domain HTTP schema, and server timezone. It returns an error if any of the configuration settings are invalid.
Returns: - error: An error indicating the invalid configuration setting, or nil if all settings are valid.
func DatetimeChecker ¶
DatetimeChecker compares two datetimes and returns true if they are equal or a is after b.
func DecryptString ¶
DecryptString decrypts a string that was encrypted using AES encryption with a given secret key.
func EncryptString ¶
EncryptString encrypts a string using AES encryption with a given secret key. It generates a random initialization vector (IV), encrypts the text using AES in CBC mode, appends the IV to the ciphertext, and returns the ciphertext as a hexadecimal string.
func ExpiresDatetimeSwitcher ¶
ExpiresDatetimeSwitcher returns a new datetime with a duration.
func GenerateQRCode ¶
GenerateQRCode generates a QR code image from a given text and size.
func HashString ¶
ShortenString shortens a string to a specified length using SHA256 hash.
func IsExistInFolder ¶
isExistInFolder searches for a file or folder by the given name in the current folder.
func IsSecretKeyValid ¶
IsSecretKeyValid returns nil if the given secret key is valid.
func IsValidURL ¶
IsValidURL returns nil if the given URL is valid.
func StaticFileServerHandler ¶
StaticFileServerHandler handles a custom handler for serving static files from the embed static folder.
func ValidateAddSecretForm ¶
func ValidateAddSecretForm(name, value string) (errorFields []*messages.ErrorField)
ValidateAddSecretForm returns nil if the given add secret form values are valid.
func ValidateUserSignInForm ¶
func ValidateUserSignInForm(username, masterPassword string) (errorFields []*messages.ErrorField)
ValidateUserSignInForm returns nil if the given user sign in form values are valid.
func ValidateViewSecretForm ¶
func ValidateViewSecretForm(accessCode string) (errorFields []*messages.ErrorField)
ValidateViewSecretForm returns nil if the given view secret form access code is valid.
func WrapHTTPError ¶
func WrapHTTPError(w http.ResponseWriter, r *http.Request, status int, errTemplate templ.Component, errMsg string)
WrapHTTPError wraps HTTP errors.
Types ¶
type ErrorField ¶
type ErrorField struct {
Name, Message string
}
ErrorField represents an error field.