Flow Wallet Kit
Documentation for Flow Wallet Kit - iOS and Android SDK
Flow Wallet Kit
Welcome to the Flow Wallet Kit documentation. This SDK provides a comprehensive solution for integrating Flow blockchain wallet functionality into your iOS and Android applications.
Platform Support
Overview
Flow Wallet Kit is a mobile framework that provides a comprehensive solution for integrating Flow blockchain wallets into mobile applications. It handles key management, account operations, and blockchain interactions with a clean, modular architecture.
This document outlines the key components and their relationships in the implementation of Flow Wallet Kit. We take swift as the example.
Architecture Diagram
Core Components
Storage System
StorageProtocol
Core interface for data persistence operations.
KeychainStorage
Implementation of StorageProtocol using iOS Keychain for secure storage.
Key Management
KeyProtocol
Base interface for cryptographic keys with methods for creation, retrieval, and signing.
Key types supported:
secureEnclave
: Uses Apple's Secure EnclaveseedPhrase
: Mnemonic-based (BIP39)privateKey
: Standard private keykeyStore
: Key store file
Key Implementations
-
PrivateKey: Standard private key implementation
-
SecureEnclaveKey: Uses Apple's Secure Enclave for enhanced security
-
SeedPhraseKey: Mnemonic phrase-based key generation
Account Management
Account
Represents a Flow blockchain account with signing capabilities.
Key features:
- Contains Flow.Account reference
- Has optional key reference for signing operations
- Implements FlowSigner protocol for transaction signing
- Methods to find compatible keys
- Support for child accounts and VM accounts
Wallet
Main wallet class that manages accounts across different networks.
Wallet Types:
Key features:
- Manages accounts across different networks
- Handles account fetching and caching
- Support for watch-only and signing wallets
Network
Manages blockchain API interactions and account discovery by looking up account from Key Indexer API.
Response structure:
Key Features
- Multi-network support: Works with Flow mainnet, testnet, and other networks
- Multiple key types: Supports various key security methods
- Account hierarchy: Manages main accounts, child accounts, and VM accounts
- Transaction signing: Implements Flow signing protocols
- Data persistence: Secure storage for keys and account information
Main Workflow
-
Initialize FWKManager with storage configuration:
-
Create or retrieve keys:
-
Create a Wallet instance:
-
Access accounts:
-
Sign transactions:
Error Handling
The library provides a comprehensive error type:
Security Considerations
- Keys are securely stored in the Keychain
- Secure Enclave option for maximum hardware security
- Password-based encryption for sensitive data
- BIP39 standard for seed phrase management
Conclusion
Flow Wallet Kit provides a comprehensive, secure, and flexible framework for building Flow blockchain wallets on mobile. Its modular architecture supports various key management approaches and security requirements, making it suitable for a wide range of wallet applications.