Help us shape the future of Go! Take the 2026 Go Developer Survey

secret

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(log *zap.Logger, idLookupKey string, svc influxdb.SecretService) http.Handler

NewHandler creates a new handler for the secret service

Types

type AuthedSvc

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

AuthedSvc wraps a influxdb.AuthedSvc and authorizes actions against it appropriately.

func NewAuthedService

func NewAuthedService(s influxdb.SecretService) *AuthedSvc

NewAuthedService constructs an instance of an authorizing secret service.

func (*AuthedSvc) DeleteSecret

func (s *AuthedSvc) DeleteSecret(ctx context.Context, orgID platform.ID, keys ...string) error

DeleteSecret checks to see if the authorizer on context has write access to the secret keys provided.

func (*AuthedSvc) GetSecretKeys

func (s *AuthedSvc) GetSecretKeys(ctx context.Context, orgID platform.ID) ([]string, error)

GetSecretKeys checks to see if the authorizer on context has read access to all the secrets belonging to orgID.

func (*AuthedSvc) LoadSecret

func (s *AuthedSvc) LoadSecret(ctx context.Context, orgID platform.ID, key string) (string, error)

LoadSecret checks to see if the authorizer on context has read access to the secret key provided.

func (*AuthedSvc) PatchSecrets

func (s *AuthedSvc) PatchSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PatchSecrets checks to see if the authorizer on context has write access to the secret keys provided.

func (*AuthedSvc) PutSecret

func (s *AuthedSvc) PutSecret(ctx context.Context, orgID platform.ID, key string, val string) error

PutSecret checks to see if the authorizer on context has write access to the secret key provided.

func (*AuthedSvc) PutSecrets

func (s *AuthedSvc) PutSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PutSecrets checks to see if the authorizer on context has read and write access to the secret keys provided.

type Client

type Client struct {
	Client *httpc.Client
}

func (*Client) DeleteSecret

func (s *Client) DeleteSecret(ctx context.Context, orgID platform.ID, ks ...string) error

DeleteSecret removes a single secret via HTTP.

func (*Client) GetSecretKeys

func (s *Client) GetSecretKeys(ctx context.Context, orgID platform.ID) ([]string, error)

GetSecretKeys get all secret keys mathing an org ID via HTTP.

func (*Client) LoadSecret

func (s *Client) LoadSecret(ctx context.Context, orgID platform.ID, k string) (string, error)

LoadSecret is not implemented for http

func (*Client) PatchSecrets

func (s *Client) PatchSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PatchSecrets will update the existing secret with new via http.

func (*Client) PutSecret

func (s *Client) PutSecret(ctx context.Context, orgID platform.ID, k string, v string) error

PutSecret is not implemented for http.

func (*Client) PutSecrets

func (s *Client) PutSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PutSecrets is not implemented for http.

type Logger

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

Logger is a logger service middleware for secrets

func NewLogger

func NewLogger(log *zap.Logger, s influxdb.SecretService) *Logger

NewLogger returns a logging service middleware for the User Service.

func (*Logger) DeleteSecret

func (l *Logger) DeleteSecret(ctx context.Context, orgID platform.ID, keys ...string) (err error)

DeleteSecret removes a single secret from the secret store.

func (*Logger) GetSecretKeys

func (l *Logger) GetSecretKeys(ctx context.Context, orgID platform.ID) (strs []string, err error)

GetSecretKeys retrieves all secret keys that are stored for the organization orgID.

func (*Logger) LoadSecret

func (l *Logger) LoadSecret(ctx context.Context, orgID platform.ID, key string) (str string, err error)

LoadSecret retrieves the secret value v found at key k for organization orgID.

func (*Logger) PatchSecrets

func (l *Logger) PatchSecrets(ctx context.Context, orgID platform.ID, m map[string]string) (err error)

PatchSecrets patches all provided secrets and updates any previous values.

func (*Logger) PutSecret

func (l *Logger) PutSecret(ctx context.Context, orgID platform.ID, key string, val string) (err error)

PutSecret stores the secret pair (k,v) for the organization orgID.

func (*Logger) PutSecrets

func (l *Logger) PutSecrets(ctx context.Context, orgID platform.ID, m map[string]string) (err error)

PutSecrets puts all provided secrets and overwrites any previous values.

type SecreteService

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

SecreteService is a metrics middleware system for the secret service

func NewMetricService

func NewMetricService(reg prometheus.Registerer, s influxdb.SecretService) *SecreteService

NewMetricService creates a new secret metrics middleware

func (*SecreteService) DeleteSecret

func (ms *SecreteService) DeleteSecret(ctx context.Context, orgID platform.ID, keys ...string) error

DeleteSecret removes a single secret from the secret store.

func (*SecreteService) GetSecretKeys

func (ms *SecreteService) GetSecretKeys(ctx context.Context, orgID platform.ID) ([]string, error)

GetSecretKeys retrieves all secret keys that are stored for the organization orgID.

func (*SecreteService) LoadSecret

func (ms *SecreteService) LoadSecret(ctx context.Context, orgID platform.ID, key string) (string, error)

LoadSecret retrieves the secret value v found at key k for organization orgID.

func (*SecreteService) PatchSecrets

func (ms *SecreteService) PatchSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PatchSecrets patches all provided secrets and updates any previous values.

func (*SecreteService) PutSecret

func (ms *SecreteService) PutSecret(ctx context.Context, orgID platform.ID, key string, val string) error

PutSecret stores the secret pair (k,v) for the organization orgID.

func (*SecreteService) PutSecrets

func (ms *SecreteService) PutSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PutSecrets puts all provided secrets and overwrites any previous values.

type Service

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

func NewService

func NewService(s *Storage) *Service

NewService creates a new service implementation for secrets

func (*Service) DeleteSecret

func (s *Service) DeleteSecret(ctx context.Context, orgID platform.ID, ks ...string) error

DeleteSecret removes a single secret from the secret store.

func (*Service) GetSecretKeys

func (s *Service) GetSecretKeys(ctx context.Context, orgID platform.ID) ([]string, error)

GetSecretKeys retrieves all secret keys that are stored for the organization orgID.

func (*Service) LoadSecret

func (s *Service) LoadSecret(ctx context.Context, orgID platform.ID, k string) (string, error)

LoadSecret retrieves the secret value v found at key k for organization orgID.

func (*Service) PatchSecrets

func (s *Service) PatchSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PatchSecrets patches all provided secrets and updates any previous values.

func (*Service) PutSecret

func (s *Service) PutSecret(ctx context.Context, orgID platform.ID, k, v string) error

PutSecret stores the secret pair (k,v) for the organization orgID.

func (*Service) PutSecrets

func (s *Service) PutSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PutSecrets puts all provided secrets and overwrites any previous values.

type Storage

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

Storage is a store translation layer between the data storage unit and the service layer.

func NewStore

func NewStore(s kv.Store) (*Storage, error)

NewStore creates a new storage system

func (*Storage) DeleteSecret

func (s *Storage) DeleteSecret(ctx context.Context, tx kv.Tx, orgID platform.ID, k string) error

DeleteSecret removes a secret for the db

func (*Storage) GetSecret

func (s *Storage) GetSecret(ctx context.Context, tx kv.Tx, orgID platform.ID, k string) (string, error)

GetSecret Returns the value of a secret

func (*Storage) ListSecret

func (s *Storage) ListSecret(ctx context.Context, tx kv.Tx, orgID platform.ID) ([]string, error)

ListSecrets returns a list of secret keys

func (*Storage) PutSecret

func (s *Storage) PutSecret(ctx context.Context, tx kv.Tx, orgID platform.ID, k, v string) error

PutSecret sets a secret in the db.

func (*Storage) Update

func (s *Storage) Update(ctx context.Context, fn func(kv.Tx) error) error

func (*Storage) View

func (s *Storage) View(ctx context.Context, fn func(kv.Tx) error) error

Jump to

Keyboard shortcuts

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