Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ Two caveats worth stating plainly, since "everything is local" is the headline c
- **QR Code Generator**: Generate QR codes from text, URLs, contact information, and more.
- **Barcode Generator**: Generate various barcode types including CODE128, EAN-13, UPC-A, CODE39, and more.
- **QR Code Scanner**: Scan QR codes using your camera or upload an image.
- **Airgap QR Transfer**: Stream and transfer files securely between devices using animated QR codes without internet, local network, or cables.
- **Barcode Scanner**: Scan barcodes using your camera or upload an image.
- **Charts**: Create beautiful, customizable charts with full control over every detail.
- **YAML ↔ JSON**: Convert between YAML and JSON formats instantly.
Expand Down
Binary file modified bun.lockb
Binary file not shown.
8 changes: 6 additions & 2 deletions messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,12 @@
"description": "أنشئ رموز QR من نصوص أو روابط أو أي بيانات."
},
"qr-scanner": {
"name": "قارئ رمز QR",
"description": "امسح وفكّ رموز QR من الكاميرا أو الصور المرفوعة."
"name": "ماسح رموز QR",
"description": "امسح رموز QR وفك تشفيرها من الكاميرا أو الصور المرفوعة."
},
"airgap-transfer": {
"name": "نقل الملفات المعزول (Airgap QR)",
"description": "نقل الملفات بأمان بين الأجهزة المعزولة دون إنترنت عبر بث رموز QR المتحركة."
},
"barcode-generator": {
"name": "مولّد الباركود",
Expand Down
4 changes: 4 additions & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@
"name": "QR Scanner",
"description": "Scan and decode QR codes from your camera or uploaded images."
},
"airgap-transfer": {
"name": "Airgap QR Transfer",
"description": "Stream and transfer files securely between offline devices via animated QR codes."
},
"barcode-generator": {
"name": "Barcode Generator",
"description": "Generate barcodes in multiple formats: EAN, UPC, Code128, and more."
Expand Down
57 changes: 57 additions & 0 deletions src/__tests__/lib/airgap-protocol.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { describe, it, expect } from "vitest";
import {
prepareFileForAirgap,
parseAirgapPacket,
compressBytes,
decompressBytes,
computeChecksum,
} from "@/lib/airgap-protocol";

describe("airgap-protocol", () => {
it("compresses and decompresses byte buffers correctly", async () => {
const text = "BrowseryTools AirQA fast airgap transfer protocol test string repeated many times ".repeat(20);
const original = new TextEncoder().encode(text);
const compressed = await compressBytes(original);
expect(compressed.length).toBeLessThan(original.length);

const decompressed = await decompressBytes(compressed);
expect(new TextDecoder().decode(decompressed)).toBe(text);
});

it("splits a file into valid AG1 packets and parses them back", async () => {
const content = "Confidential air-gapped payload ".repeat(50);
const blob = new Blob([content], { type: "text/plain" });
const file = new File([blob], "secret-document.txt", { type: "text/plain" });

const { meta, packets } = await prepareFileForAirgap(file, 200);
expect(packets.length).toBeGreaterThan(0);
expect(meta.fileName).toBe("secret-document.txt");
expect(meta.totalChunks).toBe(packets.length);

const parsedPackets = packets.map((p) => parseAirgapPacket(p));
for (const parsed of parsedPackets) {
expect(parsed).not.toBeNull();
expect(parsed?.fileName).toBe("secret-document.txt");
expect(parsed?.totalChunks).toBe(packets.length);
}

// Reconstruct
const sorted = [...parsedPackets].sort((a, b) => a!.chunkIdx - b!.chunkIdx);
const totalLen = sorted.reduce((acc, p) => acc + p!.data.length, 0);
const merged = new Uint8Array(totalLen);
let offset = 0;
for (const p of sorted) {
merged.set(p!.data, offset);
offset += p!.data.length;
}

const reconstructed = sorted[0]!.isCompressed ? await decompressBytes(merged) : merged;
expect(new TextDecoder().decode(reconstructed)).toBe(content);
});

it("computes 8-character checksum correctly", async () => {
const data = new Uint8Array([1, 2, 3, 4, 5]);
const hash = await computeChecksum(data);
expect(hash).toHaveLength(8);
});
});
9 changes: 9 additions & 0 deletions src/app/tools/airgap-transfer/opengraph-image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { generateToolOgImage, ogSize, ogContentType } from "@/lib/og-image";

export const alt = "airgap-transfer | BrowseryTools";
export const size = ogSize;
export const contentType = ogContentType;

export default function Image() {
return generateToolOgImage("airgap-transfer");
}
8 changes: 8 additions & 0 deletions src/app/tools/airgap-transfer/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { generateToolMetadata } from "@/lib/metadata";
import AirgapTransfer from "@/components/AirgapTransfer";

export const metadata = generateToolMetadata("/tools/airgap-transfer");

export default function AirgapTransferPage() {
return <AirgapTransfer />;
}
9 changes: 9 additions & 0 deletions src/app/tools/airgap-transfer/twitter-image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { generateToolOgImage, ogSize, ogContentType } from "@/lib/og-image";

export const alt = "airgap-transfer | BrowseryTools";
export const size = ogSize;
export const contentType = ogContentType;

export default function Image() {
return generateToolOgImage("airgap-transfer");
}
Loading
Loading