Skip to content

fix(web): say what is wrong with a mistyped Identity ID on the recovery-phrase import - #687

Merged
PastaPastaPasta merged 1 commit into
masterfrom
fix/import-identity-id-message
Nov 24, 2026
Merged

PastaPastaPasta merged 1 commit into
masterfrom
fix/import-identity-id-message

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Sign in → "Use my recovery phrase or identity file" → Recovery phrase, with a valid phrase and not-an-id in "Identity ID (optional)", shows the SDK's raw error:

Invalid identity ID: string decoding error provided string contained invalid character '-' at byte 3

"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 --noEmit clean.

🤖 Generated with Claude Code

…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]>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a298dd6c-8cc3-4f85-8834-0843d1f2e908
Commits

Reviewing files that changed from the base of the PR and between cf8693e and 39c98e8.

Files selected for processing: 2

  • forge-web/lib/auth/controller.ts
  • forge-web/lib/auth/signin-messages.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 same identityIdProblem + WriteAuthError that loginWithRawKey uses (: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 reaches withPlatformRead/the SDK decoder.
  • Valid ids still pass. identityIdProblem (:2773) is the base58 alphabet regex plus decodeIdentifier, 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-id fails the alphabet check.
  • Other import paths don't change. The fileText branch (: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 past isValidMnemonic, so getSdk() calls the mocked sdk, which throws no read expected. The message doesn't match, and not.toHaveBeenCalled also fails. With the fix, it rejects with the plain-words message before any read.
  • Nit, controller.ts:1037: identityId = input.identityId.trim() recomputes givenId and 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.

@PastaPastaPasta
PastaPastaPasta merged commit cbaed89 into master Nov 24, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant