[Extension] getTokenPrices re-derives the auth keypair (PBKDF2) on every 30s price poll

Aperta
#2,897 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
typescript

Direzione di ricerca

Inizia con il percorso v2 getTokenPrices tramite callBackendV2, quindi traccia deriveAuthKeypair e mnemonicToSeedSync dopo il merge di #2880. Scegli un approccio che elimini il lavoro ripetuto di PBKDF2 preservando l’invariante di #2769: nessun materiale delle chiavi viene persistito a riposo, con eviction al blocco, al logout o alla scadenza.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).
Lingua principale
TypeScript
Stelle
122
Fork
62
Merge medio
4g 19h
PR unite (30g)
41

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stellar/freighter

Tutte le issue di stellar/freighter

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.