-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
2 / 62 of 6 issues completedDescription
Overview
This issue covers the native bridge integration for EOA (Externally Owned Account) support during user onboarding. Users will have two account creation options:
- Seed Phrase Wallet
- Secure Enclave/Hardware Wallet
The flow transitions from React Native onboarding pages to native implementation for secure key management and wallet initialization.
Figma Design
1. Seed Phrase Wallet Creation Flow
Process Overview
- User selects seed phrase wallet creation option
- RN generates and displays seed phrase using BIP39
- User verifies seed phrase through fill-in-the-blank validation
- RN extracts public key and registers with backend
- Data handoff from RN to native layer
- Native secure storage and Firebase authentication
- Wallet-Kit initialization with fast Flow account discovery
- Return to home page with optional notification permission
Sequence Diagram
sequenceDiagram
participant User
participant RN as React Native (Onboard Page)
participant WalletSDK as Wallet Package SDK (BIP39)
participant API as GoAPIService (Backend)
participant Native as Native Layer (iOS/Android)
participant Firebase
participant WalletKit as Wallet-Kit
Note over User, WalletKit: User Onboarding - Seed Phrase Wallet Creation
User->>RN: Click "Create Seed Phrase Wallet"
RN->>WalletSDK: Generate seed phrase using BIP39
WalletSDK-->>RN: Return seed phrase
RN->>User: Display seed phrase
User->>RN: Click "Next"
RN->>User: Show seed phrase verification (fill blanks)
User->>RN: Complete verification
RN->>WalletSDK: Extract public key from seed phrase
WalletSDK-->>RN: Return public key
RN->>API: Send create wallet request with public key
Note right of API: Backend verifies public key
API->>API: Verify public key validity
API-->>RN: Return register response with txId
RN->>Native: Pass (seed phrase, customToken/JWT, txId)
Native->>Native: Save seed phrase key securely
Native->>Firebase: Login with customToken (JWT)
Firebase-->>Native: Authentication success
Native->>WalletKit: Initialize with seed phrase key
WalletKit-->>Native: Wallet-kit initialized
Native->>WalletKit: Initialize wallet object with txId
Note right of WalletKit: Fast Flow account discovery avoiding key indexer wait
WalletKit-->>Native: Wallet object initialized
Native->>RN: Close React Native view
Native->>User: Return to home page
opt Optional Step 13
Native->>User: Trigger notification permission request
end
2. Secure Enclave/Hardware Wallet Creation Flow
Process Overview
- User selects hardware wallet creation option
- RN calls native layer to start registration process
- Native creates secure enclave key (reusing existing logic)
- Native calls register API with public key (reusing existing logic)
- RN navigates to loading page and clears navigation stack
- Native secure storage and Firebase authentication
- Wallet-Kit initialization with secure enclave key
- Flow account discovery process
- Navigate to backup page when Flow account is found
Sequence Diagram
sequenceDiagram
participant User
participant RN as React Native (Onboard Page)
participant Native as Native Layer (iOS/Android)
participant SecureEnclave as Secure Enclave
participant API as GoAPIService (Backend)
participant Firebase
participant WalletKit as Wallet-Kit
Note over User, WalletKit: User Onboarding - Secure Enclave Wallet Creation
User->>RN: Click "Create Hardware Wallet"
RN->>Native: Call native registration flow
Note over Native: Reuse existing registration logic
Native->>SecureEnclave: Create secure enclave key
Note over SecureEnclave: Reuse existing key creation logic
SecureEnclave-->>Native: Return secure key pair
Native->>API: Call register API with public key
Note over API: Reuse existing registration logic
API->>API: Verify public key validity
API-->>Native: Return register response with (txId, customToken/JWT)
Native->>RN: Registration success, navigate to loading page
RN->>RN: Clear navigation stack (prevent back navigation)
RN->>User: Show loading page
Native->>Native: Save secure key securely
Native->>Firebase: Login with customToken (JWT)
Firebase-->>Native: Authentication success
Native->>WalletKit: Initialize with secure enclave key
WalletKit-->>Native: Wallet-kit initialized
Native->>WalletKit: Initialize wallet object with txId
Note right of WalletKit: Fast Flow account discovery avoiding key indexer wait
WalletKit-->>Native: Searching for Flow account...
WalletKit->>WalletKit: Flow account discovery process
WalletKit-->>Native: Flow account found and initialized
Native->>RN: Flow account ready, navigate to backup page
RN->>User: Navigate to backup page
Step-by-Step Breakdown
Seed Phrase Wallet (Steps 1-13)
- User Interaction: User clicks "Create Seed Phrase Wallet" option
- Seed Phrase Generation: RN uses Wallet Package SDK's BIP39 implementation to generate seed phrase
- Display Phase: Show generated seed phrase to user, user clicks next
- Verification Phase: User completes seed phrase verification through fill-in-the-blank
- Public Key Extraction: RN extracts public key from validated seed phrase using Wallet SDK
- Backend Registration: RN sends create wallet request with public key to GoAPIService backend
- Data Handoff: RN passes (seed phrase, customToken/JWT, txId) to native layer
- Secure Storage: Native layer saves seed phrase key securely
- Firebase Authentication: Native uses custom token to authenticate with Firebase
- Wallet-Kit Initialization: Native initializes wallet-kit with seed phrase key
- Fast Account Discovery: Native uses txId to initialize wallet object for fast Flow account discovery
- UI Transition: Native closes React Native view and returns user to home page
- Optional Notification: Native may trigger notification permission request
Secure Enclave Wallet (Steps 1-12)
- User Interaction: User clicks "Create Hardware Wallet" option
- Native Bridge Call: RN calls native layer to start registration process
- Secure Key Creation: Native creates secure enclave key (reusing existing logic)
- Backend Registration: Native calls register API with public key (reusing existing logic)
- Navigation Management: RN navigates to loading page and clears navigation stack to prevent back navigation
- Secure Storage: Native saves secure key securely
- Firebase Authentication: Native uses customToken to login to Firebase
- Wallet-Kit Initialization: Native initializes wallet-kit with secure enclave key
- Flow Account Search: Native's wallet-kit uses txId to initialize wallet object for fast Flow account discovery
- Account Discovery Process: Wallet-Kit searches for Flow account, avoiding key indexer wait
- Discovery Completion: When Flow account is found, process completes
- Navigate to Backup: Native notifies RN to navigate to backup page
Key Differences Between Flows
Seed Phrase Flow
- UI-Heavy: More user interaction in RN (display, verification)
- Manual Validation: User manually verifies seed phrase
- Direct Handoff: All data passed to native at once
- Immediate Completion: Returns to home page directly
Secure Enclave Flow
- Native-Heavy: Most operations handled by native layer
- Automatic Process: No manual user verification required
- Existing Logic Reuse: Leverages current secure enclave and registration code
- Async Completion: Waits for Flow account discovery before proceeding
- Backup Flow: Proceeds to backup page instead of home
Implementation Notes
- Both flows reuse existing native logic for security and consistency
- Navigation stack management prevents users from going back during sensitive operations
- Fast Flow account discovery using txId optimizes user experience
- Firebase authentication ensures secure user session management
- Wallet-Kit integration provides robust Flow blockchain interaction
Next Steps
- Define native bridge APIs for both flows
- Implement navigation stack management
- Add error handling and recovery mechanisms
- Create backup page flow documentation
- Test secure enclave key creation and storage
Sub-issues
Metadata
Metadata
Assignees
Labels
MobileMobile OnlyMobile Only