app

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeystoreService    = "enbu"
	DefaultEnvironment = "default"
)

Variables

This section is empty.

Functions

func IsNotFoundError

func IsNotFoundError(err error) bool

func IsNotInitializedError

func IsNotInitializedError(err error) bool

func IsSnapshotTag

func IsSnapshotTag(env, tag string) bool

func IsUserRecipientTag

func IsUserRecipientTag(tag string) bool

func LoadIdentitiesForRepo

func LoadIdentitiesForRepo(ks KeyStore, owner, repo string) ([]agecrypto.Identity, error)

func PullAllRecipients

func PullAllRecipients(ctx context.Context, reg Registry, ref string, token string) ([]string, error)

func PullSecretsWithDigest

func PullSecretsWithDigest(ctx context.Context, reg Registry, ref, token string, identities ...agecrypto.Identity) (map[string]string, string, error)

func RecipientTagPrefix

func RecipientTagPrefix() string

func RepoKeystoreKey

func RepoKeystoreKey(owner, repo string) string

func SecretsExists

func SecretsExists(ctx context.Context, reg Registry, ref, token string) bool

Types

type App

type App struct {
	Registry      Registry
	TokenProvider TokenProvider
	KeyStore      KeyStore
	RepoDetector  RepoDetector
	Git           gitprovider.Client
	Platform      PlatformClient
	Events        EventHandler
	RegistryHost  string
	RepositoryDir string
}

func New

func New() *App

func (*App) AddSecret

func (a *App) AddSecret(ctx context.Context, env, key, value string) (err error)

func (*App) CreateEnvironment

func (a *App) CreateEnvironment(name string) (err error)

func (*App) CurrentEnvironment

func (a *App) CurrentEnvironment() (name string, err error)

func (*App) DeleteEnvironment

func (a *App) DeleteEnvironment(name string) (err error)

func (*App) DeleteSecret

func (a *App) DeleteSecret(ctx context.Context, env, key string) (err error)

func (*App) DiffHistory

func (a *App) DiffHistory(ctx context.Context, env string, fromIdx, toIdx int) (diff *Diff, err error)

func (*App) EditSecret

func (a *App) EditSecret(ctx context.Context, env, key, value string) (err error)

func (*App) InitializeRepository

func (a *App) InitializeRepository(ctx context.Context) (result *InitResult, err error)

func (*App) ListEnvironments

func (a *App) ListEnvironments() (envs []EnvInfo, err error)

func (*App) ListHistory

func (a *App) ListHistory(ctx context.Context, env string) (history []HistoryEntry, err error)

func (*App) ListRecipients

func (a *App) ListRecipients(ctx context.Context) (recipients []RecipientInfo, err error)

func (*App) ListSecrets

func (a *App) ListSecrets(ctx context.Context, env string) (result map[string]string, err error)

func (*App) PullSecrets

func (a *App) PullSecrets(ctx context.Context, env string) (data []byte, output string, count int, err error)

func (*App) PullSecretsData added in v0.8.0

func (a *App) PullSecretsData(ctx context.Context, env string) (result *PulledSecrets, err error)

func (*App) PullSecretsToFile

func (a *App) PullSecretsToFile(ctx context.Context, env string) (err error)

func (*App) ReadConfig

func (a *App) ReadConfig() (content string, err error)

func (*App) RenameEnvironment

func (a *App) RenameEnvironment(oldName, newName string) (err error)

func (*App) RestoreHistory

func (a *App) RestoreHistory(ctx context.Context, env string, idx int) (err error)

func (*App) SetRepositoryDir

func (a *App) SetRepositoryDir(dir string)

func (*App) SwitchEnvironment

func (a *App) SwitchEnvironment(name string) (err error)

func (*App) SwitchPrevious

func (a *App) SwitchPrevious() (name string, err error)

func (*App) SyncSecrets

func (a *App) SyncSecrets(ctx context.Context, env string) (err error)

func (*App) WriteConfig

func (a *App) WriteConfig(content string) (err error)

type Diff

type Diff struct {
	Added    []string `json:"added"`
	Removed  []string `json:"removed"`
	Modified []string `json:"modified"`
}

type EnvInfo

type EnvInfo struct {
	Name      string `json:"name"`
	IsCurrent bool   `json:"current"`
}

type EventHandler

type EventHandler interface {
	OnProgress(msg string)
	OnStepProgress(step ProgressStep)
	OnConflictRetry(attempt, maxAttempts int)
}

type HistoryEntry

type HistoryEntry struct {
	Index     int       `json:"index"`
	Timestamp time.Time `json:"timestamp"`
	Tag       string    `json:"tag"`
}

type InitResult

type InitResult struct {
	PublicKey   string `json:"public_key"`
	Username    string `json:"username"`
	Environment string `json:"environment"`
}

type KeyStore

type KeyStore interface {
	Store(service, key string, value []byte) error
	Load(service, key string) ([]byte, error)
}

type PlatformClient

type PlatformClient interface {
	GetUser(ctx context.Context) (*provider.User, error)
	IsOrganization(ctx context.Context, login string) bool
	SourceRepoURL(owner, repo string) string
}

type ProgressStep added in v0.7.4

type ProgressStep struct {
	Op     string `json:"op"`     // "add" | "pull" | "sync" | "delete"
	Step   string `json:"step"`   // "encrypt" | "push" | "pull_secrets" | "pull_recipients" | "reencrypt" | "decrypt" | "write"
	Status string `json:"status"` // "start" | "done"
}

type PulledSecrets added in v0.8.0

type PulledSecrets struct {
	Environment string
	Output      string
	Secrets     map[string]string
}

type RecipientInfo

type RecipientInfo struct {
	Username    string
	Fingerprint string
	PublicKey   string
}

type Registry

type Registry interface {
	Push(ctx context.Context, ref string, mediaType string, data []byte, token string, opts *oci.PushOptions) error
	Pull(ctx context.Context, ref string, token string) ([]byte, error)
	ListTags(ctx context.Context, ref string, token string) ([]string, error)
	GetDigest(ctx context.Context, ref string, token string) (string, error)
}

type RepoDetector

type RepoDetector interface {
	LoadRepo() (owner, repo string, err error)
}

type ResolvedEnvironment

type ResolvedEnvironment struct {
	Name   string
	Output string
}

func ResolveEnvironment

func ResolveEnvironment(name string) (*ResolvedEnvironment, error)

type TokenProvider

type TokenProvider interface {
	LoadToken() (accessToken string, username string, err error)
}

Jump to

Keyboard shortcuts

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