util

package
v0.0.0-...-8d3f935 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateInstanceId

func GenerateInstanceId(length int) string

GenerateInstanceId Generates a unique alphanumeric instance id with a given length. This is used to ensure deployments, and PVC's in the same namespace do not have conflicts. It is also used to generate a unique id for a playfab for the dedicated src so that multiple servers can run on a single port.

func GetAttribute

func GetAttribute(attributes []types.AttributeType, attributeName string) string

GetAttribute Returns the string value for a given attribute name from Cognito.

func GetHostname

func GetHostname() string

func GetUserAttributeString

func GetUserAttributeString(attributes []types.AttributeType, attributeName string) string

func Int32Ptr

func Int32Ptr(i int32) *int32

Int32Ptr Converts an unsigned 32-bit integer into a pointer.

func MakeAttribute

func MakeAttribute(key, value string) types.AttributeType

MakeAttribute Creates a Cognito attribute that can be persisted.

func MakeVolumeMounts

func MakeVolumeMounts() []corev1.VolumeMount

MakeVolumeMounts Creates the PVC volume mount locations for the deployment pod. These volume mounts are the only places files can be installed that will persist outside the life of the src.

func MakeVolumes

func MakeVolumes(pvcName string) []corev1.Volume

MakeVolumes creates the volumes that will be mounted for both the src deployment and any file installation jobs.

func MapSubscriptionStatus

func MapSubscriptionStatus(status string) stripe.SubscriptionStatus

Types

type Crypto

type Crypto struct {
	// contains filtered or unexported fields
}

func MakeCrypto

func MakeCrypto() *Crypto

func (*Crypto) GeneratePassword

func (c *Crypto) GeneratePassword(config PasswordConfig) (string, error)

GeneratePassword generates a cryptographically secure password

func (*Crypto) MakeCognitoSecretHash

func (c *Crypto) MakeCognitoSecretHash(userId, clientId, clientSecret string) string

MakeCognitoSecretHash Creates a hash based on the user id, service id and secret which must be sent with every cognito auth request (along with a refresh token) to get a new access token.

type PasswordConfig

type PasswordConfig struct {
	Length         int
	RequireUpper   bool
	RequireLower   bool
	RequireNumber  bool
	RequireSpecial bool
}

PasswordConfig holds the configuration for password generation

Jump to

Keyboard shortcuts

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