utils

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 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 CreateJWKWithKID

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

func CreateJWKs

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

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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