service

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VaultService

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

VaultService provides high-level vault operations. It wraps config and storage to reduce duplication in command handlers.

func NewVaultService

func NewVaultService() (*VaultService, error)

NewVaultService creates a new VaultService with loaded config.

func (*VaultService) CreateVault

func (s *VaultService) CreateVault(username, password string) error

CreateVault creates a new vault for a user with the given password.

func (*VaultService) DeleteVault

func (s *VaultService) DeleteVault(username string) error

DeleteVault removes the vault file for a user.

func (*VaultService) EnsureVaultDir

func (s *VaultService) EnsureVaultDir() error

EnsureVaultDir creates the vault directory if it doesn't exist.

func (*VaultService) GetVaultDir

func (s *VaultService) GetVaultDir() string

GetVaultDir returns the vault directory path.

func (*VaultService) GetVaultPath

func (s *VaultService) GetVaultPath(username string) string

GetVaultPath returns the vault file path for a user.

func (*VaultService) LoadAndDecrypt

func (s *VaultService) LoadAndDecrypt(username, password string) (map[string]string, *storage.Vault, error)

LoadAndDecrypt loads a vault and decrypts it with the given password. Returns the decrypted keys and the vault (for potential updates).

func (*VaultService) UpdateAndSave

func (s *VaultService) UpdateAndSave(username, password string, vault *storage.Vault, keys map[string]string) error

UpdateAndSave updates the vault with new keys and saves it.

func (*VaultService) VaultExists

func (s *VaultService) VaultExists(username string) bool

VaultExists checks if a vault exists for the given user.

Jump to

Keyboard shortcuts

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