v1.48.1: auditoría en frío, parche 3 — validaciones de formato, fuera el motor automático, transacciones reales como pruebas

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5npnUYgSPkAaHkdaeUqBr
This commit is contained in:
2026-10-25 18:11:09 +01:00
co-authored by Claude Opus 5.5
parent b7856c7b91
commit a2fb0d9b94
19 changed files with 826 additions and 373 deletions
+16 -2
View File
@@ -295,9 +295,23 @@
}
async function inflarCrudo(bytes) {
if (typeof DecompressionStream === "undefined") throw new Error("Este navegador no sabe descomprimir el BBQr. Prueba con otro o pide al monedero el QR sin comprimir.");
// v1.48.1 (auditoría A2-07): se descomprime por trozos con un tope de
// 4 MB, el mismo que el del UR. Antes se materializaba todo de golpe: un
// QR pequeño muy comprimido podía colgar el navegador.
const MAX = 4000000;
const ds = new DecompressionStream("deflate-raw");
const buf = await new Response(new Blob([bytes]).stream().pipeThrough(ds)).arrayBuffer();
return new Uint8Array(buf);
const lector = new Blob([bytes]).stream().pipeThrough(ds).getReader();
const trozos = []; let total = 0;
for (;;) {
const { done, value } = await lector.read();
if (done) break;
total += value.length;
if (total > MAX) { try { await lector.cancel(); } catch {} throw new Error("BBQr: al descomprimirlo supera los 4 MB; no se lee."); }
trozos.push(value);
}
const out = new Uint8Array(total); let o = 0;
for (const t of trozos) { out.set(t, o); o += t.length; }
return out;
}
// ── El colector: recibe lo que lee la cámara, trozo a trozo ─────────────