L2 · BUILD projects

cat projects/wifi-qr-generator/README.md

Wi-Fi QR Generator

Make a QR code for a link, text or a Wi-Fi network, with an optional centre logo and a printable guest card. Everything runs in the browser: nothing is sent or stored.

Role
Designer and developer
Layers
L2 · BUILD Software DevelopmentL3 · RUN IT Support & Systems Administration
FIG. 01cat problem.md

Problem

Sharing Wi-Fi with guests usually means reading out a long password, and most online QR tools upload what you type, including network passwords, to someone else’s server.

FIG. 02cat constraints.md

Constraints

  • No server involvement at all: a Wi-Fi password must never leave the visitor's device.
  • The site's strict Content Security Policy forbids data: and blob: images.
  • The library had to be maintained; the original one hadn't been updated in years.
FIG. 03cat approach.md

Approach

A browser-only tool: the code is built from the text you type and drawn on a canvas, with no server call and no storage. Wi-Fi mode builds the standard network string with special characters escaped. Logos use the highest error correction and are capped in size so the code still scans.

  • Encoding: a maintained QR library set to UTF-8, so non-English network names encode correctly.
  • Wi-Fi payload: the standard format with backslash, semicolon, comma, colon and quote escaped.
  • Logo: read locally in the browser, error correction raised to the highest level, logo capped at a fifth of the width with a quiet margin.
  • Output: drawn on a canvas, downloadable as PNG or SVG, plus a print layout for a guest card (password shown only if you choose).
FIG. 04cat decisions.md

Decisions

  1. Canvas instead of image URLs. It works within the security policy without weakening it for one page.
  2. Test by scanning, not by looking. Automated tests decode the generated codes with a QR reader, including every special character and the largest logo.
FIG. 05cat what-went-wrong.md

What went wrong

  • The preview was always one change behind. It rendered from a delayed timer instead of the current input. Fix: render directly from the current state.
  • The preview went blank after navigating in from another page. A security exception scoped to this page didn't apply after client-side navigation. Fix: canvas drawing, so no exception is needed, and browser tests that arrive via the menu.
FIG. 06cat outcome.md

Outcome

Codes that scan with any phone camera, including network names with special or non-English characters, downloadable as PNG or SVG, plus a printable guest Wi-Fi card. No password ever leaves the device.

FIG. 07cat stack.md

Stack

TypeScript · React · Canvas API · a maintained QR library · Playwright tests with a QR decoder