Movatterモバイル変換


[0]ホーム

URL:


apikey

package
v2.28.4Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License:AGPL-3.0Imports:12Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcGenerate

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.

funcGenerateSecretadded inv2.28.0

func GenerateSecret(lengthint) (secretstring, hashed []byte, errerror)

funcHashSecretadded inv2.28.0

func HashSecret(secretstring) []byte

HashSecret is the single function used to hash API key secrets.Use this to ensure a consistent hashing algorithm.

funcValidateHashadded inv2.28.0

func ValidateHash(hashedSecret []byte, secretstring)bool

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}

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp