Documentation
¶
Index ¶
- type VaultService
- func (s *VaultService) CreateVault(username, password string) error
- func (s *VaultService) DeleteVault(username string) error
- func (s *VaultService) EnsureVaultDir() error
- func (s *VaultService) GetVaultDir() string
- func (s *VaultService) GetVaultPath(username string) string
- func (s *VaultService) LoadAndDecrypt(username, password string) (map[string]string, *storage.Vault, error)
- func (s *VaultService) UpdateAndSave(username, password string, vault *storage.Vault, keys map[string]string) error
- func (s *VaultService) VaultExists(username string) bool
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.