feat: add production-grade useWallet hook with state machine, AbortCo…#30
Merged
Merged
Conversation
…ntroller, and full test coverage - Strict WalletState type (idle | loading | success | error) with useReducer - AbortController for race condition / unmount cleanup - Proper useEffect dependency array - Extracted fetchWalletData() for independent testability - Response boundary validation - 11 unit tests covering success, failure, abort, unmount, and reset
Contributor
|
thank you for your contribution to Kolo @Skinny001 |
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new React hook for wallet management, enhances the Stellar wallet generation process to use encryption for secrets, and adds comprehensive tests for the new functionality. It also updates dependencies to support React and testing libraries. These changes improve both the security of wallet secrets and the testability of wallet-related features.
close #27
Wallet functionality and security:
useWalletReact hook and supporting functionfetchWalletDatainsrc/hooks/useWallet.ts, providing stateful wallet data fetching and management for the frontend.StellarServiceto encrypt the wallet secret and return the encrypted value along with initialization vector (iv) and auth tag, replacing the previous approach that returned the raw secret. [1] [2]UserServiceto store the encrypted wallet secret (with iv and auth tag) in the database instead of the plaintext secret, improving custodial wallet security. [1] [2]Testing improvements:
useWallethook and wallet data fetching insrc/__tests__/useWallet.test.ts, covering success, error, abort, and state reset scenarios.src/__tests__/stellar.service.test.tsto align with the new encrypted secret format and to clean up and clarify test logic. [1] [2] [3] [4] [5] [6]Dependency updates:
react,react-dom), React Testing Library, JSDOM, and related type packages topackage.jsonto support frontend development and testing.…ntroller, and full test coverage