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

daemon

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package daemon provides the OmniVault daemon server.

Index

Constants

View Source
const (
	ErrCodeVaultLocked     = "VAULT_LOCKED"
	ErrCodeVaultNotFound   = "VAULT_NOT_FOUND"
	ErrCodeSecretNotFound  = "SECRET_NOT_FOUND"
	ErrCodeInvalidPassword = "INVALID_PASSWORD"
	ErrCodeInvalidRequest  = "INVALID_REQUEST"
	ErrCodeInternalError   = "INTERNAL_ERROR"
	ErrCodeAlreadyExists   = "ALREADY_EXISTS"
)

Error codes.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangePasswordRequest

type ChangePasswordRequest struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

ChangePasswordRequest is the request to change the master password.

type ErrorResponse

type ErrorResponse struct {
	Error   string `json:"error"`
	Code    string `json:"code,omitempty"`
	Details string `json:"details,omitempty"`
}

ErrorResponse is the response for errors.

type ExportRequest added in v0.5.0

type ExportRequest struct {
	Prefix string `json:"prefix,omitempty"`
}

ExportRequest is the request to export secrets.

type ExportResponse added in v0.5.0

type ExportResponse struct {
	Secrets []ExportedSecret `json:"secrets"`
	Count   int              `json:"count"`
}

ExportResponse is the response for export requests.

type ExportedSecret added in v0.5.0

type ExportedSecret struct {
	Path      string            `json:"path"`
	Value     string            `json:"value,omitempty"`
	Fields    map[string]string `json:"fields,omitempty"`
	Tags      map[string]string `json:"tags,omitempty"`
	ExpiresAt time.Time         `json:"expires_at,omitempty"`
}

ExportedSecret represents a secret for import/export.

type ImportRequest added in v0.5.0

type ImportRequest struct {
	Secrets []ExportedSecret `json:"secrets"`
	Merge   bool             `json:"merge"` // If true, skip existing secrets instead of overwriting
}

ImportRequest is the request to import secrets.

type ImportResponse added in v0.5.0

type ImportResponse struct {
	Imported int `json:"imported"`
	Skipped  int `json:"skipped"`
	Errors   int `json:"errors"`
}

ImportResponse is the response for import requests.

type InitRequest

type InitRequest struct {
	Password string `json:"password"` //nolint:gosec // G117: password field is intentional for vault
}

InitRequest is the request to initialize a new vault.

type ListResponse

type ListResponse struct {
	Secrets []SecretListItem `json:"secrets"`
	Count   int              `json:"count"`
}

ListResponse is the response for list requests.

type SearchRequest added in v0.5.0

type SearchRequest struct {
	Pattern string `json:"pattern"`
	Regex   bool   `json:"regex"`
}

SearchRequest is the request to search for secrets.

type SearchResponse added in v0.5.0

type SearchResponse struct {
	Paths []string `json:"paths"`
	Count int      `json:"count"`
}

SearchResponse is the response for search requests.

type SecretListItem

type SecretListItem struct {
	Path      string            `json:"path"`
	HasValue  bool              `json:"has_value"`
	HasFields bool              `json:"has_fields"`
	Tags      []string          `json:"tags,omitempty"`
	TagsMap   map[string]string `json:"tags_map,omitempty"`
	CreatedAt time.Time         `json:"created_at,omitempty"`
	UpdatedAt time.Time         `json:"updated_at,omitempty"`
	ExpiresAt time.Time         `json:"expires_at,omitempty"`
}

SecretListItem is an item in the secret list (metadata only).

type SecretResponse

type SecretResponse struct {
	Path      string            `json:"path"`
	Value     string            `json:"value,omitempty"`
	Fields    map[string]string `json:"fields,omitempty"`
	Tags      map[string]string `json:"tags,omitempty"`
	CreatedAt time.Time         `json:"created_at,omitempty"`
	UpdatedAt time.Time         `json:"updated_at,omitempty"`
	ExpiresAt time.Time         `json:"expires_at,omitempty"`
}

SecretResponse is the response for get secret requests.

type Server

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

Server is the OmniVault daemon server.

func NewServer

func NewServer(cfg ServerConfig) *Server

NewServer creates a new daemon server.

func NewServerWithPaths

func NewServerWithPaths(cfg ServerConfig, paths *config.Paths) *Server

NewServerWithPaths creates a new daemon server with custom paths (for testing).

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts the daemon server.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown gracefully shuts down the server.

type ServerConfig

type ServerConfig struct {
	Logger           *slog.Logger
	AutoLockDuration time.Duration
}

ServerConfig contains server configuration.

type SetSecretRequest

type SetSecretRequest struct {
	Value  string            `json:"value,omitempty"`
	Fields map[string]string `json:"fields,omitempty"`
	Tags   map[string]string `json:"tags,omitempty"`
}

SetSecretRequest is the request to set a secret.

type StatusResponse

type StatusResponse struct {
	Running     bool      `json:"running"`
	Locked      bool      `json:"locked"`
	VaultExists bool      `json:"vault_exists"`
	SecretCount int       `json:"secret_count"`
	UnlockedAt  time.Time `json:"unlocked_at,omitempty"`
	Uptime      string    `json:"uptime"`
}

StatusResponse is the response for status requests.

type SuccessResponse

type SuccessResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
}

SuccessResponse is a generic success response.

type UnlockRequest

type UnlockRequest struct {
	Password string `json:"password"` //nolint:gosec // G117: password field is intentional for vault
}

UnlockRequest is the request to unlock the vault.

Jump to

Keyboard shortcuts

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