feat/tc-layer+twitter+phone-otp-auth#158
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/store/wallet/turnkey.ts`:
- Around line 45-57: The SMS OTP flow in getSmsTurnkeyOTP leaves
walletStore.email unchanged which causes subsequent Magic lookups (in
submitTurnkeyOTP's Magic/email lookup block) to use a stale or empty email;
update getSmsTurnkeyOTP to either clear walletStore.email when initiating SMS
(call walletStore.$patch({ phone, email: '' })) or (preferably) modify
submitTurnkeyOTP to check the OTP channel (e.g., channel or similar flag stored
on walletStore) and only perform the Magic/email lookup when channel ===
'email'; reference getSmsTurnkeyOTP, submitTurnkeyOTP, walletStore.email and the
Magic lookup logic to implement the gating or clearing so SMS flows skip email
lookups.
- Around line 203-212: The code reads and JSON.parse's the 'tc_twitter_oauth'
localStorage entry and can throw on corrupt data, which bypasses the
WalletException retry flow and delays removal; wrap the JSON.parse call (the
logic that computes twitterSession/twitterOAuth and the derived nonce,
savedState, codeVerifier, targetPublicKey, expiresAt) in a try/catch, and on
parse failure immediately removeItem('tc_twitter_oauth') and return the same
"session not found" WalletException response as when the key is absent, ensuring
the bad entry is cleared before any early return so downstream validation cannot
proceed with malformed data.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1b83d150-a80a-490e-878a-0d5436b47a31
📒 Files selected for processing (5)
app/store/wallet/index.tsapp/store/wallet/turnkey.tsapp/utils/constant/index.tsapp/utils/constant/setup.tsapp/wallet/strategy.ts
Summary by CodeRabbit