just_storage 1.0.0
just_storage: ^1.0.0 copied to clipboard
Standard and secure key-value storage with typed helpers and reactive streams.
1.0.0 - 2026-02-23 #
Added #
-
JustStandardStorage— abstract interface for non-sensitive key-value storage.read,write,delete,clear,containsKeyreadAll()— returns all key-value pairs as an unmodifiable mapreadJson<T>/writeJson<T>typed JSON helperswatch(key)— reactive broadcast stream (emits current value on subscription, then every subsequent change)
-
JustSecureStorage— abstract interface for encrypted key-value storage.- Same read/write/delete/clear/containsKey/readAll/JSON/watch surface as
JustStandardStorage
- Same read/write/delete/clear/containsKey/readAll/JSON/watch surface as
-
JustStorage— factory class for obtaining storage instances.JustStorage.standard([Directory?])→Future<JustStandardStorage>— returns aFileStorageinstance backed by the platform's application support directory.JustStorage.encrypted([Directory?])→Future<JustSecureStorage>— returns anEncryptedFileStorageinstance backed by the platform's application support directory.- Both methods accept an optional
Directoryoverride for testing.
-
FileStorage—JustStandardStorageimplementation backed bydart:io.- Persists to
<directory>/just_storage.json - Atomic writes via rename-swap (
<name>.tmp→ target) - In-memory cache; lazy initialisation on first use
StreamController.broadcast(sync: true)per key for zero-latencywatch()delivery
- Persists to
-
EncryptedFileStorage—JustSecureStorageimplementation backed bydart:io+ AES-256-GCM.- Persists to
<directory>/just_secure_storage.enc - AES-256-GCM via
pointycastle— authenticated encryption; any tampered byte causesStorageException - Per-value random 12-byte nonce (fresh on every
write) — nonce reuse is prevented by design - Master key (
StorageKeyManager) auto-generated withRandom.secure(), stored at<directory>/.storage.keywithchmod 600on POSIX - Atomic writes via rename-swap
- Buffered, causally-ordered
watch()stream
- Persists to
-
StorageKeyManager— manages the 256-bit AES master key lifecycle.- Generates and persists the key on first use
- Validates key file size on load (throws
StorageExceptionon corruption) destroy()— secure key wipe for full data-erasure scenarios
-
AesGcmCipher— thin, tested wrapper overpointycastle'sGCMBlockCipher(AESEngine()).encrypt(key, nonce, plaintext)→ciphertext || 16-byte GCM tagdecrypt(key, nonce, ciphertextWithTag)→ plaintext, or throwsStorageExceptionon tag failureAesGcmCipher.randomNonce()— generates a cryptographically-random 12-byte nonce
-
StorageException— typed exception wrapping underlying errors withmessageand optionalcause.
Dependencies #
path_provider: ^2.1.2— resolves the app-private support directorypointycastle: ^3.7.3— AES-256-GCM cryptographic primitives