Documentation
¶
Index ¶
- Variables
- type Config
- type EncryptedBlob
- type KeychainConfig
- type Store
- func (s *Store) Close() error
- func (s *Store) DB() *sql.DB
- func (s *Store) Decrypt(_ context.Context, blob EncryptedBlob, aad []byte) ([]byte, error)
- func (s *Store) DecryptJSON(ctx context.Context, blob EncryptedBlob) ([]byte, error)
- func (s *Store) Encrypt(_ context.Context, plaintext, aad []byte) (*EncryptedBlob, error)
- func (s *Store) EncryptJSON(ctx context.Context, rawJSON []byte) (*EncryptedBlob, error)
- func (s *Store) RotateKey(_ context.Context) (int, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrKeyNotFound = errors.New("encryption key not found") ErrInvalidCiphertext = errors.New("invalid ciphertext") ErrUnsupportedKeyVersion = errors.New("unsupported key version") ErrInvalidConfig = errors.New("invalid config") // ErrKeyAlreadyExists is returned when storeKeyVersion would overwrite an // existing keychain entry for the same service/account. Overwriting silently // would orphan every row already encrypted under the existing key. ErrKeyAlreadyExists = errors.New("encryption key already exists in keychain") // ErrInconsistentKeyState is returned when the database has no active-key // metadata but the keychain already holds a key for the default version. // This signals the db metadata and keychain have diverged (e.g. a restored // or partially-migrated database) — minting a fresh key here would silently // overwrite the real one and orphan everything encrypted under it. ErrInconsistentKeyState = errors.New("encryption key metadata is inconsistent with keychain") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DBPath string
Keychain KeychainConfig
}
Config is the top-level configuration for opening a Store.
type EncryptedBlob ¶
EncryptedBlob holds the output of a single encryption operation.
type KeychainConfig ¶
KeychainConfig identifies the OS keychain entry used to store the master key.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the main entry point for encrypted SQLite access.
func OpenWithKeyring ¶
OpenWithKeyring opens the store using the provided Keyring — intended for tests.
func (*Store) DecryptJSON ¶
DecryptJSON is a convenience wrapper for JSON payloads with no AAD.
func (*Store) EncryptJSON ¶
EncryptJSON is a convenience wrapper for JSON payloads with no AAD.
Click to show internal directories.
Click to hide internal directories.