Repository navigation
Description
Problem
Coming from Group-IB's feedback, using the SecureStore for private key storage is generally safe but subject to potentially vulnerability due to the private key being generated in the app and stored briefly in memory.
Why is this important?
It's possible that the private key contents could be leaked via logs or copied out of memory by malicious code running in userspace - either something we added without realizing or 3rd party code on a jailbroken device.
Solution
High Level
Group-IB recommended solution is to use the device's hardware security module (called "Secure Enclave" on iOS and "StrongBox" on Android) to generate the key pair. Similar to how passkey works under the hood, the HSM would generate the key pair and return only the public key and an ID to the client. The client could request that data be signed with that key, gated by successful face / fingerprint / passcode authentication, but never has access to the private key itself. That eliminates all risk of the private key being stolen or leaked.
Detailed
This is broken down into several steps. After each step, let's discuss in #ecuk-eu in Slack to determine the best path forward, as priorities and timing may shift.
- Select a library - The library we use today to access biometric features from react native, expo-secure-store, does not support the HSM. To add support for it would amount to writing a whole new library, so it's better to look for existing libraries that implement it, which we could then modify to suit our needs.
- Tentatively, the team has identified https://github.com/sbaiahmed1/react-native-biometrics as a possible solution but noted that it's relatively unknown and only maintained by a single individual.
- Further research should be conducted to determine if other libraries meet our needs.
- Add missing features - We had to implement several patches to expo-secure-store to ensure it behaved as we needed. For example, we need to know what type of authentication was used, and we need to ensure it authenticates the user every time, even if the user recently authenticated. Full details of these patches can be found in [No QA] [Expensify Cards EU/UK] Split up expo-secure-store patches #76288
- The same features will need to be supported by our chosen library. If they are not already, we'll need to implement them and anything else that's missing.
- We'll have to discuss internally and with the developer of the chosen package to determine the best path for implementing these changes. Ideally, we want to optimize for moving as quickly as possible and not supporting the library long-term. Some options are:
- Implement the changes ourselves and create a patch while we wait for changes to be merged upstream
- Fork the library and use the fork if the maintainer is unresponsive
- Sponsor the project and ask the maintainer to implement the features themselves
- Bring the author into our open source program as an expert contributor and have them implement the changes as part of their work for us
- Hire the maintainer (they'd have to go through the normal process) and have them implement the changes as part of their work as an employee 😄
- Once we decide on the library and determine which features are missing, I will help coordinate with the maintainer
- Update code flows to use the new library - This should be done in partnership with @JakubKorytko and @dariusz-biela, as they have the most context on the current code.
- Test, test, test! - myself, @joekaufmanexpensify, @chuckdries, and @DylanDylann will assist with this. This change will be implemented after the core flows are already live in production, so mistakes carry a high risk. Likely we will want to add it as another authentication provider, similar to mobile native and passkey, so we can test it in the troubleshooting and pin management flows before rolling it out to transaction authorization.
Activity
mrejdak commentedon Feb 13, 2026
Reviewed and tested the library and overall it looks solid.
On Android, it defaults to TEE instead of StrongBox (it’s still hardware-backed security, slightly weaker than Strongbox, but much more widely available on Android devices).
On iOS, it enforces Secure Enclave for EC256 and fails if unavailable. In practice, most devices support Secure Enclave.
There are a few limitations that would require a patch and some other features (like returning the used authentication type) that weren’t supported in expo-secure-store are also missing or are only partially supported here (details in the next comment).
Overall, it would need a few patches, but it still seems like a better and more efficient option than building the whole solution from scratch.
mrejdak commentedon Feb 13, 2026
Findings and Issues:
General:
Security concerns:
Missing functionalities (that were introduced as patches to
expo-secure-store):disableDeviceFallbackset tofalse(however it also has one problem - more about this later)expo-secure-store)Other problems:
validateKeyIntegrity- on Android it works only for RSA due to some hardcoded values (thus always fails for EC256)signWithOptions- hasdisableDeviceFallbackflag (Android only), however, regardless of its value, it does not allow fallback to device credentials.rafecolton commentedon Feb 24, 2026
Latest update here
mrejdak commentedon Mar 2, 2026
Maintainer of the library was open to integrating our changes; here are the upstreamed PRs so far:
rafecolton commentedon Mar 17, 2026
Not overdue, see the comment above
29 remaining items
[-][Due for payment 2026-04-14] [Due for payment 2026-04-14] Replace mobile native private key storage with Secure Enclave / StrongBox[/-][+][Due for payment 2026-04-17] [Due for payment 2026-04-14] [Due for payment 2026-04-14] Replace mobile native private key storage with Secure Enclave / StrongBox[/+]melvin-bot commentedon Apr 10, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Apr 10, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.57-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-04-17. 🎊
For reference, here are some details about the assignees on this issue:
[-][Due for payment 2026-04-17] [Due for payment 2026-04-14] [Due for payment 2026-04-14] Replace mobile native private key storage with Secure Enclave / StrongBox[/-][+]Replace mobile native private key storage with Secure Enclave / StrongBox[/+]rafecolton commentedon Apr 20, 2026
This is done! Thanks @mrejdak