repository

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountSecretsParams

type CountSecretsParams struct {
	TenantID      pgtype.Text `json:"tenant_id"`
	Status        pgtype.Text `json:"status"`
	ConnectorType pgtype.Text `json:"connector_type"`
}

type CreateSecretParams

type CreateSecretParams struct {
	Name           string      `json:"name"`
	EncryptedValue string      `json:"encrypted_value"`
	KeyVersion     int32       `json:"key_version"`
	ConnectorType  string      `json:"connector_type"`
	Description    pgtype.Text `json:"description"`
	TenantID       pgtype.Text `json:"tenant_id"`
	CreatedBy      pgtype.Text `json:"created_by"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type GetSecretByNameParams

type GetSecretByNameParams struct {
	Name     string      `json:"name"`
	TenantID pgtype.Text `json:"tenant_id"`
}

type ListSecretsParams

type ListSecretsParams struct {
	TenantID      pgtype.Text `json:"tenant_id"`
	Status        pgtype.Text `json:"status"`
	ConnectorType pgtype.Text `json:"connector_type"`
	Offset        int32       `json:"offset"`
	Limit         int32       `json:"limit"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CountSecrets

func (q *Queries) CountSecrets(ctx context.Context, arg CountSecretsParams) (int64, error)

func (*Queries) CreateSecret

func (q *Queries) CreateSecret(ctx context.Context, arg CreateSecretParams) (SecrSecret, error)

func (*Queries) DeleteSecret

func (q *Queries) DeleteSecret(ctx context.Context, id uuid.UUID) error

func (*Queries) GetSecretByID

func (q *Queries) GetSecretByID(ctx context.Context, id uuid.UUID) (SecrSecret, error)

func (*Queries) GetSecretByName

func (q *Queries) GetSecretByName(ctx context.Context, arg GetSecretByNameParams) (SecrSecret, error)

tenant_id is matched with IS NOT DISTINCT FROM, so a NULL argument means "the platform-scoped row" (tenant_id IS NULL) and NOT "any tenant's row". The previous (narg IS NULL OR tenant_id = narg) form collapsed to TRUE on a NULL argument and returned an arbitrary tenant's secret — a cross-tenant credential leak, since the query has no ORDER BY.

func (*Queries) ListSecrets

func (q *Queries) ListSecrets(ctx context.Context, arg ListSecretsParams) ([]SecrSecret, error)

func (*Queries) RevokeSecret

func (q *Queries) RevokeSecret(ctx context.Context, id uuid.UUID) (SecrSecret, error)

func (*Queries) UpdateSecret

func (q *Queries) UpdateSecret(ctx context.Context, arg UpdateSecretParams) (SecrSecret, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type SecrSecret

type SecrSecret struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
	// AES-256-GCM ciphertext (base64). Nonce prepended. Never store plaintext.
	EncryptedValue string `json:"encrypted_value"`
	// Encryption key version used — enables key rotation without re-encrypting all rows
	KeyVersion    int32       `json:"key_version"`
	ConnectorType string      `json:"connector_type"`
	Description   pgtype.Text `json:"description"`
	// active | revoked
	Status    string      `json:"status"`
	TenantID  pgtype.Text `json:"tenant_id"`
	CreatedBy pgtype.Text `json:"created_by"`
	CreatedAt time.Time   `json:"created_at"`
	UpdatedAt time.Time   `json:"updated_at"`
}

type UpdateSecretParams

type UpdateSecretParams struct {
	ID             uuid.UUID   `json:"id"`
	Name           string      `json:"name"`
	EncryptedValue string      `json:"encrypted_value"`
	KeyVersion     int32       `json:"key_version"`
	ConnectorType  string      `json:"connector_type"`
	Description    pgtype.Text `json:"description"`
}

Jump to

Keyboard shortcuts

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