secrets

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CipherAlgorithmAES256GCM             = "aes-256-gcm"
	KeySourceDatabaseDSNSHA256 KeySource = "database_dsn_sha256"
	DefaultKeyID                         = "database-dsn-sha256:v1"
)

Variables

View Source
var (
	ErrResolutionScopeConflict = errors.New("secret binding precedence conflict")
)

Functions

func BindingKeysFromCandidates

func BindingKeysFromCandidates(candidates []Candidate) ([]string, error)

func DefaultCipherSeed

func DefaultCipherSeed(seed string) string

func NormalizeName

func NormalizeName(raw string) (string, error)

func ParseBindingKeys

func ParseBindingKeys(raw []string) ([]string, error)

func ProjectIDForBindingScope

func ProjectIDForBindingScope(scope BindingScopeKind, projectID uuid.UUID) uuid.UUID

func ProjectIDForSecretScope

func ProjectIDForSecretScope(scope ScopeKind, projectID uuid.UUID) uuid.UUID

func RedactValue

func RedactValue(raw string) string

func ResolutionRank

func ResolutionRank(scope BindingScopeKind) int

Types

type Binding

type Binding struct {
	ID              uuid.UUID        `json:"id"`
	OrganizationID  uuid.UUID        `json:"organization_id"`
	ProjectID       uuid.UUID        `json:"project_id"`
	SecretID        uuid.UUID        `json:"secret_id"`
	Scope           BindingScopeKind `json:"scope"`
	ScopeResourceID uuid.UUID        `json:"scope_resource_id"`
	BindingKey      string           `json:"binding_key"`
	CreatedAt       time.Time        `json:"created_at"`
	UpdatedAt       time.Time        `json:"updated_at"`
}

type BindingRecord

type BindingRecord struct {
	Binding Binding       `json:"binding"`
	Secret  Secret        `json:"secret"`
	Target  BindingTarget `json:"target"`
}

type BindingScopeKind

type BindingScopeKind string
const (
	BindingScopeKindOrganization BindingScopeKind = "organization"
	BindingScopeKindProject      BindingScopeKind = "project"
	BindingScopeKindWorkflow     BindingScopeKind = "workflow"
	BindingScopeKindAgent        BindingScopeKind = "agent"
	BindingScopeKindTicket       BindingScopeKind = "ticket"
)

func ParseBindingScopeKind

func ParseBindingScopeKind(raw string) (BindingScopeKind, error)

func ParseRuntimeBindingScopeKind

func ParseRuntimeBindingScopeKind(raw string) (BindingScopeKind, error)

type BindingTarget

type BindingTarget struct {
	ID         uuid.UUID        `json:"id"`
	Scope      BindingScopeKind `json:"scope"`
	Name       string           `json:"name"`
	Identifier string           `json:"identifier,omitempty"`
}

type Candidate

type Candidate struct {
	Binding Binding
	Secret  Secret
}

type InventorySecret

type InventorySecret struct {
	Secret      Secret             `json:"secret"`
	UsageCount  int                `json:"usage_count"`
	UsageScopes []BindingScopeKind `json:"usage_scopes"`
}

type KeySource

type KeySource string

type Kind

type Kind string
const (
	KindOpaque Kind = "opaque"
)

func ParseKind

func ParseKind(raw string) (Kind, error)

type ResolvedSecret

type ResolvedSecret struct {
	BindingKey   string           `json:"binding_key"`
	BindingScope BindingScopeKind `json:"binding_scope"`
	SecretID     uuid.UUID        `json:"secret_id"`
	SecretName   string           `json:"secret_name"`
	SecretScope  ScopeKind        `json:"secret_scope"`
	SecretKind   Kind             `json:"secret_kind"`
	Value        string           `json:"value"`
}

type ScopeKind

type ScopeKind string
const (
	ScopeKindOrganization ScopeKind = "organization"
	ScopeKindProject      ScopeKind = "project"
)

func ParseScopeKind

func ParseScopeKind(raw string) (ScopeKind, error)

type Secret

type Secret struct {
	ID             uuid.UUID   `json:"id"`
	OrganizationID uuid.UUID   `json:"organization_id"`
	ProjectID      uuid.UUID   `json:"project_id"`
	Scope          ScopeKind   `json:"scope"`
	Name           string      `json:"name"`
	Kind           Kind        `json:"kind"`
	Description    string      `json:"description"`
	DisabledAt     *time.Time  `json:"disabled_at,omitempty"`
	CreatedAt      time.Time   `json:"created_at"`
	UpdatedAt      time.Time   `json:"updated_at"`
	StoredValue    StoredValue `json:"stored_value"`
}

type SelectedBinding

type SelectedBinding struct {
	BindingKey string
	Binding    Binding
	Secret     Secret
}

func SelectBindings

func SelectBindings(keys []string, candidates []Candidate) ([]SelectedBinding, []string, error)

type StoredValue

type StoredValue struct {
	Algorithm  string    `json:"algorithm"`
	KeySource  KeySource `json:"key_source"`
	KeyID      string    `json:"key_id"`
	Preview    string    `json:"preview"`
	Nonce      string    `json:"nonce"`
	Ciphertext string    `json:"ciphertext"`
	RotatedAt  time.Time `json:"rotated_at"`
}

Jump to

Keyboard shortcuts

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