Repository navigation
recovery + ledger: list Braavos accounts like Ready's, and find them in first-run Ledger setup (#718) #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
03ffe1a
recovery: list Braavos Account 0 like Ready's, view only
Ryun1 e4d21eb
ledger: find Ready and Braavos accounts in first-run Ledger setup
Ryun1 e214303
Merge remote-tracking branch 'origin/release/v0.10.8' into fix/718-br…
derek-flossman 8f60f4f
ledger: say a failed balance read is unknown, not "no on-chain activity"
derek-flossman 909781c
tests: split two recovery test files that passed the 500-line cap
derek-flossman 8ab3c8c
ledger: list a Bramble-path row whose balance read failed instead of …
derek-flossman 61b0e40
Merge branch 'release/v0.10.8' into fix/718-braavos-accounts
derek-flossman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
57 changes: 57 additions & 0 deletions
57
packages/presentation/wallet-ui/src/sidepanel/journeys/ledger/onboard-enumerate.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /** | ||
| * Silent public-key enumeration for Ledger onboarding, split from | ||
| * onboard-session.ts on the size budget. Reads only public keys the device | ||
| * already holds, at a path rebuilt from its index and scheme (one source of | ||
| * truth with sign-time); no secrets, no key derivation. | ||
| */ | ||
|
|
||
| import { | ||
| assertLedgerDeviceReady, | ||
| type LedgerDeviceClient, | ||
| ledgerPublicKeyX, | ||
| } from "@bramble/ledger-protocol/client"; | ||
| import type { LedgerDeviceSession } from "@bramble/ledger-protocol/session"; | ||
| import type { LedgerPubKeyEntry } from "@bramble/wallet-model/accounts"; | ||
| import { | ||
| LEDGER_EIP2645_APPLICATION, | ||
| type LedgerEip2645Application, | ||
| ledgerAccountPath, | ||
| MAX_LEDGER_ACCOUNT_BATCH, | ||
| } from "@bramble/wallet-model/ledger-path"; | ||
|
|
||
| /** | ||
| * Number of account indices read per enumeration page (a page is `start` … | ||
| * `start + LEDGER_PAGE_SIZE - 1`). The device app only needs to be open and | ||
| * unlocked; every read is silent (no per-index on-device button press). | ||
| */ | ||
| export const LEDGER_PAGE_SIZE = MAX_LEDGER_ACCOUNT_BATCH; | ||
|
|
||
| /** | ||
| * Checks the pinned device OS and Starknet app releases unless this exact live | ||
| * session was already verified by the grant broker, then reads the public-key | ||
| * x-coordinate for one page of account indices — `startIndex … startIndex + | ||
| * count - 1` — SILENTLY and one round-trip at a time (the browser transport is | ||
| * a serial pipe), at the given EIP-2645 path scheme (Bramble's `LedgerW` unless | ||
| * told otherwise; Ready's `argentx` yields a different key per index). Returns | ||
| * the enumerated `(index, publicKeyX)` pairs for the onboarding controller | ||
| * to derive into candidates. Any device/transport failure propagates as a typed | ||
| * {@link LedgerRejection} so the caller aborts cleanly. | ||
| */ | ||
| export const enumerateLedgerPubKeys = async ( | ||
| client: LedgerDeviceClient, | ||
| startIndex = 0, | ||
| count: number = LEDGER_PAGE_SIZE, | ||
| readiness?: LedgerDeviceSession["readiness"], | ||
| application: LedgerEip2645Application = LEDGER_EIP2645_APPLICATION, | ||
| ): Promise<readonly LedgerPubKeyEntry[]> => { | ||
| if (readiness !== "verified") { | ||
| await assertLedgerDeviceReady(client); | ||
| } | ||
| const entries: LedgerPubKeyEntry[] = []; | ||
| for (let offset = 0; offset < count; offset += 1) { | ||
| const accountIndex = startIndex + offset; | ||
| const publicKeyX = await ledgerPublicKeyX(client, ledgerAccountPath(accountIndex, application)); | ||
| entries.push({ accountIndex, publicKeyX }); | ||
| } | ||
| return entries; | ||
| }; |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading both schemes here doubles the silent device reads per page. Each page also now yields four candidates per index (OZ + Argent at
LedgerW, Argent + Braavos atargentx), and every one gets its own deployment and balance reads. It might be worth a quick device-and-RPC timing check with a few "Show more" pages before release, especially on a slow RPC endpoint.