clientstorage

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserdataBucket = "userdata"    // Key/value: specified below
	PreferencesKey = "preferences" // Value: Preferences
)

Bucketnames bbolt Note: crypto specific buckets should not clash with eachother!

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	Db *bbolt.DB
	// contains filtered or unexported fields
}

Storage provider for a Client

func NewStorage

func NewStorage(storagePath string, encryptionMiddleware encryption.EncryptionMiddleware) *Storage

func (*Storage) BucketExists

func (s *Storage) BucketExists(name []byte) bool

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) Decrypt

func (s *Storage) Decrypt(ciphertext []byte) ([]byte, error)

func (*Storage) DeleteAll

func (s *Storage) DeleteAll() error

func (*Storage) Encrypt

func (s *Storage) Encrypt(plaintext []byte) ([]byte, error)

func (*Storage) Load

func (s *Storage) Load(bucketName string, key string, dest any) (found bool, err error)

func (*Storage) LoadPreferences

func (s *Storage) LoadPreferences(defaultPreferences clientsettings.Preferences) (clientsettings.Preferences, error)

func (*Storage) Open

func (s *Storage) Open() error

Open initializes the credential storage, ensuring that it is in a usable state. Setting it up in a properly protected location (e.g., with automatic backups to iCloud/Google disabled) is the responsibility of the user.

func (*Storage) StorePreferences

func (s *Storage) StorePreferences(prefs clientsettings.Preferences) error

func (*Storage) Transaction

func (s *Storage) Transaction(f func(*Transaction) error) error

func (*Storage) TxDelete

func (s *Storage) TxDelete(tx *Transaction, bucketName string, key string) error

func (*Storage) TxDeleteAll

func (s *Storage) TxDeleteAll(tx *Transaction) error

func (*Storage) TxDeleteUserdata

func (s *Storage) TxDeleteUserdata(tx *Transaction) error

func (*Storage) TxLoad

func (s *Storage) TxLoad(tx *Transaction, bucketName string, key string, dest any) (found bool, err error)

func (*Storage) TxStore

func (s *Storage) TxStore(tx *Transaction, bucketName string, key string, value any) error

func (*Storage) TxStorePreferences

func (s *Storage) TxStorePreferences(tx *Transaction, prefs clientsettings.Preferences) error

type Transaction

type Transaction struct {
	*bbolt.Tx
}

Jump to

Keyboard shortcuts

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