allowlist

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnabledEnvVar = "ENABLE_ALLOWLIST"
	Enabled       = false
	KeyCollection = "allowlist_keys_collection"
	AllowedUsers  = "allowed_users"

	ErrReadingAmountOfKeys  = errors.New("error unmarshalling payload: expected form {\"amount\": <int>}")
	ErrFailedToGenerateKeys = errors.New("error generating beta keys")
	ErrPermissionDenied     = errors.New("permission denied: caller is not admin")

	ErrInvalidBetaKey     = errors.New("invalid beta key")
	ErrNotAllowlisted     = errors.New("this user is not allowlisted")
	ErrBetaKeyAlreadyUsed = errors.New("beta key already used")
	ErrAlreadyVerified    = errors.New("this user is already verified by an existing beta key")
)

Functions

func IsUserVerified

func IsUserVerified(ctx context.Context, nk runtime.NakamaModule, userID string) (verified bool, err error)

IsUserVerified returns true if the user has registered a beta key and false if they have not registered a beta key.

Types

type ClaimKeyMsg

type ClaimKeyMsg struct {
	Key string `json:"key"`
}

type ClaimKeyRes

type ClaimKeyRes struct {
	Success bool `json:"success"`
}

func ClaimKey

func ClaimKey(ctx context.Context, nk runtime.NakamaModule, msg ClaimKeyMsg) (res ClaimKeyRes, err error)

type GenKeysMsg

type GenKeysMsg struct {
	Amount int `json:"amount"`
}

type GenKeysResponse

type GenKeysResponse struct {
	Keys []string `json:"keys"`
}

func GenerateBetaKeys

func GenerateBetaKeys(ctx context.Context, nk runtime.NakamaModule, msg GenKeysMsg) (res GenKeysResponse, err error)

type KeyStorage

type KeyStorage struct {
	Key    string
	UsedBy string
	Used   bool
}

Jump to

Keyboard shortcuts

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