Documentation
¶
Index ¶
- Constants
- func BasicAuthDecode(encoded string) (string, string, error)
- func CreateTimeLimitCode[T time.Time | string](data string, minutes int, startTimeGeneric T, h hash.Hash) string
- func EncodeSha256(str string) string
- func FileSize(s int64) string
- func Int64sToStrings(ints []int64) []string
- func NaturalSortLess(s1, s2 string) bool
- func ShortSha(sha1 string) string
- func StringsToInt64s(strs []string) ([]int64, error)
- func VerifyTimeLimitCode(now time.Time, data string, minutes int, code string) bool
Constants ¶
const TimeLimitCodeLength = 12 + 6 + 40
TimeLimitCodeLength default value for time limit code
Variables ¶
This section is empty.
Functions ¶
func BasicAuthDecode ¶
BasicAuthDecode decode basic auth string
func CreateTimeLimitCode ¶
func CreateTimeLimitCode[T time.Time | string](data string, minutes int, startTimeGeneric T, h hash.Hash) string
CreateTimeLimitCode create a time-limited code. Format: 12 length date time string + 6 minutes string (not used) + 40 hash string, some other code depends on this fixed length If h is nil, then use the default hmac hash.
func EncodeSha256 ¶ added in v1.9.0
EncodeSha256 string to sha256 hex value.
func Int64sToStrings ¶
Int64sToStrings converts a slice of int64 to a slice of string.
func NaturalSortLess ¶ added in v1.3.0
NaturalSortLess compares two strings so that they could be sorted in natural order
func ShortSha ¶
ShortSha is basically just truncating. It is DEPRECATED and will be removed in the future.
func StringsToInt64s ¶
StringsToInt64s converts a slice of string to a slice of int64.
Types ¶
This section is empty.