apikey
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcGenerate¶
func Generate(paramsCreateParams) (database.InsertAPIKeyParams,string,error)
Generate generates an API key, returning the key as a string as well as thedatabase representation. It is the responsibility of the caller to insert itinto the database.
funcGenerateSecret¶added inv2.28.0
funcHashSecret¶added inv2.28.0
HashSecret is the single function used to hash API key secrets.Use this to ensure a consistent hashing algorithm.
funcValidateHash¶added inv2.28.0
ValidateHash compares a secret against an expected hashed secret.
Types¶
typeCreateParams¶
type CreateParams struct {UserIDuuid.UUIDLoginTypedatabase.LoginType// DefaultLifetime is configured in DeploymentValues.// It is used if both ExpiresAt and LifetimeSeconds are not set.DefaultLifetimetime.Duration// Optional.ExpiresAttime.TimeLifetimeSecondsint64// Scope is legacy single-scope input kept for backward compatibility.//// Deprecated: use Scopes instead.Scopedatabase.APIKeyScope// Scopes is the full list of scopes to attach to the key.Scopesdatabase.APIKeyScopesTokenNamestringRemoteAddrstring// AllowList is an optional, normalized allow-list// of resource type and uuid entries. If empty, defaults to wildcard.AllowListdatabase.AllowList}