Documentation
¶
Index ¶
- Constants
- Variables
- func B64UUID(uuid string) (string, error)
- func B64toS64(str string) string
- func Base64DecodeString(s string) ([]byte, error)
- func CheckAuthFactor(af *common_models.AuthFactor) error
- func CheckSliceUnique[T comparable](slice []T) error
- func CheckUUID(uuid string) error
- func CheckUUIDSlice(uuids []string) error
- func CheckValidAuthChallenge(challenge string) error
- func CheckValidJWT(jwt string) error
- func ChunkSlice[T any](slice []T, chunkSize int) [][]T
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomNonce() (string, error)
- func GenerateUserLicenseToken(nonce string, userId string, appId string, validationKey string, ...) (string, error)
- func IsB64UUID(uuid string) bool
- func IsEmail(email string) bool
- func IsUUID(uuid string) bool
- func Max[T constraints.Ordered](a, b T) T
- func Min[T constraints.Ordered](a, b T) T
- func NormalizeString(s string) []byte
- func S64toB64(str string) string
- func SliceIncludes[T comparable](s []T, u T) bool
- func SliceMap[T interface{}, U interface{}](s []T, f func(T) U) []U
- func SliceSameMembers[T comparable](s1 []T, s2 []T) bool
- func Ternary[T any](condition bool, valTrue T, valFalse T) T
- func UnB64UUID(id string) (string, error)
- func UniqueSlice[T comparable](slice []T) []T
- type APIError
- type MutexGroup
- type PreValidationToken
- type SealdError
- type SerializableError
- type Set
Constants ¶
View Source
const Version = "dev"
Variables ¶
View Source
var ( // ErrorInvalidJWT is returned when the given JWT is invalid ErrorInvalidJWT = NewSealdError("INVALID_JWT", "invalid JWT") // ErrorInvalidAuthChallenge is returned when the given authentication challenge is invalid ErrorInvalidAuthChallenge = NewSealdError("INVALID_AUTH_CHALLENGE", "invalid auth challenge") // ErrorInvalidUUID is returned when a UUID is invalid ErrorInvalidUUID = NewSealdError("INVALID_UUID", "invalid UUID") // ErrorInvalidUUIDSlice is returned when the given slice of UUID include an invalid UUID ErrorInvalidUUIDSlice = NewSealdError("INVALID_UUID_SLICE", "invalid UUID in slice") // ErrorNotUnique is returned when items in a slice are not unique. ErrorNotUnique = NewSealdError("NOT_UNIQUE", "not unique") // ErrorInvalidAuthFactorType is returned when an authentication factor has an invalid type ErrorInvalidAuthFactorType = NewSealdError("INVALID_AUTH_FACTOR_TYPE", "authentication factor type must be 'EM' or 'SMS'") ErrorInvalidAuthFactorValueEM = NewSealdError("INVALID_AUTH_FACTOR_VALUE_EM", "Invalid authentication factor value. It must be a valid email address.") ErrorInvalidAuthFactorValueSMS = NewSealdError("INVALID_AUTH_FACTOR_VALUE_SMS", "Invalid authentication factor value. Cannot parse phone number.") )
View Source
var (
UUIDRegexp = regexp.MustCompile(`^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`)
)
Functions ¶
func Base64DecodeString ¶
Base64DecodeString decodes a Base64-encoded string, handling both padded and non-padded input, as well as new-lines.
func CheckAuthFactor ¶
func CheckAuthFactor(af *common_models.AuthFactor) error
func CheckSliceUnique ¶
func CheckSliceUnique[T comparable](slice []T) error
func CheckUUIDSlice ¶
func CheckValidAuthChallenge ¶
func CheckValidJWT ¶
func ChunkSlice ¶
func GenerateRandomBytes ¶
func GenerateRandomNonce ¶
func Max ¶
func Max[T constraints.Ordered](a, b T) T
func Min ¶
func Min[T constraints.Ordered](a, b T) T
func NormalizeString ¶
func SliceIncludes ¶
func SliceIncludes[T comparable](s []T, u T) bool
func SliceSameMembers ¶
func SliceSameMembers[T comparable](s1 []T, s2 []T) bool
func UniqueSlice ¶
func UniqueSlice[T comparable](slice []T) []T
Types ¶
type APIError ¶
type MutexGroup ¶
type MutexGroup struct {
// contains filtered or unexported fields
}
func (*MutexGroup) Lock ¶
func (group *MutexGroup) Lock(key string)
func (*MutexGroup) LockAll ¶
func (group *MutexGroup) LockAll()
func (*MutexGroup) LockMultiple ¶
func (group *MutexGroup) LockMultiple(keys []string)
func (*MutexGroup) Unlock ¶
func (group *MutexGroup) Unlock(key string)
func (*MutexGroup) UnlockAll ¶
func (group *MutexGroup) UnlockAll()
func (*MutexGroup) UnlockMultiple ¶
func (group *MutexGroup) UnlockMultiple(keys []string)
type PreValidationToken ¶
type PreValidationToken struct { DomainValidationKeyId string `json:"domain_validation_key_id"` Nonce string `json:"nonce"` Token string `json:"token"` }
func GeneratePreValidationToken ¶
func GeneratePreValidationToken(connectorValue string, domainValidationKey string, domainValidationKeyId string) (*PreValidationToken, error)
type SealdError ¶
func NewSealdError ¶
func NewSealdError(code string, description string) SealdError
func (SealdError) AddDetails ¶
func (err SealdError) AddDetails(details string) SealdError
func (SealdError) Error ¶
func (err SealdError) Error() string
func (SealdError) Is ¶
func (err SealdError) Is(target error) bool
type SerializableError ¶
type SerializableError struct { Status int `json:"status"` Code string `json:"code"` Id string `json:"id"` Description string `json:"description"` Details string `json:"details"` Raw string `json:"raw"` Stack string `json:"stack"` }
func ToSerializableError ¶
func ToSerializableError(err error) *SerializableError
func (SerializableError) Error ¶
func (e SerializableError) Error() string
type Set ¶
type Set[T comparable] map[T]struct{}
Set implements three methods: Add, Remove & Has. It needs to be defined with a comparable generic type such as int or string. The len operator can be used on Set. Internally a Set represents the presence of an element with a map of struct{}{} for efficiency, as explained here: https://itnext.io/set-in-go-map-bool-and-map-struct-performance-comparison-5315b4b107b.
Click to show internal directories.
Click to hide internal directories.