daemon

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 16 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 InitRequest

type InitRequest struct {
	Password string `json:"password"`
}

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 SecretListItem

type SecretListItem struct {
	Path      string    `json:"path"`
	HasValue  bool      `json:"has_value"`
	HasFields bool      `json:"has_fields"`
	Tags      []string  `json:"tags,omitempty"`
	UpdatedAt time.Time `json:"updated_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"`
}

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"`
}

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