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
Problem
getTokenPrices(v2 path) now routes through thefreighter-backend-v2authed chokepoint (callBackendV2) as of #2880 (#2879). It's the first high-frequency chokepoint caller: the Account view polls token prices every ~30s withuseCache: false, so each poll triggersderiveAuthKeypair→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 oncegetTokenPriceswas routed through the chokepoint.This is correct (no security/functional bug) — just an avoidable recurring main-thread stall.
Options
Any option must preserve the #2769 invariant: no key material persisted at rest, and eviction on lock/logout/expiry.
Context