Storage
Storage system documentation for Flow Wallet Kit iOS SDK
Storage
The Flow Wallet Kit for iOS implements a secure and efficient storage system for managing wallet data and user preferences.
Storage Layer
Flow Wallet Kit provides a flexible and secure storage system for managing sensitive wallet data. The storage layer is designed to be modular, allowing different storage backends while maintaining a consistent interface.
Storage Protocol
The StorageProtocol
defines the core interface for all storage implementations:
Storage Implementations
Keychain Storage
The KeychainStorage
implementation provides secure storage using iOS Keychain:
Features
- Secure storage backed by iOS Keychain
- Automatic data encryption
- Persistence across app reinstalls
- Biometric protection support
File System Storage
The FileSystemStorage
implementation provides encrypted file-based storage:
Features
- File-based encrypted storage
- Suitable for larger data sets
- Configurable encryption
- Backup-friendly
Best Practices
1. Key Naming Conventions
Use consistent key naming patterns:
2. Error Handling
Always handle storage errors appropriately:
3. Data Cleanup
Implement proper data cleanup:
4. Storage Selection
Choose the appropriate storage based on your needs:
- KeychainStorage: For small, highly sensitive data (keys, credentials)
- FileSystemStorage: For larger data sets, configuration, or cached data
Example Usage
Basic Wallet Storage
Multiple Storage Types
Security Considerations
- Data Sensitivity: Use KeychainStorage for sensitive data
- Encryption: Ensure FileSystemStorage uses proper encryption
- Cleanup: Implement secure data wiping when needed
- Access Control: Use appropriate iOS security attributes
- Error Handling: Never expose sensitive data in errors
Migration Guide
When migrating between storage implementations: