Documentation
¶
Index ¶
- Constants
- func Can(ctx context.Context, client *redis.Client, logger zerolog.Logger, key string, ...) (bool, error)
- func HashedKey(key string) string
- type APIKey
- func GetKey(ctx context.Context, client *redis.Client, logger zerolog.Logger, key string) (*APIKey, error)
- func NewKey(ctx context.Context, client *grsearch.Client, logger zerolog.Logger, ...) (string, *APIKey, error)
- func NewKeyWithExpiry(ctx context.Context, client *grsearch.Client, logger zerolog.Logger, ...) (string, *APIKey, error)
- type KeyPermissions
Constants ¶
View Source
const DefaultKeyExpiry = time.Duration(time.Hour * oneHundredAndEightyDays)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIKey ¶
type APIKey struct {
Permissions KeyPermissions `json:"permissions"`
Expires time.Time `json:"expires"`
Created time.Time `json:"created"`
Owner string `json:"owner"`
Email string `json:"email"`
CreatedBy string `json:"createdBy"`
Comment string `json:"comment"`
}
func GetKey ¶
func GetKey(ctx context.Context, client *redis.Client, logger zerolog.Logger, key string) (*APIKey, error)
Returns the permissions associated with a raw key if it exists. Returns an empty string if not
func NewKey ¶
func NewKey(ctx context.Context, client *grsearch.Client, logger zerolog.Logger, owner, email, creator, comment string, permissions KeyPermissions) (string, *APIKey, error)
NewKey returns a random string to be used as a key with the specified permissions and default expirty
func NewKeyWithExpiry ¶
func NewKeyWithExpiry(ctx context.Context, client *grsearch.Client, logger zerolog.Logger, owner, email, creator, comment string, permissions KeyPermissions, expiry time.Duration) (string, *APIKey, error)
NewKeyWithExpiry returns a random string to be used as a key with the specified permissions and expiry
type KeyPermissions ¶
type KeyPermissions uint32
Click to show internal directories.
Click to hide internal directories.