[Extension] getTokenPrices re-derives the auth keypair (PBKDF2) on every 30s price poll
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- authentication, performance
Research direction
Start with the v2 getTokenPrices path through callBackendV2, then trace deriveAuthKeypair and mnemonicToSeedSync after #2880 merges. Choose an approach that removes repeated PBKDF2 work while preserving the #2769 invariant: no key material persisted at rest, with eviction on lock, logout, or expiry.
Written by the indexing model from the issue text.
Description
Problem
getTokenPrices (v2 path) now routes through the freighter-backend-v2 authed chokepoint (callBackendV2) as of #2880 (#2879). It's the first high-frequency chokepoint caller: the Account view polls token prices every ~30s with useCache: false, so each poll triggers deriveAuthKeypair → mnemonicToSeedSync (bip39 PBKDF2, ~18ms of synchronous, main-thread blocking) to sign the per-request JWT.
Per #2769, the auth keypair is deliberately never cached at rest, so today every poll re-derives it. The other migrated call sites (getDiscoverData, fetchCollectibles, getLedgerKeyAccounts) are one-shot, so this hot-path cost only showed up once getTokenPrices was routed through the chokepoint.
This is correct (no security/functional bug) — just an avoidable recurring main-thread stall.
Options
- A short-lived, in-background keypair memo (e.g. cache the derived keypair in the background service worker for a few seconds, cleared on lock/logout) so a burst of requests reuses one derivation without persisting key material at rest.
- Let the price poll honor the popup cache / back off its interval.
- Move derivation off the main thread.
Any option must preserve the #2769 invariant: no key material persisted at rest, and eviction on lock/logout/expiry.
Context
- Surfaced by the pre-PR whole-system review of #2880.
- Gated behind #2880 (merge that first).
- Dominant language
- TypeScript
- Stars
- 122
- Forks
- 62
- Avg merge
- 4d 19h
- Merged PRs (30d)
- 41
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stellar/freighter
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
Write the banner publishing guidePossibly taken @aristidesstaffieri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
stellar/freighter#3152 · 1 assignee ·
Maintainers usually reply within 2 days
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 2 days
-
Dont call blockaid on empty token listMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
follow-up
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
All issues in stellar/freighter
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zabuton-app/meguri#875 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
iruzen-dono/workless#117 ·
Maintainers usually reply within 1 day
-
area:api area:web wave wave:trivial
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
vetro-protocol/vetro-monorepo#1321 ·
Maintainers usually reply within 1 day