sec(SEC-02): opaque claim token for QR scan, rate endpoint, expiration countdown - #354
Open
vallejoraul08-debug wants to merge 1 commit into
Open
Conversation
…n countdown Replaces HTLC preimage in the merchant-scan QR with a single-use opaque token (trade_claim_tokens, sha256 stored, atomic consume on consumed_at IS NULL, redacted in logs). Adds GET /rate/usdc-mxn to remove hardcoded FX from the frontend, a shared useCountdown hook for QRReveal expiration UX, and the missing POST /trades/:id/merchant-confirm handler that api.ts was already calling. Local main was 14 commits behind origin/main when this was written; see PR description for the reconciliation against the 62 commits landed since.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Qué cierra
trade_claim_tokens), sólo se guarda el sha256, consumo atómico porconsumed_at IS NULL, redactado en logs.GET /rate/usdc-mxn— quita el FX hardcodeado del frontend.QRReveal+ hookuseCountdowncompartido (reemplaza 3 copias).POST /trades/:id/merchant-confirm— el backend no la tenía aunqueapi.tsya la llamaba (404 en el escaneo del comercio). Aquí se quema el claim token.Home.test.tsxyTradeDetail.test.tsx, rojos desde antes de este cambio.Verificación
tsc --noEmitlimpio ·claimToken4/4 ·tradeAuth9/9 ·rateCache5/5 ·requestIdOKtsc --noEmitlimpio ·vitest run79/79origin/main(main local estaba 14 commits atrás) y resolví conflictos enschema.ts,index.ts,i18n/en.json,i18n/es.json— todos additivos salvohtlcTestnet, donde mantuve el valor ya enmain.Fuera de este PR, a propósito
lib/xrpl-keystore.tsno se toca — depende de una decisión de producto sobre XRPL que sigue abierta.No cerrado en este PR
merchant_configs.rate_percent, 1.9–2.5%) no se cobra:createTradesólo calcula el 0.8% de plataforma.expiredes inalcanzable — el backend nunca lo persiste.