Documentation
¶
Index ¶
- func DBPath() (string, error)
- func Delete() error
- func Exists() (bool, error)
- 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) DeleteHost(id int) error
- func (s *Store) DeleteMountState(hostID int) error
- func (s *Store) GetHostKey(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) ReencryptKeyData(encryptedData string, sourceSaltHex string, password string) (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) UpsertMountState(hostID int, localPath, remotePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HostModel ¶
type HostModel struct {
ID int
Label 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) DeleteMountState ¶
func (*Store) GetHostKey ¶
GetHostKey retrieves the decrypted private key for a host
func (*Store) GetMountStates ¶
func (s *Store) GetMountStates() ([]MountState, error)
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) 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