fix: update key retrieval methods to return nullable types on failure - #4849
fix: update key retrieval methods to return nullable types on failure#4849sergei-boiko-trustwallet wants to merge 1 commit into
Conversation
Summary by OctaneNew ContractsNo new contracts were added. Updated Contracts
🔗 Commit Hash: c580cda |
|
This PR touches persistence-sensitive files: Post a comment with one of:
Each token must be accompanied by >=60 chars of reasoning. The reasoning must be fresh — posted or edited at or after the HEAD commit. Why audit evidence is required for Pass / Mitigated: humans don't reliably ask the right BC question on every PR. AI being in the loop is the whole point of this gate. The bot does not judge whether your reasoning is correct — reviewers do, like any other code review. Things worth thinking about: could a previous version have written data this PR's new check would now reject? Was there a partial migration ("regenerate on next user action") that may not have completed for all users? Does this format live in iCloud / Google Drive backup, exported files, or sync payloads? See Changed files (2)
Copy this audit prompt into Claude Code on this branch (or run the
|
Binary size comparison➡️ aarch64-apple-ios: 14.31 MB ➡️ aarch64-apple-ios-sim: 14.31 MB ➡️ aarch64-linux-android: 18.73 MB ➡️ armv7-linux-androideabi: 16.17 MB ➡️ wasm32-unknown-emscripten: 13.66 MB |
Overview
Warnings
|
|


This pull request improves the robustness of the HD wallet API by updating several methods to return nullable values when key or address derivation fails (such as when the mnemonic entropy is empty). The changes also update documentation to clarify these behaviors and adjust Swift test and example code to handle the possibility of nil returns. Additionally, the Cardano key derivation logic is hardened against invalid entropy.
API changes for error handling and nullability:
TWHDWallet.hto return nullable pointers (e.g.,TWPrivateKey* _Nullable,TWString* _Nullable) and clarified documentation to indicate that null is returned if derivation fails, such as with empty mnemonic entropy.nullptron failure for key and address derivation methods.Cardano derivation safety:
Swift example and test code updates: