Skip to main content

vault_storage 6.0.0 copy "vault_storage: ^6.0.0" to clipboard
vault_storage: ^6.0.0 copied to clipboard

A package for secure key-value and file storage using Hive and flutter_secure_storage.

6.0.0 - 2026-11-16 #

Breaking changes #

This release has nine breaking changes. Each one has a migration step below.

  1. Removed the seven deprecated error aliases from lib/src/errors/storage_error.dart.
  2. VaultStorageConfig is now an immutable value passed to VaultStorage.create(config: ...). The five global setters are gone.
  3. VaultSecurityConfig.androidSigningCertHashes and threatCallbacks are no longer nullable. Both default to an empty collection.
  4. IVaultStorage is now an abstract interface class. Implementing it still works. Extending it from another library does not.
  5. freerasp moved from ^8.2.2 to ^9.0.0. Android builds now need the Talsec Gradle plugin, which needs Android Gradle Plugin 8.3 or newer. The plugin's Android namespace changed from com.aheaditec.freerasp to app.talsec.rasp.flutter.
  6. New UnsupportedPlatformError, a subtype of the sealed VaultStorageError. A switch over every error type must add a case. The web stubs now throw it where they threw UnsupportedError. On web, getFile used to surface this as a VaultStorageReadError. It now throws UnsupportedPlatformError.
  7. BoxConfig is now sealed. It cannot be extended or implemented outside this package.
  8. The boxes open as Box<Object?> and LazyBox<Object?>, not dynamic. Hive treats the two as different types.
  9. VaultStorage is now abstract final. implements VaultStorage and extends VaultStorage no longer compile. It only holds VaultStorage.create.

Migrating from 5.x #

Each heading names the item number from the list above.

1. Error aliases

Each alias had a Vault named replacement:

Old New
StorageError VaultStorageError
StorageInitializationError VaultStorageInitializationError
StorageReadError VaultStorageReadError
StorageWriteError VaultStorageWriteError
StorageDeleteError VaultStorageDeleteError
StorageDisposalError VaultStorageDisposalError
StorageSerializationError VaultStorageSerializationError

2. Performance thresholds

Old form:

VaultStorageConfig.jsonIsolateThreshold = 15000;
VaultStorageConfig.base64IsolateThreshold = 100000;
VaultStorageConfig.secureFileStreamingThresholdBytes = 1024 * 1024;
final storage = VaultStorage.create();

New form:

final storage = VaultStorage.create(
  config: const VaultStorageConfig(
    jsonIsolateThreshold: 15000,
    base64IsolateThreshold: 100000,
    secureFileStreamingThresholdBytes: 1024 * 1024,
  ),
);

3. Security config

Old form read the fields as nullable:

final hashes = config.androidSigningCertHashes ?? const [];
config.threatCallbacks?[SecurityThreat.jailbreak]?.call();

New form:

final hashes = config.androidSigningCertHashes;
config.threatCallbacks[SecurityThreat.jailbreak]?.call();

Passing null for either argument no longer compiles. Omit the argument to get the empty default.

4. Interface

Old form:

class MyStorage extends IVaultStorage { /* ... */ }

New form:

class MyStorage implements IVaultStorage { /* ... */ }

5. freerasp 9

  • Android: use Android Gradle Plugin 8.3 or newer in your app. The Talsec Gradle plugin, applied by freerasp, needs it.
  • Android: if your code, ProGuard rules or manifest name the old namespace com.aheaditec.freerasp, change it to app.talsec.rasp.flutter.
  • If your app also imports freerasp directly, read its 9.0.0 changelog. It renames AndroidConfig.signingCertHashes to certificateHashes and IOSConfig.bundleIds to appBundleIds, among others. VaultSecurityConfig keeps its own field names.

6. Unsupported platform error

Old form on web:

try {
  await storage.getFile('report');
} on VaultStorageReadError {
  // file access is not available
}

New form:

try {
  await storage.getFile('report');
} on UnsupportedPlatformError {
  // file access is not available
}

A switch over VaultStorageError must add a case, or the analyzer reports a missing case:

final label = switch (error) {
  // ... the existing cases
  UnsupportedPlatformError() => 'Not available on this platform',
};

7. BoxConfig

Replace any class that extends or implements BoxConfig with a BoxConfig(...) value, or a function that returns one.

8. Hive box types

Hive does not treat dynamic and Object? as the same type. Vault storage opens its boxes with Object?. Change app code that gets or opens one of those boxes, such as the default boxes or a custom box you registered:

// Before
final box = Hive.lazyBox<dynamic>('my_box');
// After
final box = Hive.lazyBox<Object?>('my_box');

The same applies to Hive.box<dynamic>, Hive.openBox<dynamic> and Hive.openLazyBox<dynamic>. If your app opens a box with a name that you also pass in customBoxes, open it as Object? before init(), or Hive throws The box is already open and of type .... hive_ce is now a development dependency of this package, so add it to your own pubspec.yaml if you import it.

9. VaultStorage

Use VaultStorage.create(...) to get an IVaultStorage. To fake the storage in tests, implement IVaultStorage, not VaultStorage:

class FakeStorage implements IVaultStorage { /* ... */ }

Fixed #

  • A streamed secure file of 2 MiB or more now reads back on web after its box reloads. In 5.x the read failed with a type error, because the chunk metadata came back with untyped nested maps.
  • Type mismatch and decode errors no longer put the stored value in the message or in the cause. Secure box values stayed out of logs only by luck before. The message now holds the key and the types.
  • getFile throws VaultStorageSerializationError, as in 5.x, for broken file metadata when it searches every box.

Maintenance #

  • Enforced the Flutter skill lint set in the package and the example, covered the RASP start and threat handling with tests, and moved example text to generated localizations.
  • Measured the performance tests in processor time instead of wall time.

5.0.1 - 2026-09-23 #

Dependencies #

  • Updated flutter_secure_storage to 11.2.0, freerasp to 8.2.2, and hive_ce to 2.20.0.
  • Updated development tools to build_runner 2.16.1 and stable freezed 4.0.2. Regenerating package models now requires Dart 3.13; consumer SDK requirements remain unchanged.
  • Updated the example to file_picker 13.1.0.

Maintenance and verification #

  • Refactored encrypted stream chunking and storage lookup without changing the public API or stored-data format.
  • Added Chrome download checks with source-mapped coverage for the web helper.
  • Added example interaction tests and explicit budgets for encrypted file I/O and consumer startup.
  • Updated Hard Eng and integrated its checks into CI while retaining the required release checks.

5.0.0 - 2026-08-21 #

Breaking changes #

  • Raised the minimum Dart SDK to 3.10 and Flutter to 3.38 so the package can use the latest stable dependencies.

Dependencies #

  • Updated hive_ce to 2.19.3, hive_ce_flutter to 2.3.4, path_provider to 2.1.6, uuid to 4.6.0, and build_runner to the latest version compatible with stable freezed.
  • Confirmed all other direct and development dependencies are already at their latest stable versions.
  • Regenerated the Freezed model output with the updated build toolchain.

Bug fixes #

  • Fixed streamed secure-file reads so chunk metadata no longer requires single-file nonce and MAC fields.
  • Fixed partial stream chunk slicing so unused buffer capacity cannot cause an infinite chunking loop.

CI and maintenance #

  • Updated actions/checkout to v7 and actions/cache to v6.
  • Added current Flutter platform exclusions to analysis_options.yaml so analysis is read-only and repeatable.
  • Applied the Dart 3.13 formatter to source, example, and test files so the current CI format check passes.
  • Added the repository's deterministic Dart analysis, test, and dead-code check definitions.
  • Kept GitHub workflows and other repository-only files out of the published package archive.
  • Split storage and security helpers out of the main implementation file without changing the public API.
  • Removed obsolete performance plans, completion notes, Codex memory files, Copilot instructions, and an unused empty npm lockfile.

4.0.4 - 2026-08-16 #

Maintenance #

  • Updated flutter_secure_storage to 11.0.0.
  • Updated the example app's file_picker constraint for compatibility with the new Windows storage plugin.

4.0.3 - 2026-08-16 #

Maintenance #

  • Updated freerasp to 8.2.1.
  • Awaited asynchronous base64 decoding in storage paths so the current Flutter analyzer remains clean.

4.0.2 - 2026-05-27 #

Maintenance #

  • Internal adapter registration — VaultStorage.create() now registers vault_storage's Hive adapters synchronously, keeping Hive and adapter internals behind package:vault_storage/vault_storage.dart.
  • Dependency updates — Updated flutter_secure_storage, freerasp, json_annotation, build_runner, and mocktail to their latest compatible versions.
  • Code generation refresh — Regenerated Freezed output with the updated generator toolchain.

4.0.1 - 2026-03-24 #

Bug Fixes #

  • Fixed StoredValueAdapter typeId conflict with hive_ce_flutter — Changed StoredValueAdapter.typeId from 200 to 220. hive_ce_flutter v2.3.4's ColorAdapter defaults to typeId 200, which caused Hive.initFlutter() (called internally by vault_storage) to register ColorAdapter at typeId 200 first. The subsequent _registerAdapters() guard (Hive.isAdapterRegistered(200)) then found the slot taken and silently skipped registering StoredValueAdapter. Any write using the v4 TypeAdapter format would crash with HiveError: Cannot write, unknown type: StoredValue. Since v4.0.0 had this bug from day one, no existing data was ever written in v4 TypeAdapter format — the typeId change is safe for all upgrading users.

4.0.0 - 2026-02-27 #

Breaking changes #

  • Binary TypeAdapter storage — All key-value writes now use a custom Hive TypeAdapter for StoredValue (typeId 200) instead of the previous Map<String, dynamic> wrapper. Per-entry overhead drops from ~36 bytes to 2 bytes and one fewer Map allocation per read/write.
  • Downgrade not supported — Keys written by v4.x cannot be read by v3.x. Upgrade is one-way. All v2.x and v3.x data remains readable by v4.x via existing fallback paths.

Performance improvements #

  • Key-value reads/writes ~30–50% faster — Eliminated Map allocation, two string key lookups, and Map.containsKey calls on every read/write path (all boxes, including custom boxes).
  • Web file content stored as Uint8List — Encrypted and normal file bytes are written to Hive directly instead of base64-encoded strings. Removes one encode + one decode per web file save/retrieve.
  • File metadata stored as binary Map — saveSecureFile and saveNormalFile now use the TypeAdapter path instead of encodeJsonSafely + raw put. Eliminates JSON serialisation round-trip for file metadata on every save.
  • WASM int warning fixed — The old Map wrapper stored {__VST_STRATEGY__: 0}, an int inside a Map, triggering hive_ce v2.9.0's WASM integer warning. The TypeAdapter uses writeByte for the strategy index, which avoids this.

Migration #

  • No data migration required. v4.x reads all existing v2.x (JSON string) and v3.x (Map-wrapped) formats automatically.
  • Web apps: old base64 file content (String) is decoded on read; new files are stored as Uint8List. Both formats coexist indefinitely.

3.1.0 - 2026-02-19 #

API #

  • Rename StorageError → VaultStorageError - Prefixes all error classes with VaultStorage to prevent name collisions. Old names stay as deprecated typedefs until v4.0.0, existing catch blocks and type checks keep working.

Bug Fixes #

  • fix: Init re-entrancy - Use Future memoization instead of Completer to prevent duplicate init() emissions
  • fix: clearAll custom box ordering - Clear custom boxes before the includeFiles=false early return
  • fix: clearNormal/clearSecure rethrow - Rethrow VaultStorageError directly instead of double-wrapping
  • fix: keys() custom boxes - Include custom box keys in results
  • fix: dispose in-flight init - Await and nullify in-flight init before cleanup
  • fix: getFileMetadata rethrow - Rethrow VaultStorageError instead of wrapping in VaultStorageReadError
  • fix: file_operations rethrow guards - Rethrow VaultStorageError in saveSecureFile, saveSecureFileStream, saveNormalFile
  • fix: Barrel export path - Point errors export to errors.dart barrel
  • fix: Doc example - Remove non-existent named parameters from init() call

CI & Automation #

  • ci: Publish workflow - OIDC-based auto-publish to pub.dev on tag push (no stored secrets)
  • ci: Auto-tagging - Create version tags automatically after merge to main
  • ci: Dependabot auto-merge - Auto-merge dependency PRs after CI passes
  • ci: Action upgrades - actions/cache v3 → v4, remove Codecov, consolidate PANA into single step
  • ci: Branch protection - Require all CI checks on main; admin can bypass

CHANGELOG #

  • Add missing entries for v2.3.0, v2.3.1, and v1.2.0
  • Fix broken markdown between v2.2.0 and v2.1.2 entries

Testing #

  • Add 84 tests covering all bug fixes (402 total, all passing)
  • Improve coverage: vault_storage_impl.dart 53.7% → 69.2%, storage_error.dart → 100%, overall 63.8% → 69.3%

3.0.1 - 2026-01-15 #

Upgrade Dependencies #

  • upgraded all dependencies to latest versions for improved security and performance

3.0.0 - 2025-11-23 #

Major Performance Upgrade #

20-50x faster for Lists and Maps! This release dramatically improves storage performance for common data types.

What's New #

  • Lists and Maps now use native Hive storage instead of JSON encoding
  • Reading 40 items: 1000ms → 20ms (50x improvement)
  • Writing 40 items: 800ms → 25ms (32x improvement)
  • Automatic format detection - no code changes needed

Backward Compatibility #

  • Zero breaking changes - your existing code works as-is
  • Reads old data - v2.x data continues to work
  • Automatic migration - data updates to new format when rewritten
  • No downgrade - cannot rollback to v2.x after upgrade

Who Benefits #

  • Apps storing API responses, cached data, or user preferences
  • Frequent read/write operations with Lists/Maps
  • Performance-critical applications

2.3.4 - 2025-10-23 #

Documentation Fixes #

  • docs: Fixed BoxConfig parameter name - Corrected README example showing isSecure parameter instead of correct encrypted parameter

2.3.3 - 2025-10-22 #

Documentation Fixes #

  • docs: Corrected Windows storage mechanism - Fixed incorrect references to Windows Credential Manager. Windows actually uses DPAPI (Data Protection API) with file-based storage at %APPDATA%\<app_name>\flutter_secure_storage.dat
  • docs: Added storage location debug feature - Example app now includes "Show Storage Location" button to help users verify where encryption keys are stored
  • docs: Updated README Windows section - Clarified that encryption key is stored in encrypted file, not Windows Credential Manager

Breaking Documentation Changes #

  • Previous documentation incorrectly stated Windows uses Credential Manager
  • Actual implementation uses DPAPI file encryption (this was always the case, only docs were wrong)

2.3.2 - 2025-10-22 #

New Features #

  • feat: Custom box support - Create and manage multiple custom storage boxes with independent security configurations
  • feat: Box isolation - Each custom box maintains separate encryption and storage, enabling multi-tenancy and data segregation
  • feat: Dynamic box management - Add custom boxes at initialization with flexible configuration options
  • feat: BoxConfig entity - Immutable configuration with Freezed for type-safe box definitions

API Enhancements #

  • feat: Enhanced create() factory - Added optional customBoxes parameter to define additional storage boxes at creation
  • feat: Box parameter in storage methods - All storage methods now accept optional box parameter to target specific custom boxes
  • feat: Factory method parameters - VaultStorage.create() now supports customBoxes and storageDirectory parameters

Documentation Updates #

  • docs: Custom boxes usage guide - Comprehensive examples for multi-tenant and isolated storage scenarios
  • docs: BoxConfig examples - Configuration patterns for secure and normal custom boxes
  • docs: Migration examples - Clear guidance for adopting custom boxes in existing applications

Testing Improvements #

  • test: Custom box comprehensive tests - Full test coverage for custom box operations
  • test: Box isolation validation - Ensure data segregation between boxes
  • test: BoxConfig entity tests - Verify immutability and equality behavior

Use Cases #

  • Multi-tenant applications: Separate storage per user or organization
  • Feature isolation: Independent storage for different app features
  • Data categorization: Organize data by type, sensitivity, or lifecycle
  • Workspace management: Multiple workspaces with isolated data

Backward Compatibility #

  • No breaking changes - Custom boxes are completely optional
  • Default behavior unchanged - Existing code works without modification
  • Gradual migration - Add custom boxes incrementally as needed

2.3.1 - 2025-10-22 #

Internal #

  • ci: Version consistency check - CI verifies pubspec.yaml and CHANGELOG.md versions match on push/PR
  • docs: CHANGELOG formatting - Normalize section headings, remove duplicate version lines

2.3.0 - 2025-10-22 #

New Features #

  • feat: Custom box support - Multiple storage boxes with independent encryption (see 2.3.2 for full notes)
  • feat: Box isolation - Separate encryption and storage per box
  • feat: BoxConfig entity - Freezed-based immutable box configuration
  • feat: Enhanced create() factory - Accept customBoxes parameter

2.2.2 - 2025-10-13 #

Dependency Updates #

  • chore: Upgrade freerasp - Updated from ^7.2.1 to ^7.2.2 for latest security improvements and bug fixes
  • chore: Upgrade hive_ce - Updated from ^2.13.2 to ^2.15.0 for improved performance and stability

2.2.1 - 2025-09-21 #

Web Compatibility Improvements #

  • fix: Add WASM compatibility - Implemented conditional imports for FreeRASP to ensure package works in WASM runtime
  • feat: FreeRASP mock implementation - Added comprehensive mock for FreeRASP on unsupported platforms (Web, Windows, Linux, macOS)
  • improvement: Cross-platform stability - Package now gracefully handles FreeRASP dependency across all platforms without breaking WASM compatibility

Technical Improvements #

  • refactor: Conditional imports for security features - FreeRASP is only imported when dart.library.io is available
  • docs: Updated platform compatibility notes - Clarified that security features work seamlessly across all platforms with automatic fallback

2.2.0 - 2025-09-21 #

New Security Features #

  • feat: Optional jailbreak protection with FreeRASP integration - Add runtime security monitoring to protect your app and user data
  • feat: Comprehensive threat detection - Detect jailbreak/root, app tampering, debugging, hooking frameworks, emulators, and more
  • feat: Flexible security configuration - Three modes: development, production, and custom configurations
  • feat: Custom threat callbacks - Handle each security threat with your own custom logic
  • feat: Granular blocking controls - Choose which threats should block vault operations vs. just log/notify
  • feat: Security monitoring integration - Optional integration with FreeRASP's monitoring dashboard
  • feat: Cross-platform compatibility - Security features work on Android and iOS; gracefully ignored on other platforms

Platform Support #

  • important: Security features only available on Android and iOS - FreeRASP integration requires mobile platforms
  • feat: Automatic platform detection - Security initialization is skipped on unsupported platforms (macOS, Windows, Linux, Web)
  • feat: Unified codebase - Same code works across all platforms without conditional logic

API Enhancements #

  • feat: Enhanced init() method - Added optional parameters for platform-specific security configuration
  • feat: New security exceptions - Typed exceptions for different security threats (JailbreakDetectedException, TamperingDetectedException, etc.)
  • feat: VaultSecurityConfig class - Comprehensive configuration for security features with development/production presets
  • feat: Master encryption key deletion on clearAll() - The clearAll() method now deletes the master encryption key from secure storage when includeFiles=true (default), providing a complete security wipe that forces key regeneration on next initialization

Documentation Updates #

  • docs: Comprehensive security features documentation - Complete guide to using security features
  • docs: Security configuration examples - Development, production, and custom configuration examples
  • docs: Platform-specific setup requirements - Updated Android and iOS setup for security features
  • docs: Security best practices - Guidelines for testing and deploying secure apps
  • docs: Certificate generation guide - How to obtain Android signing certificate hashes
  • docs: Platform compatibility clarification - Clear documentation that security features only work on Android and iOS

Testing Improvements #

  • test: Security configuration unit tests - Comprehensive test suite for VaultSecurityConfig
  • test: Security exception tests - Tests for all security-related exceptions
  • test: Threat callback testing - Verify custom callback functionality
  • test: Platform detection testing - Ensure security features are properly skipped on unsupported platforms

Dependencies #

  • feat: Add freerasp ^7.2.1 - Optional dependency for runtime application self-protection

Backward Compatibility #

  • No breaking changes - Security features are completely optional
  • Graceful fallback - Apps work exactly as before when security is not enabled
  • Optional dependency - FreeRASP only used when security features are enabled
  • Cross-platform support - Same code works on all platforms without modification

🚀 Usage Examples #

Basic usage (no security)

final storage = VaultStorage.create();
await storage.init();

With security features

final storage = VaultStorage.create(
  securityConfig: VaultSecurityConfig.production(
    watcherMail: 'security@mycompany.com',
    androidPackageName: 'com.mycompany.myapp',
    androidSigningCertHashes: ['your_cert_hash'],
    iosBundleId: 'com.mycompany.myapp',
    iosTeamId: 'YOUR_TEAM_ID',
  ),
);
// Security features will only be active on Android and iOS
await storage.init();

2.1.2 - 2025-08-15 #

Documentation improvements #

  • docs: Enhanced macOS setup documentation with complete entitlement files and codesigning requirements
  • docs: Added comprehensive troubleshooting steps for StorageInitializationError on macOS
  • docs: Included detailed entitlement configurations for both DebugProfile and Release builds
  • docs: Added step-by-step codesigning setup instructions in Xcode
  • docs: Clarified why keychain access and codesigning are required for VaultStorage initialization

2.1.1 - 2025-08-11 #

Web compatibility and quality #

  • fix: Remove dart:isolate from the public import graph and use compute from flutter/foundation, enabling web platform detection on pub.dev.
  • fix: Use conditional imports that default to web-safe stubs and import dart:io only behind dart.library.io.
  • chore: Add explicit platforms: section in pubspec.yaml to declare support for Android, iOS, Linux, macOS, Web, and Windows.
  • chore: Add IO stubs in web mocks to satisfy analyzer for conditional imports.
  • fix: Address analyzer warnings (avoid await on synchronous containsKey).

2.1.0 - 2025-08-10 #

New Features #

  • feat: Add clearAll({bool includeFiles = true}) to wipe both key-value and file storage in one call
  • feat: Extend clearNormal() and clearSecure() with includeFiles (default false) to optionally delete underlying files and file metadata for the respective storage

Internal #

  • refactor: Consolidate file-clearing logic into clearAllFilesInBox(...) with @visibleForTesting for easier testing
  • test: Add coverage for clearAll, and includeFiles behavior in clearNormal and clearSecure

2.0.0 - 2025-08-08 #

This release delivers a simpler, clearer API and improved performance characteristics. It replaces the BoxType/Either-based surface with intent-driven methods and exception-based error handling. File APIs are simplified to use your own keys instead of passing metadata around.

Breaking Changes #

  • API surface reworked for simplicity:
    • Removed: set(BoxType, key, value) and get<T>(BoxType, key) in favor of intent-specific methods
    • Added: saveSecure, saveNormal, get<T>(key, {bool? isSecure}), delete(key), clearNormal(), clearSecure()
    • File retrieval unified: getFile(key, {bool? isSecure}) (replaces passing metadata to getSecureFile/getNormalFile)
    • File deletion unified: deleteFile(key)
  • Error handling model:
    • Removed: Either<StorageError, T> return style
    • Added: Methods now throw StorageError subclasses (StorageInitializationError, StorageReadError, StorageWriteError, StorageDeleteError, StorageDisposalError, StorageSerializationError)
  • Web file retrieval
    • Custom download filenames are no longer configurable via public API; sensible filenames are generated automatically based on stored extension

New Features #

  • Simplified key-value API with smart lookup order (normal first, then secure) when isSecure is not specified
  • Secure and normal file storage keyed by your own identifiers; implementation tracks metadata internally
  • Large-file encryption streaming for secure files (chunked AES-GCM) to reduce memory pressure
  • Performance configuration via VaultStorageConfig with thresholds for JSON/base64 isolate usage and secure file streaming
  • More aggressive Hive compaction strategy for better on-disk efficiency
  • New: keys({bool includeFiles = true, bool? isSecure}) API to list stored keys (unique and sorted). The example app now loads keys on startup so they persist across restarts.

Web Platform Behavior #

  • Auto-downloads when calling getFile() on web; returns Uint8List and triggers browser download with a smart filename
  • MIME type inference from file extension for better browser handling

Internal Improvements #

  • Consistent use of isolates for heavy crypto, JSON encode/decode, and base64 encode/decode
  • Clear separation of responsibilities: IVaultStorage (interface) and VaultStorageImpl (implementation), with VaultStorage.create() factory
  • File operations abstracted behind IFileOperations for testability

Migration Notes #

  1. Initialization and errors

    • Before: await storage.init() returned Either; handled with .fold()
  • After: await storage.init() throws on failure. Use try/catch around initialization and calls.
  1. Key-value operations

    • Replace set(BoxType.secure, 'k', 'v') with saveSecure(key: 'k', value: 'v')
  • Replace set(BoxType.normal, 'k', 'v') with saveNormal(key: 'k', value: 'v')
  • Replace get<T>(BoxType.secure, 'k') with get<T>('k', isSecure: true)
  • Replace get<T>(BoxType.normal, 'k') with get<T>('k', isSecure: false)
  • Delete both: delete('k'); clear with clearNormal() / clearSecure()
  1. File storage

    • Replace metadata-based retrieval (getSecureFile(fileMetadata: ...)) with key-based retrieval: getFile('myKey')
  • Saving files now requires a key: saveSecureFile(key: 'myKey', fileBytes: ..., originalFileName: 'x.jpg')
  • Delete with deleteFile('myKey')
  • Web downloads still occur automatically on retrieval; custom filenames are not exposed

Refer to the README Migration Guide for full examples.

1.2.1 - 2025-07-13 #

New Features #

  • feat: Automatic file downloads on web platforms - getSecureFile() and getNormalFile() now automatically trigger downloads in web browsers while maintaining native platform behavior
  • feat: Custom download filenames - Added optional downloadFileName parameter to file retrieval methods for custom web download names
  • feat: Smart filename generation - Automatically generates appropriate filenames using stored file extensions (e.g., document.pdf, image.jpg)
  • feat: MIME type detection - Automatic MIME type detection for 15+ common file formats ensures proper browser handling

Technical Improvements #

  • feat: Modern web standards - Migrated from deprecated dart:html to modern package:web APIs for future WebAssembly (Wasm) compatibility
  • feat: Enhanced metadata storage - File extensions are now stored in metadata for both secure and normal files
  • feat: Conditional imports optimization - Updated to use dart.library.js_interop for better web/native platform detection

Documentation Updates #

  • docs: Enhanced README with web download examples - Added comprehensive examples showing platform-specific behavior
  • docs: Platform behavior comparison table - Clear documentation of differences between web and native platforms
  • docs: MIME type support documentation - Listed all supported file types and their automatic MIME type mappings

🔄 Backward Compatibility #

  • No breaking changes - All existing code continues to work without modifications
  • Optional parameters - New features use optional parameters to maintain API compatibility
  • Same return types - Methods still return Either<StorageError, Uint8List> as before

Web Platform Enhancements #

  • Web downloads: Files automatically download when retrieved on web platforms
  • Smart filenames: Uses original file extensions for meaningful download names
  • MIME type support: PDF, images, documents, audio, video, and more
  • Custom naming: Optional custom filenames for downloads

Dependencies #

  • Added: web: ^1.1.1 for modern web API access

1.2.0 - 2025-07-13 #

New Features #

  • feat: Web file downloads - Auto-download files on web platforms
  • feat: Modern web APIs - Migrate from dart:html to package:web for WASM compatibility
  • feat: File extension metadata - Store extensions in metadata for filename generation

1.1.0 - 2025-07-05 #

Bug Fixes #

  • fix: Android compilation issues - Fixed Android build failures by migrating from unmaintained cryptography package to actively maintained cryptography_plus
  • fix: AGP 8.x compatibility - Resolved Android Gradle Plugin 8.x compatibility issues that prevented compilation on newer Android projects

Dependency Updates #

  • feat: Replace cryptography with cryptography_plus - Migrated from cryptography: ^2.7.0 to cryptography_plus: ^2.7.1 to ensure ongoing maintenance and Android compatibility
  • feat: Upgrade flutter_secure_storage - Updated from ^9.2.4 to ^10.0.0-beta.4 for latest security improvements and bug fixes

Migration Notes #

  • Automatic migration: No code changes required - the package handles the cryptography library migration internally
  • Android compatibility: Projects that previously failed to compile on Android with AGP 8.x will now work correctly
  • Breaking changes: None for end users - all public APIs remain the same

1.0.1 - 2025-06-27 #

Documentation Improvements #

  • docs: Fix incorrect parameter name in README.md - Corrected metadata: to fileMetadata: in getSecureFile method example
  • docs: Fix version inconsistencies - Updated all version references from ^0.1.1 to ^1.0.0 to match current package version
  • docs: Fix Riverpod integration example - Corrected error handling in main.dart to use try-catch instead of incorrect .fold() usage
  • docs: Fix syntax errors - Removed duplicate closing braces and fixed code formatting issues

Technical Fixes #

  • fix: Correct API usage examples - All code examples now use the correct method signatures and parameter names
  • fix: Improve error handling patterns - Better distinction between functional error handling (Either) and exception-based error handling (try-catch)

1.0.0 - 2025-06-26 #

Breaking Changes #

  • BREAKING: Remove built-in Riverpod provider - The package no longer includes a built-in Riverpod provider to remain framework-agnostic
  • BREAKING: Hide implementation details - Use VaultStorage.create() factory method instead
  • feat: Framework-agnostic design - Users can now integrate with any state management solution or use the service directly

New Features #

  • feat: Add VaultStorage.create() factory method - Clean API that returns IVaultStorage interface, hiding implementation details
  • feat: Improved API design - Only the interface (IVaultStorage) is exposed to users, making the API cleaner and less confusing

Documentation Improvements #

  • docs: Add comprehensive state management integration examples - Includes examples for Riverpod and direct usage
  • docs: Update initialisation examples - Show how to initialise the service without Riverpod dependency
  • docs: Clarify framework-agnostic approach - Emphasise that the package works with any state management solution
  • docs: Update all examples to use factory method - Consistent API usage throughout documentation

Migration Guide #

From built-in Riverpod provider: If you were using the built-in vaultStorageProvider, you can easily recreate it in your own project:

  1. Add Riverpod dependencies to your pubspec.yaml
  2. Create your own provider file following the examples in the README
  3. Update your initialisation code to use your custom provider

From VaultStorageImpl(): Replace direct instantiation with the factory method:

// Before
final storage = VaultStorageImpl();

// After
final storage = VaultStorage.create();This change makes the package more flexible, reduces its dependency footprint, and provides a cleaner API.

0.1.1 - 2025-06-24 #

  • refactor: Remove export of unused storage_keys constant from vault_storage.dart
  • chore: Update build_runner dependency to version 2.5.4 in pubspec.yaml
  • chore: Update _fe_analyzer_shared and analyzer versions in pubspec.lock
  • test: Refactor error handling tests to use async/await for improved readability

0.1.0 - 2025-06-22 #

Features #

  • feat: Add support for normal file storage - Complete implementation with save, retrieve, and delete functionalities
  • feat: Add JsonSafe utility - Safe JSON encoding and decoding with comprehensive error handling
  • feat: Enhance storage functionality - New task execution system with improved error handling architecture

Core Improvements #

  • feat: Add safe JSON encoding and decoding extensions - Improved error handling for JSON operations
  • feat: Implement normal file storage - Full file storage capabilities with proper error handling
  • feat: Improve error handling during storage initialisation - Detailed error display and better user feedback

Testing & Quality #

  • test: Add comprehensive unit tests for VaultStorage service lifecycle - Complete lifecycle management testing
  • test: Add TaskExecutor mock for testing - Enhanced testing capabilities for task execution logic
  • test: Implement comprehensive StorageError class tests - Ensures proper error handling across the package
  • test: Add tests for FileOperations and Encryption Helpers - Validates core functionality with thorough coverage
  • test: Update VaultStorageImpl tests - Utilise new extensions for JSON operations
  • refactor: Remove outdated test files - Streamlined test suite by removing vault_storage_impl_test.dart
  • refactor: Consolidate storage keys tests - Improved test organisation

Documentation & Examples #

  • docs: Add comprehensive use cases section - Healthcare, financial, enterprise, and consumer app examples
  • docs: Add production use disclaimers - Important security and legal considerations for production apps
  • docs: Add platform setup requirements - Detailed setup instructions for all supported platforms
  • docs: Enhance troubleshooting section - Common issues and solutions for initialisation problems
  • example: Improve error handling in example app - Better error display and recovery mechanisms

Security & Compliance #

  • security: Add production use disclaimers - Clear security limitations and audit requirements
  • platform: Add macOS entitlements documentation - Required keychain access setup for macOS apps

0.0.4 - 2025-06-20 #

  • refactor: Rename storageService to vaultStorage for consistency in README and tests
  • chore: Update README for web compatibility and usage improvements
  • docs: Clarify Riverpod dev version requirement and that generated files are included
  • docs: Improve code examples and error handling documentation
  • docs: Add comprehensive usage examples for both key-value and secure file storage

0.0.3 - 2025-06-19 #

  • fix: Update conditional imports for web compatibility in vault_storage_impl.dart, from dart.library.html to dart.library.js_interop

0.0.2 - 2025-06-18 #

  • Added web compatibility for vault_storage package.
  • Enhanced storage capabilities:
    • Added secure file storage with new Hive box.
    • Updated BoxType enum to support secure file storage.
    • Implemented platform-specific file storage handling.
  • Improved error handling:
    • Added disposal error handling to IVaultStorage interface.
    • Enhanced error handling throughout the package.
  • Added example project with pubspec.yaml demonstrating package usage.
  • Code improvements:
    • Better formatting and code consistency.
    • Cleaned up unused code in test files.
    • Refactored implementation for better maintainability.

0.0.1 - 2025-06-17 #

  • Initial release of the vault_storage package.
  • Provides secure key-value and file storage using Hive and flutter_secure_storage.
  • Features include:
    • Dual storage model for key-value pairs and file blobs.
    • AES-GCM encryption for all sensitive data.
    • Cryptographic operations offloaded to background isolates.
    • Type-safe error handling with fpdart.
    • Riverpod provider for easy dependency injection.
8
likes
160
points
314
downloads

Documentation

API reference

Publisher

verified publisherafenso.com

Weekly Downloads

A package for secure key-value and file storage using Hive and flutter_secure_storage.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

cryptography_plus, flutter, flutter_secure_storage, freerasp, freezed_annotation, hive_ce_flutter, json_annotation, path_provider, uuid, web

More

Packages that depend on vault_storage