utils

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RSAKeySize = 2048
)

Variables

View Source
var NewString = uuid.NewString

NewString is type alias to `github.com/google/uuid`.NewString

Functions

func AppendIfUnique

func AppendIfUnique[T comparable](slice1 []T, slice2 []T) []T

func BuildToken

func BuildToken(rsaKey jwk.Key, issuer, sub string,
	validity time.Duration, customClaims map[string]string) ([]byte, error)

BuildToken creates a signed jwt using provided private key Ensure the key contains kid else the operation fails

func Contains

func Contains[T comparable](s []T, e T) bool

func ContainsFunc added in v0.7.5

func ContainsFunc[T any](s []T, f func(T) bool) bool

func CreateJWKWithKID

func CreateJWKWithKID(id string) (jwk.Key, error)

func CreateJWKs

func CreateJWKs(numOfKeys int) (jwk.Set, error)

func Filter added in v0.7.5

func Filter[T any](s []T, f func(T) bool) []T

func GetPublicKeySet

func GetPublicKeySet(ctx context.Context, privateKeySet jwk.Set) (jwk.Set, error)

GetPublicKeySet convert private to public

func IsNullUUID

func IsNullUUID(key string) bool

IsNullUUID returns true if passed string is a null uuid or is not a valid uuid defined by `github.com/google/uuid`.Parse and `github.com/google/uuid`.Nil respectively else return false

func IsValidEmail

func IsValidEmail(str string) bool

func IsValidUUID

func IsValidUUID(key string) bool

IsValidUUID returns true if passed string in uuid format defined by `github.com/google/uuid`.Parse else return false

func Map added in v0.7.5

func Map[T1, T2 any](s []T1, f func(T1) T2) []T2

Types

This section is empty.

Jump to

Keyboard shortcuts

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