Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
f8ccfdb
test: add entry point for testing onboarding flow
lealobanov Oct 9, 2025
e9f8b25
feat: extending bridge for existing onboarding flow
lealobanov Oct 20, 2025
27b7188
pull from dev
lealobanov Oct 20, 2025
8a7649d
feat: onboarding ui
lealobanov Oct 21, 2025
f821df9
feat: onboarding ui
lealobanov Oct 21, 2025
0e4cb3f
feat: onboarding ui entrypoint
lealobanov Oct 21, 2025
991dea6
feat: onboarding ui entrypoint
lealobanov Oct 21, 2025
ab02a54
feat: bump wallet kit
lealobanov Oct 30, 2025
f36e286
feat(android): add saveMnemonic bridge method for EOA accounts
lealobanov Oct 30, 2025
0a58b2e
chore: remove unused bridge methods
lealobanov Oct 30, 2025
e06ee29
feat: add entrypoint for onboarding flow
lealobanov Nov 6, 2025
542ea8e
feat: add entrypoint for onboarding flow
lealobanov Nov 6, 2025
c1a9461
feat: add entrypoint for onboarding flow
lealobanov Nov 6, 2025
0225369
Merge dev branch and resolve conflicts
lealobanov Nov 6, 2025
9199ff1
feat: add entrypoint for onboarding flow
lealobanov Nov 6, 2025
a682720
feat: add entrypoint for onboarding flow
lealobanov Nov 6, 2025
7045625
feat: add entrypoint for onboarding flow
lealobanov Nov 6, 2025
f6dc181
feat: add entrypoint for onboarding flow
lealobanov Nov 10, 2025
b07d564
fix: add missing entry point and bridge methods
lealobanov Nov 10, 2025
68d7451
chore: pull from dev
lealobanov Nov 10, 2025
6baab43
fix: add missing entry point and bridge methods
lealobanov Nov 10, 2025
c7a8c25
fix: add missing entry point and bridge methods
lealobanov Nov 10, 2025
b2c29b7
fix: merge conflicts
lealobanov Nov 10, 2025
911d807
fix: feedback
lealobanov Nov 10, 2025
4cd3556
fix: feedback
lealobanov Nov 10, 2025
47bc372
fix: feedback
lealobanov Nov 10, 2025
c40407a
fix: feedback
lealobanov Nov 11, 2025
561e02f
fix: feedback
lealobanov Nov 11, 2025
a3d3fab
fix: save mnemonic
lealobanov Nov 11, 2025
acd4a61
fix: save mnemonic
lealobanov Nov 11, 2025
d25d9da
chore: clean up
lealobanov Nov 11, 2025
a4d8d7d
chore: clean up
lealobanov Nov 11, 2025
07686dd
chore: clean up
lealobanov Nov 11, 2025
5555213
chore: clean up
lealobanov Nov 11, 2025
c3ea40c
fix: feedback
lealobanov Nov 12, 2025
210d3d0
fix: feedback
lealobanov Nov 12, 2025
288683f
fix: feedback
lealobanov Nov 12, 2025
3b19ee4
fix: feedback
lealobanov Nov 12, 2025
0b4a973
fix: feedback
lealobanov Nov 12, 2025
33fdf27
fix: update method name
lealobanov Nov 13, 2025
7e5bba0
fix: remove mnemonic generation from Secure Enclave account creation
lealobanov Nov 13, 2025
1a32ead
fix: remove EOA chip for Secure Enclave/COA accounts
lealobanov Nov 13, 2025
8b739f7
feat: add createLinkedCOAAccount method for Recovery Phrase flow
lealobanov Nov 13, 2025
f14774e
feat: add bridge methods for keys
lealobanov Nov 13, 2025
bea92a0
feat: add bridge methods for keys
lealobanov Nov 13, 2025
dd23c28
feat: add bridge methods for keys
lealobanov Nov 13, 2025
4f20ae8
feat: remove cast to lowercase during register outblock call (#2121)
lealobanov Nov 13, 2025
cbb91ac
chore: refactoring + feedback
lealobanov Nov 14, 2025
ad2a01d
Merge branch 'onboarding-entrypoint' of https://github.com/onflow/FRW…
lealobanov Nov 14, 2025
ee760e6
chore: refactoring + feedback
lealobanov Nov 14, 2025
e5bdf98
chore: refactoring + feedback
lealobanov Nov 14, 2025
7f1001d
chore: refactoring + feedback
lealobanov Nov 17, 2025
7ca9a1d
chore: refactoring + feedback
lealobanov Nov 17, 2025
e4346e7
chore: refactoring + feedback
lealobanov Nov 17, 2025
1fb087e
chore: refactoring + feedback
lealobanov Nov 17, 2025
5809e17
chore: refactoring + feedback
lealobanov Nov 17, 2025
4544a82
chore: refactoring + feedback
lealobanov Nov 17, 2025
5cdab40
Merge dev branch - resolve conflicts in UserRegisterUtils
lealobanov Nov 17, 2025
74330ce
chore: regenerate BridgeModels with InitialRoute and SPResponse
lealobanov Nov 17, 2025
8594aae
chore: remove debug logs and comments
lealobanov Nov 17, 2025
4eaf0a3
fix: normalize public keys
lealobanov Nov 17, 2025
08d0100
fix: feedback
lealobanov Nov 19, 2025
a99ef81
chore: pull from dev
lealobanov Nov 20, 2025
b6e76db
fix: feedback
lealobanov Nov 21, 2025
319e60c
Merge branch 'dev' into onboarding-entrypoint
lealobanov Nov 24, 2025
6ea6d0b
fix: feedback - rename method
lealobanov Nov 24, 2025
c80b808
fix: feedback - rename method
lealobanov Nov 24, 2025
ae2adcf
refactor(bridge): rename linkCOAAccountOnChain to registerAccountWith…
lealobanov Nov 25, 2025
020aa4d
Merge branch 'dev' into onboarding-entrypoint
lealobanov Nov 25, 2025
abc3245
security(bridge): use in-memory storage for unconfirmed seed phrases
lealobanov Nov 25, 2025
774a3a3
fix: feedback
lealobanov Nov 25, 2025
6e290ad
fix: feedback
lealobanov Nov 25, 2025
bbf1127
Merge branch 'dev' of https://github.com/onflow/FRW-Android into onbo…
lealobanov Nov 26, 2025
45f14cd
feat(android): route Add Account and Create Profile to RN onboarding
lealobanov Nov 26, 2025
525b802
chore(android): remove unused WalletUnregisteredFragment
lealobanov Nov 26, 2025
d73cb9c
fix: feedback
lealobanov Nov 26, 2025
18ca7dc
fix(android): merge dev branch with proper two-button drawer layout
lealobanov Nov 26, 2025
05deb4a
fix(android): merge dev branch with proper two-button drawer layout
lealobanov Nov 26, 2025
639e57d
feat(android): connect drawer add profile button to RN onboarding
lealobanov Nov 26, 2025
0d91256
fix(android): resolve merge conflict - keep RN onboarding integration
lealobanov Nov 26, 2025
096919b
fix: navigate to ProfileTypeSelection instead of GetStarted
lealobanov Nov 26, 2025
a60adaa
fix(android): use launchWithRoute for existing user entry points
lealobanov Nov 26, 2025
0f69b66
fix: feedback
lealobanov Nov 27, 2025
7d37d3f
chore(android): remove auto-generated React Native assets from git
lealobanov Nov 27, 2025
7f36889
fix: register v3
lealobanov Nov 27, 2025
cd50ff3
Merge branch 'dev' into onboarding-entrypoint
lealobanov Nov 27, 2025
09dbc03
chore: restore FirebaseAuth.kt to dev branch version
lealobanov Nov 27, 2025
b5461e5
fix: register v3
lealobanov Nov 27, 2025
c5eafcd
fix: align with dev
lealobanov Nov 27, 2025
4eb1325
fix: align with dev
lealobanov Nov 27, 2025
6abb33a
fix: align with dev
lealobanov Nov 27, 2025
c1c0a6c
fix: align with dev
lealobanov Nov 27, 2025
10748f6
fix: align with dev
lealobanov Nov 27, 2025
628a13e
fix: fix the secure enclave flow
lealobanov Nov 27, 2025
59444d1
fix: fix the secure enclave flow
lealobanov Dec 1, 2025
8447331
feat: add dynamic progress bar for SecureEnclave account creation
lealobanov Dec 1, 2025
3954161
refactor: remove unused signOutAndSignInAnonymously method
lealobanov Dec 2, 2025
0972ff9
chore: bump flow-kmm
lealobanov Dec 2, 2025
4a081b9
chore: bump flow-kmm
lealobanov Dec 2, 2025
7972892
fix: new endpoints + flow-kmm
lealobanov Dec 2, 2025
baa1fd8
chore: bump flow-kmm to 0.1.1
lealobanov Dec 3, 2025
f166523
chore: latest /v2/address
lealobanov Dec 3, 2025
aa67c7f
chore: latest /v2/address
lealobanov Dec 3, 2025
9c498d9
chore: latest /v2/address
lealobanov Dec 3, 2025
b8e944f
chore: latest /v2/address
lealobanov Dec 3, 2025
c200cb3
fix: update event name to camelCase and fix saveMnemonic parameter order
lealobanov Dec 3, 2025
f737b59
chore: bump wallet kit
lealobanov Dec 3, 2025
a97426d
chore: bump wallet kit
lealobanov Dec 3, 2025
3b9b95f
Merge dev into onboarding-get-started-entrypoints
lealobanov Dec 8, 2025
7147425
fix: registration flow
lealobanov Dec 8, 2025
24d8ce0
fix: pull from dev
lealobanov Dec 8, 2025
c2bb70f
fix: pull from dev
lealobanov Dec 8, 2025
563f3cf
feat: add InitialRoute enum for React Native navigation
lealobanov Dec 8, 2025
1368673
fix: pull from dev
lealobanov Dec 8, 2025
f912f21
fix: update registerSecureTypeAccount response to use hardware accoun…
lealobanov Dec 8, 2025
9dac58e
chore: add timing and improved logging for fetchAccountByCreationTxId
lealobanov Dec 8, 2025
424df6f
chore: add network debug logging for fetchAccountByCreationTxId
lealobanov Dec 8, 2025
76f7fc8
fix: ensure mainnet is used for account creation (backend creates on …
lealobanov Dec 8, 2025
fb5eddd
refactor: add early return registration and initWalletWithTxId for se…
lealobanov Dec 8, 2025
7af8ddd
fix: store prefix between early return and wallet init for secure enc…
lealobanov Dec 8, 2025
1ad3ead
fix: pull from dev
lealobanov Dec 8, 2025
a6e4c35
Merge dev into onboarding-entrypoint
lealobanov Dec 9, 2025
57d8b85
chore: clean up
lealobanov Dec 9, 2025
272a7cd
chore: clean up
lealobanov Dec 9, 2025
5766c60
fix: align bridge handlers with dev's new walletNodes architecture
lealobanov Dec 9, 2025
d3c49ad
fix: populate walletNodes with FlowWallet during registration
lealobanov Dec 9, 2025
c4bdf3e
fix: add FlowWallet to walletNodes after Flow address is confirmed
lealobanov Dec 9, 2025
fe05d56
fix: preserve existing FlowWallets when key indexer returns empty
lealobanov Dec 9, 2025
1c1d554
fix: disable EOA for secure enclave (P256) accounts
lealobanov Dec 9, 2025
c8a799f
chore: clean up
lealobanov Dec 9, 2025
2a711fe
feat: add accountType field to distinguish secure enclave vs recovery…
lealobanov Dec 9, 2025
a16ce69
chore: clean up
lealobanov Dec 9, 2025
cfbdc22
chore: clean up
lealobanov Dec 9, 2025
0eb9f4a
chore: clean up
lealobanov Dec 9, 2025
1917b55
chore: clean up
lealobanov Dec 9, 2025
eb18cce
chore: clean up
lealobanov Dec 9, 2025
cdd3505
chore: clean up
lealobanov Dec 9, 2025
8dceeb0
chore: clean up
lealobanov Dec 10, 2025
3c3d283
feat: fetch profiles
lealobanov Dec 10, 2025
f076094
feat: fetch profiles
lealobanov Dec 10, 2025
86bf76c
feat: fetch profiles
lealobanov Dec 10, 2025
edcdda3
feat: fetch profiles
lealobanov Dec 10, 2025
a3958d4
feat: add InitialRoute enum and make avatar nullable for recovery flow
lealobanov Dec 10, 2025
7b24553
feat: fetch profiles
lealobanov Dec 10, 2025
d96068b
fix: restore SerialName annotations for kotlinx.serialization
lealobanov Dec 11, 2025
411a75a
fix: clean up
lealobanov Dec 11, 2025
e49cd02
refactor: use AccountType.HARDWARE enum instead of string literal
lealobanov Dec 11, 2025
09b56f4
feat: register v4
lealobanov Dec 11, 2025
23b3530
feat: register v4
lealobanov Dec 11, 2025
e639d0b
fix: rename to profile type
lealobanov Dec 12, 2025
e20b83d
fix: rename to profile type
lealobanov Dec 12, 2025
a49c374
fix: rename to profile type
lealobanov Dec 12, 2025
af9e3e0
fix: rename to profile type
lealobanov Dec 12, 2025
60d65ac
fix: rename to profile type
lealobanov Dec 12, 2025
e6e05da
fix: rename to profile type
lealobanov Dec 12, 2025
9c7f73d
fix: rename to profile type
lealobanov Dec 12, 2025
92738a6
Merge branch 'dev' into onboarding-entrypoint
lealobanov Dec 12, 2025
c6e1e08
chore: pull from dev
lealobanov Dec 12, 2025
4ad6ffd
chore: pull from dev
lealobanov Dec 12, 2025
d797339
feat: add ProfileType migration for overlay installations
lealobanov Dec 12, 2025
e101b55
feat: use setEoaDisabled flag for EOA derivation control
lealobanov Dec 12, 2025
01fcc1a
chore: remove test button
lealobanov Dec 12, 2025
6cf0aec
feat: remove ProfileType
lealobanov Dec 15, 2025
d8221ed
feat: remove ProfileType
lealobanov Dec 15, 2025
c666236
feat: update swap url
lealobanov Dec 16, 2025
3502d36
fix: feedback
lealobanov Dec 16, 2025
5645bc2
fix: feedback
lealobanov Dec 16, 2025
5da92c6
Merge onboarding-entrypoint: resolve conflicts in NativeFRWBridge and…
lealobanov Dec 16, 2025
ded4744
fix: align method names with RN
lealobanov Dec 16, 2025
5814c2d
fix: align Android getV4RegistrationSignatures with RN interface
lealobanov Dec 16, 2025
9dfeef1
Merge origin/dev into register-v4
lealobanov Dec 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions app/src/androidTest/java/com/flowfoundation/wallet/TestApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package com.flowfoundation.wallet

import android.util.Log
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.flowfoundation.wallet.firebase.auth.getFirebaseJwt
import com.flowfoundation.wallet.manager.account.DeviceInfoManager
import com.flowfoundation.wallet.network.ApiService
import com.flowfoundation.wallet.network.model.AccountKey
import com.flowfoundation.wallet.network.model.FlowAccountInfo
import com.flowfoundation.wallet.network.model.RegisterRequest
import com.flowfoundation.wallet.network.retrofit
import org.onflow.flow.models.bytesToHex
Expand All @@ -18,6 +20,7 @@ import wallet.core.jni.HDWallet
import com.flow.wallet.keys.PrivateKey
import com.flow.wallet.storage.FileSystemStorage
import com.flowfoundation.wallet.utils.Env
import org.onflow.flow.models.HashingAlgorithm
import org.onflow.flow.models.SigningAlgorithm
import java.io.File

Expand All @@ -33,10 +36,22 @@ class TestApi {

val deviceInfoRequest = DeviceInfoManager.getDeviceInfoRequest()
val service = retrofit().create(ApiService::class.java)

// Get Firebase JWT for signing (v4 requires signature verification)
val firebaseJwt = getFirebaseJwt()

// Sign the Firebase JWT (for test, using a placeholder signature)
// In real usage, this should be signed with the private key
val testSignature = "test_signature_placeholder"

val flowAccountInfo = FlowAccountInfo(
accountKey = AccountKey(publicKey = publicKey),
signature = testSignature
)
val user = service.register(
RegisterRequest(
flowAccountInfo = flowAccountInfo,
username = "ttt",
accountKey = AccountKey(publicKey = publicKey),
deviceInfo = deviceInfoRequest
)
)
Expand All @@ -58,12 +73,25 @@ class TestApi {
val privateKey = PrivateKey.create(storage)
val publicKeyBytes = privateKey.publicKey(SigningAlgorithm.ECDSA_P256)
val publicKey = publicKeyBytes?.bytesToHex()?.removePrefix("04") ?: ""

// Get Firebase JWT for signing (v4 requires signature verification)
val firebaseJwt = getFirebaseJwt()

// Sign the Firebase JWT with the private key
val jwtBytes = firebaseJwt.toByteArray(Charsets.UTF_8)
val signatureBytes = privateKey.sign(jwtBytes, SigningAlgorithm.ECDSA_P256, HashingAlgorithm.SHA2_256)
val hexSignature = signatureBytes?.joinToString("") { "%02x".format(it) } ?: ""

val flowAccountInfo = FlowAccountInfo(
accountKey = AccountKey(publicKey = publicKey),
signature = hexSignature
)

val service = retrofit().create(ApiService::class.java)
val user = service.register(
RegisterRequest(
flowAccountInfo = flowAccountInfo,
username = "ttt",
accountKey = AccountKey(publicKey = publicKey),
deviceInfo = deviceInfoRequest
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import retrofit2.http.Path

interface ApiService {

@POST("/v3/register")
@POST("/v4/register")
suspend fun register(@Body param: RegisterRequest): RegisterResponse

@POST("/v1/user/address")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ import com.flowfoundation.wallet.manager.walletdata.FlowWallet
import com.flowfoundation.wallet.mixpanel.AccountCreateKeyType
import com.flowfoundation.wallet.mixpanel.MixpanelManager
import com.flowfoundation.wallet.network.model.AccountKey
import com.flowfoundation.wallet.network.model.EvmAccountInfo
import com.flowfoundation.wallet.network.model.LoginRequest
import com.flowfoundation.wallet.network.model.RegisterRequest
import com.flowfoundation.wallet.network.model.RegisterResponse
import wallet.core.jni.Hash
import com.flowfoundation.wallet.page.walletrestore.firebaseLogin
import com.flowfoundation.wallet.utils.Env
import com.flowfoundation.wallet.utils.NETWORK_MAINNET
Expand All @@ -60,6 +62,8 @@ import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import kotlinx.coroutines.delay
import org.onflow.flow.ChainId
import org.onflow.flow.models.DomainTag
import org.onflow.flow.models.HashingAlgorithm
import org.onflow.flow.models.SigningAlgorithm
import java.io.File
import java.security.MessageDigest
Expand Down Expand Up @@ -549,7 +553,7 @@ private fun registerFirebase(user: RegisterResponse, callback: (isSuccess: Boole
}

private suspend fun registerServer(username: String, prefix: String): RegisterResponse {
logd(TAG, "Starting server registration for username: $username")
logd(TAG, "Starting server registration for username: $username (using v4 API)")
val deviceInfoRequest = DeviceInfoManager.getDeviceInfoRequest()
val service = retrofit().create(ApiService::class.java)
val baseDir = File(Env.getApp().filesDir, "wallet")
Expand Down Expand Up @@ -603,17 +607,78 @@ private suspend fun registerServer(username: String, prefix: String): RegisterRe
}
logd(TAG, "Formatted public key: $hexPublicKey (${hexPublicKey.length} chars)")

// Create registration request with correct algorithm parameters
val request = RegisterRequest(
username = username,
// Get Firebase JWT for signing (v4 requires signature verification)
val firebaseJwt = getFirebaseJwt()
logd(TAG, "Got Firebase JWT for signing")

// Sign the Firebase JWT with the private key
// Important: Prepend DomainTag.User.bytes to match what backend expects
val dataToSign = DomainTag.User.bytes + firebaseJwt.toByteArray(Charsets.UTF_8)
logd(TAG, "Signing data with DomainTag.User prefix, total size: ${dataToSign.size}")

val signatureBytes = privateKey.sign(dataToSign, SigningAlgorithm.ECDSA_P256, HashingAlgorithm.SHA2_256)
if (signatureBytes == null) {
logd(TAG, "Failed to sign Firebase JWT")
throw IllegalStateException("Failed to sign Firebase JWT")
}

val hexSignature = signatureBytes.joinToString("") { "%02x".format(it) }
logd(TAG, "Signed Firebase JWT, signature length: ${hexSignature.length} chars (${signatureBytes.size} bytes)")

// Create v4 registration request with FlowAccountInfo containing signature
val flowAccountInfo = com.flowfoundation.wallet.network.model.FlowAccountInfo(
accountKey = AccountKey(
publicKey = hexPublicKey
// Using default values: ECDSA_P256 and SHA2_256
),
signature = hexSignature
)

// Create EVMAccountInfo for registration
val evmAccountInfo = try {
// Get secp256k1 public key for EVM address derivation
val evmPublicKeyBytes = privateKey.publicKey(SigningAlgorithm.ECDSA_secp256k1)
if (evmPublicKeyBytes != null) {
// Derive EVM address from public key using Keccak256
val publicKeyForHash = if (evmPublicKeyBytes.size == 65 && evmPublicKeyBytes[0] == 0x04.toByte()) {
evmPublicKeyBytes.copyOfRange(1, evmPublicKeyBytes.size)
} else {
evmPublicKeyBytes
}
val addressHash = Hash.keccak256(publicKeyForHash)
val evmAddress = "0x" + addressHash.copyOfRange(12, 32).joinToString("") { "%02x".format(it) }
logd(TAG, "Derived EVM address: $evmAddress")

// Sign Firebase JWT for EVM with secp256k1 key
val evmSignatureBytes = privateKey.sign(dataToSign, SigningAlgorithm.ECDSA_secp256k1, HashingAlgorithm.SHA2_256)
if (evmSignatureBytes != null) {
val evmSignature = evmSignatureBytes.joinToString("") { "%02x".format(it) }
logd(TAG, "Generated EVM signature, length: ${evmSignature.length}")
EvmAccountInfo(
eoaAddress = evmAddress,
signature = evmSignature
)
} else {
logd(TAG, "Could not sign with secp256k1, skipping EVM account")
null
}
} else {
logd(TAG, "Could not derive secp256k1 public key, skipping EVM account")
null
}
} catch (e: Exception) {
logd(TAG, "Error creating EVM account info: ${e.message}")
null
}

val request = RegisterRequest(
flowAccountInfo = flowAccountInfo,
evmAccountInfo = evmAccountInfo,
username = username,
deviceInfo = deviceInfoRequest
)

logd(TAG, "Sending registration request: $request")
logd(TAG, "Sending v4 registration request for username: $username")
try {
val user = service.register(request)
logd(TAG, "Registration response: $user")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,44 @@ package com.flowfoundation.wallet.network.model

import com.google.gson.annotations.SerializedName

/**
* Flow account information for v4 registration
* Contains account key and signature (signature of Firebase JWT)
*/
data class FlowAccountInfo(
@SerializedName("account_key")
val accountKey: AccountKey,

@SerializedName("signature")
val signature: String
)

/**
* EVM account information for v4 registration (optional)
* Contains EOA address and signature
*/
data class EvmAccountInfo(
@SerializedName("eoa_address")
val eoaAddress: String,

@SerializedName("signature")
val signature: String
)

/**
* V4 Register request
* Uses /v4/register endpoint with signature verification
*/
data class RegisterRequest(
@SerializedName("flow_account_info")
val flowAccountInfo: FlowAccountInfo,

@SerializedName("evm_account_info")
val evmAccountInfo: EvmAccountInfo? = null,

@SerializedName("username")
val username: String,

@SerializedName("account_key")
val accountKey: AccountKey,

@SerializedName("device_info")
val deviceInfo: DeviceInfoRequest?
val deviceInfo: DeviceInfoRequest? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class ProfileFragment : Fragment() {
presenter = ProfileFragmentPresenter(this, binding)
viewModel = ViewModelProvider(this)[ProfileFragmentViewModel::class.java].apply {
profileLiveData.observe(viewLifecycleOwner) { presenter.bind(ProfileFragmentModel(userInfo = it)) }
inboxCountLiveData.observe(viewLifecycleOwner) { presenter.bind(ProfileFragmentModel(inboxCount = it)) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,9 @@ class PrivateKeyStoreCryptoProvider(private val keystoreInfo: String) : CryptoPr
val signatureBytes = privateKey.sign(data, signingAlgorithm, getHashAlgorithm())
logd(TAG, "Raw signature from privateKey.sign(): size=${signatureBytes.size} bytes")

// Recovery ID trimming - ensure consistency with account switching flow
// Remove recovery ID if present (Flow expects 64-byte signatures, not 65-byte with recovery ID)
val finalSignature = if (signatureBytes.size == 65) {
logd(TAG, "Trimming recovery ID from 65-byte signature for $signingAlgorithm")
signatureBytes.copyOfRange(0, 64) // Remove the last byte (recovery ID)
} else {
logd(TAG, "Using signature as-is (${signatureBytes.size} bytes)")
signatureBytes
}

val hexSignature = finalSignature.joinToString("") { String.format("%02x", it) }
val hexSignature = signatureBytes.joinToString("") { String.format("%02x", it) }
logd(TAG, "Final signature generated: $hexSignature")
logd(TAG, "Final signature length: ${hexSignature.length} chars (${finalSignature.size} bytes)")
logd(TAG, "Final signature length: ${hexSignature.length} chars (${signatureBytes.size} bytes)")
return hexSignature
}

Expand All @@ -152,19 +142,8 @@ class PrivateKeyStoreCryptoProvider(private val keystoreInfo: String) : CryptoPr
logd(TAG, "[KEYSTORE] Using signAlgo: $signingAlgorithm, hashAlgo: ${getHashAlgorithm()}")

val result = privateKey.sign(data, signingAlgorithm, getHashAlgorithm())

// Recovery ID trimming - ensure consistency with account switching flow
// Remove recovery ID if present (Flow expects 64-byte signatures, not 65-byte with recovery ID)
val finalResult = if (result.size == 65) {
logd(TAG, "[KEYSTORE] Trimming recovery ID from 65-byte signature for $signingAlgorithm")
result.copyOfRange(0, 64) // Remove the last byte (recovery ID)
} else {
logd(TAG, "[KEYSTORE] Using signature as-is (${result.size} bytes)")
result
}

logd(TAG, "[KEYSTORE] sign() result (${finalResult.size} bytes): ${finalResult.toHexString()}")
return finalResult
logd(TAG, "[KEYSTORE] sign() result (${result.size} bytes): ${result.toHexString()}")
return result
}

override fun getSigner(hashingAlgorithm: HashingAlgorithm): org.onflow.flow.models.Signer {
Expand Down
Loading