Documentation
¶
Index ¶
- func DBPath() (string, error)
- func DecodeTags(raw string) []string
- func Delete() error
- func EncodeTags(tags []string) (string, error)
- func Exists() (bool, error)
- func NormalizeTagToken(token string) string
- func NormalizeTags(tags []string) []string
- func ParseTagInput(input string) []string
- type GroupModel
- type HostModel
- type MountState
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateHost(h *HostModel, plainKey string) error
- func (s *Store) CreateHostWithID(h *HostModel, encryptedKeyData string) error
- func (s *Store) DeleteAllMountStates() error
- func (s *Store) DeleteGroup(name string) error
- func (s *Store) DeleteHost(id int) error
- func (s *Store) DeleteMountState(hostID int) error
- func (s *Store) GetGroups() ([]string, error)
- func (s *Store) GetGroupsForSync(retention time.Duration) ([]GroupModel, error)
- func (s *Store) GetHostByID(id int) (*HostModel, error)
- func (s *Store) GetHostKey(id int) (string, error)
- func (s *Store) GetHostSecret(id int) (string, error)
- func (s *Store) GetHosts() ([]HostModel, error)
- func (s *Store) GetMountStates() ([]MountState, error)
- func (s *Store) GetSalt() (string, error)
- func (s *Store) PurgeDeletedGroups(olderThan time.Duration) error
- func (s *Store) ReencryptKeyData(encryptedData string, sourceSaltHex string, password string) (string, error)
- func (s *Store) RenameGroup(oldName, newName string) error
- func (s *Store) UpdateHost(h *HostModel) error
- func (s *Store) UpdateHostFromSync(h *HostModel, encryptedKeyData string, updatedAt time.Time) error
- func (s *Store) UpdateHostWithKey(h *HostModel, plainKey string) error
- func (s *Store) UpdateLastConnected(id int) error
- func (s *Store) UpsertGroup(name string) error
- func (s *Store) UpsertGroupFromSync(name string, createdAt, updatedAt time.Time, deletedAt *time.Time) error
- func (s *Store) UpsertMountState(hostID int, localPath, remotePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeTags ¶ added in v1.0.4
DecodeTags decodes tags from DB storage (JSON preferred, comma fallback).
func EncodeTags ¶ added in v1.0.4
EncodeTags encodes canonical tags for DB storage.
func NormalizeTagToken ¶ added in v1.0.4
NormalizeTagToken converts a raw tag token to canonical lowercase alphanumeric form.
func NormalizeTags ¶ added in v1.0.4
NormalizeTags normalizes and de-duplicates tag tokens.
func ParseTagInput ¶ added in v1.0.4
ParseTagInput parses comma-separated user input into canonical tags.
Types ¶
type GroupModel ¶ added in v1.0.2
GroupModel represents a named group used to organize hosts. Groups are identified by Name (case-insensitive uniqueness in DB). Deleted groups are tombstoned via DeletedAt and may be garbage collected later.
type HostModel ¶
type HostModel struct {
ID int
Label string
GroupName string
Tags []string
Hostname string
Username string
Port int
KeyData string // Encrypted blob
KeyType string
CreatedAt time.Time
UpdatedAt time.Time
LastConnected *time.Time
}
HostModel mirrors the Host struct but for DB interactions
type MountState ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store handles database operations
func Init ¶
Init opens the database and initializes the schema. It derives the master key from the password and uses it for SQLCipher encryption.
func (*Store) CreateHost ¶
CreateHost adds a new host
func (*Store) CreateHostWithID ¶
CreateHostWithID creates a host with a specific ID (used for sync import). The keyData should already be encrypted.
func (*Store) DeleteAllMountStates ¶
func (*Store) DeleteGroup ¶ added in v1.0.2
DeleteGroup tombstones a group and ungroups all hosts assigned to it.
func (*Store) DeleteMountState ¶
func (*Store) GetGroups ¶ added in v1.0.2
GetGroups returns all non-deleted groups (names only), ordered alphabetically.
func (*Store) GetGroupsForSync ¶ added in v1.0.2
func (s *Store) GetGroupsForSync(retention time.Duration) ([]GroupModel, error)
GetGroupsForSync returns groups including recent tombstones. Tombstones older than retention are excluded (they should be garbage-collected separately).
func (*Store) GetHostByID ¶ added in v1.0.5
GetHostByID returns one host by stable integer ID.
func (*Store) GetHostKey ¶
GetHostKey retrieves the decrypted private key for a host. Deprecated: use GetHostSecret when reading host auth secrets.
func (*Store) GetHostSecret ¶ added in v1.0.3
GetHostSecret retrieves decrypted key_data for a host. For key auth this is the private key; for password auth this is the stored password.
func (*Store) GetMountStates ¶
func (s *Store) GetMountStates() ([]MountState, error)
func (*Store) PurgeDeletedGroups ¶ added in v1.0.2
PurgeDeletedGroups permanently removes tombstoned groups older than the given age.
func (*Store) ReencryptKeyData ¶
func (s *Store) ReencryptKeyData(encryptedData string, sourceSaltHex string, password string) (string, error)
ReencryptKeyData decrypts key data using a source salt and re-encrypts with local salt. This is used during sync import when the source database had a different salt.
func (*Store) RenameGroup ¶ added in v1.0.2
RenameGroup renames a group and moves any hosts assigned to it. The old name is tombstoned so the deletion propagates via sync.
func (*Store) UpdateHost ¶
UpdateHost updates a host's metadata (without changing the key)
func (*Store) UpdateHostFromSync ¶
func (s *Store) UpdateHostFromSync(h *HostModel, encryptedKeyData string, updatedAt time.Time) error
UpdateHostFromSync updates a host with sync data, preserving exact timestamps. The keyData should already be encrypted.
func (*Store) UpdateHostWithKey ¶
UpdateHostWithKey updates a host including the encrypted key data
func (*Store) UpdateLastConnected ¶
UpdateLastConnected updates the last_connected timestamp for a host
func (*Store) UpsertGroup ¶ added in v1.0.2
UpsertGroup creates or revives a group, updating timestamps.
func (*Store) UpsertGroupFromSync ¶ added in v1.0.2
func (s *Store) UpsertGroupFromSync(name string, createdAt, updatedAt time.Time, deletedAt *time.Time) error
UpsertGroupFromSync applies group state from a sync payload, preserving timestamps. If deletedAt is non-nil, hosts assigned to the group are ungrouped (hosts updated_at is set to now).