fix(qr): accept a one-frame invitation; release v5.9.1
CodeQL Analysis / Analyze CodeQL (push) Canceled after 0s
Deploy Application / deploy (push) Canceled after 0s
Mirror to Codeberg / mirror (push) Canceled after 0s
Mirror to PrivacyGuides / mirror (push) Canceled after 0s

The scanner waited for four frames when shown a single one. Its chunk assembler
was written for SB1, which the generator always cuts into exactly four frames,
and its fallback branch claims any non-JSON string longer than 100 characters —
which a 151-character SBQ2 invitation is. A complete invitation was filed as
chunk 1 of 4, and the scan never finished.

SBQ2 payloads are now recognised as complete before any assembly runs, in both
the text and raw-byte forms, and the hard-coded frame count is marked as
belonging to SB1 so it is not read as a general rule.
This commit is contained in:
lockbitchat
2026-08-06 23:32:20 -04:00
parent 808fd99b73
commit 556727eb6f
13 changed files with 179 additions and 43 deletions
Vendored
+22 -2
View File
@@ -4231,14 +4231,31 @@ var EnhancedSecureP2PChat = () => {
try {
console.log("QR Code scanned:", scannedData.substring(0, 100) + "...");
console.log("Current buffer state:", qrChunksBufferRef.current);
if (scannedData.startsWith("SB2:") || scannedData.charCodeAt(0) === 2) {
qrChunksBufferRef.current = { id: null, total: 0, seen: /* @__PURE__ */ new Set(), items: [] };
if (showOfferStep) {
setAnswerInput(scannedData);
} else {
setOfferInput(scannedData);
}
setMessages((prev) => [...prev, {
message: "Invitation captured.",
type: "success"
}]);
setShowQRScannerModal(false);
return Promise.resolve(true);
}
if (scannedData.startsWith("SB1:bin:") || qrChunksBufferRef.current && qrChunksBufferRef.current.id) {
console.log("Binary chunk detected:", scannedData.substring(0, 50) + "...");
if (!qrChunksBufferRef.current.id) {
console.log("Initializing buffer for binary chunks");
qrChunksBufferRef.current = {
id: `bin_${Date.now()}`,
// SB1 payloads are split into exactly four
// frames by the generator above. SBQ2 never
// reaches here — it is one frame and is
// handled at the top of this function.
total: 4,
// We expect 4 chunks
seen: /* @__PURE__ */ new Set(),
items: [],
lastUpdateMs: Date.now()
@@ -4296,8 +4313,11 @@ var EnhancedSecureP2PChat = () => {
console.log("Initializing buffer for potential binary chunks");
qrChunksBufferRef.current = {
id: `bin_${Date.now()}`,
// SB1 payloads are split into exactly four
// frames by the generator above. SBQ2 never
// reaches here — it is one frame and is
// handled at the top of this function.
total: 4,
// We expect 4 chunks
seen: /* @__PURE__ */ new Set(),
items: [],
lastUpdateMs: Date.now()