crossvault 1.0.1 copy "crossvault: ^1.0.1" to clipboard
crossvault: ^1.0.1 copied to clipboard

Secure cross-platform vault for Flutter using native storage (iOS Keychain, Android Keystore, Windows Credential Manager). Supports iCloud sync, Auto Backup, and TPM.

Crossvault Logo

Crossvault #

Secure cross-platform vault for Flutter

pub package License: MIT

A unified API for secure storage across Android, iOS, macOS, and Windows.


πŸ“¦ Packages #

This repository contains multiple packages that work together to provide a federated plugin architecture:

Package Description Version
crossvault The main app-facing package 1.0.0
crossvault_platform_interface Common platform interface 1.0.0
crossvault_android Android implementation 1.0.0
crossvault_ios iOS implementation 1.0.0
crossvault_macos macOS implementation 1.0.0
crossvault_windows Windows implementation 1.0.0

✨ Features #

  • πŸ” Secure Storage: Platform-native secure storage mechanisms
    • iOS/macOS: Keychain Services with Secure Enclave
    • Android: EncryptedSharedPreferences with Keystore
    • Windows: Credential Manager with DPAPI
  • πŸ›‘οΈ Hardware Security: Optional hardware-backed encryption
    • iOS/macOS: Secure Enclave (always)
    • Android: TEE/SE/StrongBox (when available)
    • Windows: TPM (Trusted Platform Module) - optional
  • πŸ”„ Cross-platform API: Unified API across all platforms
  • 🎯 Type-safe Configuration: Platform-specific options with type safety
  • 🌐 Keychain Sharing: iOS/macOS support for sharing data between apps
  • ☁️ iCloud Sync: Real-time iCloud Keychain synchronization (iOS/macOS)
  • πŸ“¦ Auto Backup: Automatic backup to Google Drive (Android)
  • πŸ—οΈ Federated Architecture: Clean separation of platform implementations

πŸš€ Quick Start #

Installation #

Add crossvault to your pubspec.yaml:

dependencies:
  crossvault: ^1.0.0

Basic Usage #

import 'package:crossvault/crossvault.dart';

final crossvault = Crossvault();

// Store a value
await crossvault.setValue('api_token', 'secret_value');

// Retrieve a value
final token = await crossvault.getValue('api_token');
print('Token: $token');

// Check if key exists
final exists = await crossvault.existsKey('api_token');

// Delete a value
await crossvault.deleteValue('api_token');

// Delete all values
await crossvault.deleteAll();

Initialize Crossvault once at app startup with settings for all platforms:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Configure all platforms at once
  await Crossvault.init(
    config: CrossvaultConfig(
      ios: IOSOptions(
        accessGroup: 'io.alexmelnyk.crossvault.shared',
        synchronizable: true,  // Enable iCloud Keychain sync
        accessibility: IOSAccessibility.afterFirstUnlock,
      ),
      macos: MacOSOptions(
        accessGroup: 'io.alexmelnyk.crossvault.shared',
        synchronizable: true,  // Enable iCloud Keychain sync
        accessibility: MacOSAccessibility.afterFirstUnlock,
      ),
      android: AndroidOptions(
        sharedPreferencesName: 'my_secure_prefs',
        resetOnError: true,  // Auto-reset on decryption error
      ),
      windows: WindowsOptions(
        prefix: 'crossvault',
        persist: WindowsPersist.localMachine,
      ),
    ),
  );
  
  runApp(MyApp());
}

// Now use Crossvault anywhere - it automatically uses the right platform config
final crossvault = Crossvault();
await crossvault.setValue('key', 'value');  // Uses platform-specific config

Note: Configure iCloud for iOS/macOS and Auto Backup for Android. See setup guides below.

Per-Method Configuration #

Override global configuration for specific operations:

// Global config is used by default
await crossvault.setValue('normal_key', 'value');

// Override for specific operation
await crossvault.setValue(
  'temp_key',
  'temp_value',
  options: IOSOptions(
    synchronizable: false,  // Don't sync this one
  ),
);

πŸ—οΈ Architecture #

This plugin follows Flutter's federated plugin architecture, which provides:

  • Separation of concerns: Each platform has its own package
  • Independent versioning: Platform implementations can be updated independently
  • Better maintainability: Easier to test and maintain platform-specific code
  • Flexibility: Users can depend on specific platform implementations if needed

How it works #

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Your App      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   crossvault    β”‚  ◄── App-facing API
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ crossvault_platform_     β”‚  ◄── Common interface
β”‚      interface           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
    β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β–Ό         β–Ό        β–Ό        β–Ό         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Android β”‚ β”‚ iOS β”‚ β”‚ macOS β”‚ β”‚ Windows β”‚  ◄── Platform implementations
β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Development #

Prerequisites #

  • Flutter SDK (^3.3.0)
  • Dart SDK (^3.9.2)

Building #

Each package can be built independently:

# Build platform interface
cd crossvault_platform_interface
flutter pub get

# Build Android implementation
cd ../crossvault_android
flutter pub get

# Build main package
cd ../crossvault
flutter pub get

Testing #

Run the example app:

cd crossvault/example
flutter run

πŸ“š Setup Guides #

Quick Reference Guides #

Detailed Platform Guides #

Platform READMEs #

πŸ“ License #

MIT License

🀝 Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

2
likes
140
points
33
downloads

Publisher

unverified uploader

Weekly Downloads

Secure cross-platform vault for Flutter using native storage (iOS Keychain, Android Keystore, Windows Credential Manager). Supports iCloud sync, Auto Backup, and TPM.

Homepage
Repository (GitHub)
View/report issues

Topics

#security #encryption #keychain #keystore #secure-storage

Documentation

Documentation
API reference

License

unknown (license)

Dependencies

crossvault_android, crossvault_ios, crossvault_macos, crossvault_platform_interface, crossvault_windows, flutter

More

Packages that depend on crossvault

Packages that implement crossvault