Repository navigation
fix(web): say what is wrong with a mistyped Identity ID on the recovery-phrase import - #687
Merged
Merged
Conversation
…ry-phrase import Signing in with a recovery phrase and an Identity ID such as "not-an-id" showed the SDK's "Invalid identity ID: string decoding error provided string contained invalid character '-' at byte 3". The import now checks the ID with identityIdProblem first, as "Paste a private key" already does, and says what an identity ID looks like, without a Platform read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
PastaPastaPasta
commented
Nov 24, 2026
PastaPastaPasta
left a comment
Owner
Author
There was a problem hiding this comment.
Verdict: approve
Findings:
forge-web/lib/auth/controller.ts:1031-1033: correct and limited to the recovery-phrase branch. The id is trimmed, an empty id skips the check (so it is still derived from the phrase at :1040), and any other value goes through the sameidentityIdProblem+WriteAuthErrorthatloginWithRawKeyuses (:1679-1680). Both forms show the same copy. The check runs before the mnemonic check and before any SDK read, so a malformed id never reacheswithPlatformRead/the SDK decoder.- Valid ids still pass.
identityIdProblem(:2773) is the base58 alphabet regex plusdecodeIdentifier, which requires exactly 32 bytes and keeps leading '1's as 0x00 bytes. I round-tripped 20k random 32-byte ids (a quarter each with 0–3 leading zero bytes) through the same encode and decode logic: none were rejected, they came out at lengths 42, 43 and 44, and the all-zero id passes.not-an-idfails the alphabet check. - Other import paths don't change. The
fileTextbranch (:1025-1029) is untouched, the dg handoff doesn't go through this branch, and renew mode prefills the signed-in id (login-modal.tsx:907), which is valid. forge-web/lib/auth/signin-messages.test.ts:79-92: this test fails without the fix. Without it, the valid "abandon … about" phrase gets pastisValidMnemonic, sogetSdk()calls the mockedsdk, which throwsno read expected. The message doesn't match, andnot.toHaveBeenCalledalso fails. With the fix, it rejects with the plain-words message before any read.- Nit,
controller.ts:1037:identityId = input.identityId.trim()recomputesgivenIdand could reuse it. - Nit, from before this PR (
controller.ts:2775): the copy says "43 or 44" characters, but a valid id with a leading zero byte can be 42 characters long (1 in ~58²). Such an id is still accepted; only the help text is a little off.
CI: the web job (which runs vitest) was still pending when I reviewed. I didn't run tests locally.
🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.
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.
Sign in → "Use my recovery phrase or identity file" → Recovery phrase, with a valid phrase and
not-an-idin "Identity ID (optional)", shows the SDK's raw error:"Paste a private key" already answers the same input in plain words through
identityIdProblem("That isn't an identity ID: it has characters an ID can't have. An identity ID is 43 or 44 letters and digits (base58)…"). The phrase import now runs the same check before it reads anything. Found in tonight's mainnet-readiness QA (lane web-A, sign-in).Test: new case in
lib/auth/signin-messages.test.ts. It fails on master (the import goes on to a Platform read) and passes with the fix.vitest run lib/auth/ components/login-modal*.test.tsx: 585 passed.tsc --noEmitclean.🤖 Generated with Claude Code