apikeys

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(keyStore *Store, basicUser, basicPass string) func(http.Handler) http.Handler

Types

type APIKey

type APIKey struct {
	ID         string     `json:"id"`
	Name       string     `json:"name"`
	KeyPrefix  string     `json:"key_prefix"`
	Type       string     `json:"type"` // "general" | "project"
	ProjectID  *string    `json:"project_id"`
	CreatedAt  time.Time  `json:"created_at"`
	LastUsedAt *time.Time `json:"last_used_at"`
	Active     bool       `json:"active"`
}

type APIKeyCreateResult

type APIKeyCreateResult struct {
	APIKey
	FullKey string `json:"key"`
}

type AuthInfo

type AuthInfo struct {
	Method    string  // "basic" | "apikey"
	KeyType   string  // "general" | "project" (only for apikey)
	ProjectID *string // non-nil only for project keys
}

func FromContext

func FromContext(ctx context.Context) *AuthInfo

func (*AuthInfo) IsReadOnly

func (a *AuthInfo) IsReadOnly() bool

type GSCConnection

type GSCConnection struct {
	ID           string    `json:"id"`
	ProjectID    string    `json:"project_id"`
	PropertyURL  string    `json:"property_url"`
	AccessToken  string    `json:"-"`
	RefreshToken string    `json:"-"`
	TokenExpiry  time.Time `json:"token_expiry"`
	CreatedAt    time.Time `json:"created_at"`
}

type KeyLookupResult

type KeyLookupResult struct {
	ID        string
	Type      string
	ProjectID *string
}

type Project

type Project struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

type Store

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

func NewStore

func NewStore(dbPath string) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) CreateAPIKey

func (s *Store) CreateAPIKey(name, keyType string, projectID *string) (*APIKeyCreateResult, error)

func (*Store) CreateExtractorSet added in v0.3.0

func (s *Store) CreateExtractorSet(name string, extractors []extraction.Extractor) (*extraction.ExtractorSet, error)

func (*Store) CreateProject

func (s *Store) CreateProject(name string) (*Project, error)

func (*Store) CreateRuleset

func (s *Store) CreateRuleset(name string, rules []customtests.TestRule) (*customtests.Ruleset, error)

func (*Store) DeleteAPIKey

func (s *Store) DeleteAPIKey(id string) error

func (*Store) DeleteExtractorSet added in v0.3.0

func (s *Store) DeleteExtractorSet(id string) error

func (*Store) DeleteGSCConnection

func (s *Store) DeleteGSCConnection(projectID string) error

func (*Store) DeleteProject

func (s *Store) DeleteProject(id string) error

func (*Store) DeleteProviderConnection

func (s *Store) DeleteProviderConnection(projectID, provider string) error

func (*Store) DeleteRuleset

func (s *Store) DeleteRuleset(id string) error

func (*Store) GetExtractorSet added in v0.3.0

func (s *Store) GetExtractorSet(id string) (*extraction.ExtractorSet, error)

func (*Store) GetGSCConnection

func (s *Store) GetGSCConnection(projectID string) (*GSCConnection, error)

func (*Store) GetProject

func (s *Store) GetProject(id string) (*Project, error)

func (*Store) GetProviderConnection

func (s *Store) GetProviderConnection(projectID, provider string) (*providers.ProviderConnection, error)

func (*Store) GetRuleset

func (s *Store) GetRuleset(id string) (*customtests.Ruleset, error)

func (*Store) ListAPIKeys

func (s *Store) ListAPIKeys() ([]APIKey, error)

func (*Store) ListExtractorSets added in v0.3.0

func (s *Store) ListExtractorSets() ([]extraction.ExtractorSet, error)

func (*Store) ListGSCConnections

func (s *Store) ListGSCConnections() ([]GSCConnection, error)

func (*Store) ListProjects

func (s *Store) ListProjects() ([]Project, error)

func (*Store) ListProjectsPaginated

func (s *Store) ListProjectsPaginated(limit, offset int, search string) ([]Project, int, error)

func (*Store) ListProviderConnections

func (s *Store) ListProviderConnections(projectID string) ([]providers.ProviderConnection, error)

func (*Store) ListRulesets

func (s *Store) ListRulesets() ([]customtests.Ruleset, error)

func (*Store) RenameProject

func (s *Store) RenameProject(id, name string) error

func (*Store) SaveGSCConnection

func (s *Store) SaveGSCConnection(conn *GSCConnection) error

func (*Store) SaveProviderConnection

func (s *Store) SaveProviderConnection(conn *providers.ProviderConnection) error

func (*Store) UpdateExtractorSet added in v0.3.0

func (s *Store) UpdateExtractorSet(id, name string, extractors []extraction.Extractor) error

func (*Store) UpdateRuleset

func (s *Store) UpdateRuleset(id, name string, rules []customtests.TestRule) error

func (*Store) ValidateKey

func (s *Store) ValidateKey(rawKey string) *KeyLookupResult

Jump to

Keyboard shortcuts

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