onlyn00bs-badge

OnlyN00bs: a DEF CON 34 friend-finder badge. ESP32 firmware, Web Bluetooth setup app, printable case
git clone https://git.virtualshack.io/onlyn00bs-badge.git
Log | Files | Refs | README | LICENSE

commit b963e2986d162adbec1fea3198b08c6e918e7257
parent 42d362d3357b9373c265d5910c0a2546846e67ec
Author: virtualtack <[email protected]>
Date:   Thu, 15 Oct 2026 03:06:05 +0000

app, web: snapshot of v1.10-9-gae1c317

Changed, by area:
  app: 1 file
  web: 11 files

Diffstat:
MSNAPSHOT.md | 2+-
Mprovisioning/index.html | 16+++++++++-------
Mweb/src/assets/badge.css | 8++++++++
Aweb/src/assets/gallery/dc34-10.jpg | 0
Aweb/src/assets/gallery/dc34-11.jpg | 0
Aweb/src/assets/gallery/dc34-12.jpg | 0
Aweb/src/assets/gallery/thumbs/dc34-10.jpg | 0
Aweb/src/assets/gallery/thumbs/dc34-11.jpg | 0
Aweb/src/assets/gallery/thumbs/dc34-12.jpg | 0
Mweb/src/gallery/index.html | 14+++++++++++++-
Mweb/src/index.html | 34++++++++++++++++------------------
Mweb/src/sw.js | 2+-
Aweb/src/update/index.html | 177+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
13 files changed, 225 insertions(+), 28 deletions(-)

diff --git a/SNAPSHOT.md b/SNAPSHOT.md @@ -1,7 +1,7 @@ # About this snapshot This repository is the public release of the OnlyN00bs badge, taken from its private -development repo at `v1.10-2-g2ddd89f` on 2026-09-26. It holds what describes the **production unit +development repo at `v1.10-9-gae1c317` on 2026-10-15. It holds what describes the **production unit as it is**: the firmware, the Web Bluetooth setup app, the site, the parts list, and the case. diff --git a/provisioning/index.html b/provisioning/index.html @@ -58,7 +58,7 @@ <div id="status"></div> <div class="hint"> - Needs <b>Chrome / Edge</b> (Web Bluetooth) over <b>https</b> or <b>localhost</b>.<br/> + Needs <b>Chrome / Edge</b> (or <b>Bluefy</b> on iOS) for Web Bluetooth, over <b>https</b> or <b>localhost</b>.<br/> Put the badge in setup mode (either by holding the microcontroller's BOOT button on boot (requires opening the case), or <b>Options → Badge Settings → Developer Options → Provisioning Mode</b>), then <b>type the 3-char code shown on its screen</b> above, hit connect, and pick <code>badge-setup-&lt;MAC&gt;</code> (the full MAC matches your bench roster).<br/>The badge ignores @@ -525,9 +525,10 @@ jsonBtn.addEventListener("click", exportJson); // ── browser gate ─────────────────────────────────────────────────────────── - // Web Bluetooth is Chrome/Edge only, and needs https or localhost. Every iOS - // browser is WebKit underneath, so no iPhone can provision a badge — Chrome for - // iOS included. Say that up front instead of handing someone a dead button. + // Web Bluetooth is Chrome/Edge (plus Bluefy on iOS), and needs https or localhost. + // Safari and Chrome for iOS lack it, but Bluefy exposes navigator.bluetooth, so it + // passes the check below and never sees the iOS message. Say that up front instead + // of handing someone a dead button. (function gateCheck() { const gate = $("gate"); const ua = navigator.userAgent; @@ -538,9 +539,10 @@ let msg; if (isIOS) { - msg = `<p><b>iOS can't do this.</b></p><p>Web Bluetooth doesn't exist on iPhone or - iPad — every iOS browser is Safari underneath, so Chrome for iOS won't help - either. Borrow an <b>Android phone or a laptop</b> running Chrome or Edge.</p>`; + msg = `<p><b>This iOS browser can't do Bluetooth.</b></p><p>Safari and Chrome for + iOS don't support Web Bluetooth. Open this page in <b><a href="https://bluefy.app/">Bluefy</a></b> (an iOS + browser that does), or use an <b>Android phone or a laptop</b> running Chrome + or Edge.</p>`; } else if (insecure) { msg = `<p><b>Insecure page.</b></p><p>Web Bluetooth only runs over <b>https</b> or <b>localhost</b>. Open this page at its https address, or serve it locally diff --git a/web/src/assets/badge.css b/web/src/assets/badge.css @@ -41,6 +41,11 @@ } } +/* Per-page accent swap: <body class="theme-purple"> trades the mint for the purple of + .cta.purple (used on /update/). Light mode gets the darker focus purple: 5.9:1 on #fafafa. */ +.theme-purple { --accent: #9b8cff; } +@media (prefers-color-scheme: light) { .theme-purple { --accent: #5b4fe0; } } + * { box-sizing: border-box; } body { @@ -122,6 +127,9 @@ hr { border: 0; border-top: 1px solid var(--rule); margin: 36px 0; } } .cta:hover, .cta:focus { color: #08110b; text-decoration: none; opacity: .9; } /* keep the dark label: a:hover would turn it pink */ +/* Purple variant, for a secondary CTA beside the mint one. Same dark label: 7.0:1 on it. */ +.cta.purple { background: #9b8cff; } + /* Non-link CTA while the setup app isn't hosted yet: same shape, but muted and inert. */ .cta.disabled { cursor: default; diff --git a/web/src/assets/gallery/dc34-10.jpg b/web/src/assets/gallery/dc34-10.jpg Binary files differ. diff --git a/web/src/assets/gallery/dc34-11.jpg b/web/src/assets/gallery/dc34-11.jpg Binary files differ. diff --git a/web/src/assets/gallery/dc34-12.jpg b/web/src/assets/gallery/dc34-12.jpg Binary files differ. diff --git a/web/src/assets/gallery/thumbs/dc34-10.jpg b/web/src/assets/gallery/thumbs/dc34-10.jpg Binary files differ. diff --git a/web/src/assets/gallery/thumbs/dc34-11.jpg b/web/src/assets/gallery/thumbs/dc34-11.jpg Binary files differ. diff --git a/web/src/assets/gallery/thumbs/dc34-12.jpg b/web/src/assets/gallery/thumbs/dc34-12.jpg Binary files differ. diff --git a/web/src/gallery/index.html b/web/src/gallery/index.html @@ -17,7 +17,7 @@ <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="https://badge.virtualshack.io/assets/img/og-badge.jpg"> <!-- ?v= must match CACHE in ../sw.js — same rule as index.html --> -<link rel="stylesheet" href="../assets/badge.css?v=39"> +<link rel="stylesheet" href="../assets/badge.css?v=47"> <link rel="icon" type="image/svg+xml" href="../assets/icon.svg"> <link rel="manifest" href="../manifest.webmanifest"> <meta name="theme-color" content="#212121"> @@ -65,6 +65,18 @@ <a href="../assets/gallery/dc34-09.jpg" data-w="1600" data-h="1200"><img src="../assets/gallery/thumbs/dc34-09.jpg" alt="A mint-green badge on the home screen with pink foot, red dinosaur and cat charms, on its lanyard" width="720" height="540" loading="lazy" decoding="async"></a> </figure> + <figure> + <a href="../assets/gallery/dc34-10.jpg" data-w="1245" data-h="938"><img src="../assets/gallery/thumbs/dc34-10.jpg" alt="A desk covered in ESP32 dev boards, wired up in bundles of red, blue and green jumper leads beside a purple-lit keyboard" + width="720" height="542" loading="lazy" decoding="async"></a> + </figure> + <figure> + <a href="../assets/gallery/dc34-11.jpg" data-w="1245" data-h="938"><img src="../assets/gallery/thumbs/dc34-11.jpg" alt="About forty badges mid-assembly in blue, green, purple and pink cases, spread across a folding table with tools and bags of parts" + width="720" height="542" loading="lazy" decoding="async"></a> + </figure> + <figure> + <a href="../assets/gallery/dc34-12.jpg" data-w="1245" data-h="938"><img src="../assets/gallery/thumbs/dc34-12.jpg" alt="Three OnlyN00bs badges held up side by side on the home screen: a blue one, a black one in stealth mode, and a black one wearing a tophat, all decorated with charms" + width="720" height="542" loading="lazy" decoding="async"></a> + </figure> </div> <!-- gallery:end --> diff --git a/web/src/index.html b/web/src/index.html @@ -32,7 +32,7 @@ invisible to visitors for hours after a deploy. A new query = a new edge cache key = it lands immediately. Safe for offline: sw.js matches with ignoreSearch, so this still resolves to the precached bare URL. --> -<link rel="stylesheet" href="assets/badge.css?v=39"> +<link rel="stylesheet" href="assets/badge.css?v=47"> <link rel="icon" type="image/svg+xml" href="assets/icon.svg"> <link rel="manifest" href="manifest.webmanifest"> <meta name="theme-color" content="#212121"> @@ -64,6 +64,7 @@ <p class="small"><a href="gallery/">all photos →</a></p> <!-- gallery-preview:end --> + <p style="text-align:center"><a class="cta purple" href="update/">Update my badge →</a></p> <p style="text-align:center"><a class="cta" href="provision/">Set up my badge →</a></p> <!-- Changelog. Newest first, CAPPED AT THE 3 MOST RECENT — add to the top and drop the @@ -75,15 +76,13 @@ <div class="note log"> <p><b>What's new</b> <span class="small muted">— newest first</span></p> <ul class="small"> + <li><b>2026-10-15</b> · <b>Firmware update guide</b> — <a href="update/">update your badge</a> + over USB and keep your handle, points and log. Badges flashed before 2026-08-05 need it + to get <code>Badge Settings → Power → Deep sleep</code>.</li> + <li><b>2026-10-10</b> · <b>iPhone setup works now</b> — open the setup page in + <a href="https://bluefy.app/">Bluefy</a>, an iOS browser with Web Bluetooth. (s/o Vale)</li> <li><b>2026-09-26</b> · <b>The badge is open source</b> — firmware, setup app, this site, and the case models. <a href="#source">Source + license</a>.</li> - <li><b>2026-08-05</b> · New <b>Deep sleep</b> feature — put the badge into low power mode without unplugging the - battery. <code>Badge Settings → Power → Deep sleep</code>, then press the button to - wake it. <b>Reboot has moved into the same Power menu.</b> Badges flashed before - 2026-08-05 need a firmware update to get it.</li> - <li><b>2026-08-01</b> · <b>The setup app is live on this site</b> — hit - <a href="provision/">set up my badge</a> and go. Once you've loaded the PWA, it will - remain available for offline browser use.</li> </ul> </div> @@ -103,6 +102,7 @@ <li><a href="#button">// the button</a></li> <li><a href="#battery">// battery &amp; safety</a></li> <li><a href="#trouble">// troubleshooting</a></li> + <li><a href="update/">// updating the firmware</a></li> <li><a href="#privacy">// privacy</a></li> </ul> </nav> @@ -172,17 +172,15 @@ <p class="small muted" style="text-align:center"><code>git clone https://git.virtualshack.io/onlyn00bs-badge.git</code> · <a href="https://git.virtualshack.io/onlyn00bs-badge/releases/">releases</a></p> <ul> <li><b>License:</b> MIT for the code; CC BY-SA 4.0 for the case models, docs and photos.</li> - <li><b>Not included: the group key.</b> Badges only see badges signed with the same key, so - build your own crew with your own key and it won't talk to ours. The README says how.</li> - <li><b>Also not included: anyone's data.</b> Encounter logs and the list of who got which badge - stayed private. The repo is the badge, not the con.</li> + <li><b>Not included: the group key.</b></li> + <li><b>Also not included: anyone's data.</b></li> </ul> <h2 id="setup">// setup</h2> - <p>You need: the badge, a computer (with <b>Chrome or Edge</b>) or an Android phone, and about two - minutes. <b>Not an iPhone</b>: setup uses Web Bluetooth, which doesn't exist on iOS in any - browser.</p> + <p>You need: the badge, about two minutes, and one of: a computer with <b>Chrome or Edge</b>, + an Android phone, or an iPhone/iPad with <a href="https://bluefy.app/">Bluefy</a>. (Setup uses Web Bluetooth; Safari and + Chrome for iOS don't have it.)</p> <ol> <li><b>Put the badge in setup mode.</b> From the badge: <code>OPTIONS → Badge Settings → @@ -293,8 +291,8 @@ <dl> <dt>The setup page has no "connect" button, or the button does nothing</dt> - <dd>You're on a browser without Web Bluetooth. Use Chrome or Edge on a laptop or - Android. iOS cannot do this at all — I wasn't lying before lol.</dd> + <dd>Your browser doesn't have Web Bluetooth. Switch to Chrome or Edge (laptop or + Android) or <a href="https://bluefy.app/">Bluefy</a> (iPhone/iPad).</dd> <dt>FINDER shows nobody</dt> <dd>In order of likelihood: (1) nobody is actually in range — the radio range is in the tens @@ -307,7 +305,7 @@ encounters — and it has no battery-backed clock, so it gets the time from your phone or laptop during setup. After a battery swap that can drift; the REPORT view then shows <em>relative</em> times instead of real ones. Run <em>sync clock only</em> in the setup app - to fix it. Don't do this on an iPhone-only trip — you can't (sensing the theme yet?).</dd> + to fix it. Any setup-capable browser works, including <a href="https://bluefy.app/">Bluefy</a> on iPhone.</dd> <dt>I'm stuck on the SETUP MODE screen</dt> <dd><b>Hold the button for 5 seconds.</b> The screen counts down and the badge reboots diff --git a/web/src/sw.js b/web/src/sw.js @@ -17,7 +17,7 @@ * there is one version to remember, not two. */ -const CACHE = "onlyn00bs-v39"; +const CACHE = "onlyn00bs-v47"; // Resolved against the worker's own location, so it's right whether the site is served at // / (production) or under a path (a local preview). diff --git a/web/src/update/index.html b/web/src/update/index.html @@ -0,0 +1,177 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<title>onlyn00bs badge · update the firmware</title> +<meta name="description" content="Update an OnlyN00bs badge to the latest firmware over USB, keeping your handle, points and log."> +<meta name="color-scheme" content="dark light"> +<meta property="og:title" content="onlyn00bs badge · update the firmware"> +<meta property="og:description" content="Update an OnlyN00bs badge to the latest firmware over USB, keeping your handle, points and log."> +<meta property="og:type" content="website"> +<meta property="og:site_name" content="virtualshack"> +<meta property="og:url" content="https://badge.virtualshack.io/update/"> +<meta property="og:image" content="https://badge.virtualshack.io/assets/img/og-badge.jpg"> +<meta property="og:image:width" content="1200"> +<meta property="og:image:height" content="630"> +<meta name="twitter:card" content="summary_large_image"> +<meta name="twitter:image" content="https://badge.virtualshack.io/assets/img/og-badge.jpg"> +<!-- ?v= must match CACHE in ../sw.js — same rule as index.html --> +<link rel="stylesheet" href="../assets/badge.css?v=47"> +<link rel="icon" type="image/svg+xml" href="../assets/icon.svg"> +<link rel="manifest" href="../manifest.webmanifest"> +<meta name="theme-color" content="#212121"> +</head> +<body class="theme-purple"> +<main class="wrapper" id="top"> + + <h1>// update the firmware</h1> + <p class="tagline">latest firmware: v1.10 · released 2026-09-26</p> + <p class="small muted"><a href="https://virtualshack.io/">virtualshack.io</a> / + <a href="../">badge</a> / update</p> + + <p>Updating takes about 15 minutes over USB: you build the firmware from source and flash it + with PlatformIO. Your handle, points, friends and encounter log are kept. No OTA (yet).</p> + + <nav class="toc"> + <ul> + <li><a href="#before">// before you start</a></li> + <li><a href="#get">// download the latest firmware</a></li> + <li><a href="#connect">// connect the badge</a></li> + <li><a href="#flash">// flash the firmware</a></li> + <li><a href="#check">// verify that it worked</a></li> + <li><a href="#trouble">// troubleshooting</a></li> + </ul> + </nav> + + <h2 id="before">// before you start</h2> + <p>If your badge has <b>Badge Settings → Power → Deep sleep</b>, you already have the latest + firmware (v1.10, released 2026-09-26). Badges flashed before 2026-08-05 do not have that + menu and need this update.</p> + <p>To see your exact build, open <b>OPTIONS → Whoami</b>; it shows something like + <code>v1.10 32c3255 ch1</code> (version, build commit, channel).</p> + + <p>You need:</p> + <ul> + <li><b>A USB-C cable</b></li> + <li><b>A computer</b> with <code>git</code> and Python</li> + <li><b>PlatformIO Core:</b> <code>pipx install platformio</code> (or + <code>pip install platformio</code> i guess) The ESP32 toolchain downloads on first + build.</li> + <li><b>The group key file, <code>secrets.h</code></b>, ask virtualtack for it. Without it + your badge will stop seeing everyone else's.</li> + <li><b>The USB driver</b> for the badge's CH340 serial chip: + <ul> + <li><b>macOS:</b> install <code>CH34xVCPDriver.dmg</code> from + <a href="https://github.com/WCHSoftGroup/ch34xser_macos" target="_blank" rel="noopener">WCH on GitHub</a> + <ul> + <li>Run the app, click Install, then enable it in System Settings → General → Login + Items &amp; Extensions → Driver Extensions. Unplug and replug the badge.</li> + </ul> + </li> + <li><b>Linux:</b> already built into the kernel. + <ul> + <li>Add yourself to the <code>dialout</code> group + (<code>sudo usermod -aG dialout $USER</code>, then log out and in).</li> + </ul> + </li> + <li><b>Windows:</b> get the CH340 driver from WCH (CH341SER).</li> + </ul> + </li> + </ul> + + <h2 id="get">// download the latest firmware</h2> + <p>Clone the public source and drop the group key into it. The key never goes in git, so it + stays only on your machine.</p> + <ol> + <li>Clone the source: +<pre><code>git clone https://git.virtualshack.io/onlyn00bs-badge.git +cd onlyn00bs-badge</code></pre></li> + <li>Copy the <code>secrets.h</code> you were sent to <code>firmware/src/secrets.h</code>.</li> + <li>Check it is the right key. This prints a fingerprint of the key without revealing it: +<pre><code>python3 -c 'import re,hashlib;b=open("firmware/src/secrets.h").read().split("GROUP_PSK[] = {")[1].split("};")[0];print(hashlib.sha256(bytes(int(x,16) for x in re.findall(r"0x([0-9a-fA-F]{2})",b))).hexdigest()[:16])'</code></pre> + It must print <code>a4dc586d0276fa51</code>. Anything else means the wrong file: stop and + ask for the right one.</li> + </ol> + <div class="note stop"> + <p><b>Don't generate a new key with <code>openssl rand</code>.</b> If you do your badge will + be on its own private network, and it will quietly find nobody.</p> + </div> + + <h2 id="connect">// connect the badge</h2> + <p>No button presses are needed - the flasher resets the badge into update mode. Find its + port:</p> + <dl> + <dt>macOS</dt> + <dd><code>ls /dev/cu.wchusbserial*</code> → PORT looks like <code>/dev/cu.wchusbserial10</code></dd> + <dt>Linux</dt> + <dd><code>ls /dev/ttyUSB*</code> → PORT looks like <code>/dev/ttyUSB0</code></dd> + <dt>Windows</dt> + <dd>Device Manager → Ports (COM &amp; LPT) → PORT looks like <code>COM3</code> ("USB-SERIAL CH340")</dd> + </dl> + + <h2 id="flash">// flash the firmware</h2> + <p>One command builds and flashes. From the <code>onlyn00bs-badge</code> folder, replace + <code>PORT</code> with your port:</p> +<pre><code>pio run -d firmware -e oled_v3_prod -t upload --upload-port PORT</code></pre> + <p>The first run takes several minutes while PlatformIO downloads the ESP32 toolchain. Later + runs take about 45 seconds. It is done when you see <code>Hash of data verified.</code> + followed by <code>[SUCCESS]</code>. Then the badge restarts by itself.</p> + <p>Two things to get right:</p> + <ul> + <li><b>Use <code>oled_v3_prod</code></b> + <ul> + <li><b>not <code>oled</code> or <code>oled_v3</code></b></li> + <li>i mean, you can use those if you want to, but your badge won't work</li> + </ul> + </li> + <li><b>Don't erase the badge.</b> + <ul> + <li>Erasing is for setting up brand-new badges and wipes everything first: including + your handle, points and logs. A plain upload replaces only the firmware and keeps + your data.</li> + </ul> + </li> + </ul> + + <h2 id="check">// verify that it worked</h2> + <p>The update worked if the badge boots to HOME as you, with your handle and points + intact.</p> + <ul> + <li><b>Badge Settings → Power → Deep sleep</b> now exists.</li> + <li><b>OPTIONS → Whoami</b> shows <code>v1.10</code> and a build code with no + <code>+</code> on the end.</li> + <li>Near another badge, it shows up in <b>FINDER</b> within a minute.</li> + </ul> + <p>For a closer look, watch the boot log with + <code>pio device monitor -p PORT -b 115200</code> (Ctrl-C to exit). It should show + <code>build : v1.10 …</code> and <code>mode : DISCOVERY</code> with your handle.</p> + + <h2 id="trouble">// troubleshooting</h2> + <dl> + <dt>No port appears</dt> + <dd>Try a different cable (most likely charge-only). On macOS, check the CH34x driver is + enabled in Driver Extensions. On Ubuntu, <code>sudo apt remove brltty</code> if the port + appears and vanishes.</dd> + <dt><code>Permission denied</code> on the port (Linux)</dt> + <dd>Add yourself to <code>dialout</code> and log out and back in.</dd> + <dt>Build fails with an error about the group key</dt> + <dd><code>secrets.h</code> is missing or in the wrong place. It must be at + <code>firmware/src/secrets.h</code>.</dd> + <dt><code>Failed to connect to ESP32</code></dt> + <dd>Unplug, replug, and run the command again. Close any serial monitor that has the port + open.</dd> + <dt>Upload stopped partway</dt> + <dd>Run it again. A half-written firmware can't brick the badge, because the bootloader is + never touched.</dd> + <dt>FINDER shows nobody after the update</dt> + <dd>Rerun the key fingerprint check. A wrong key looks exactly like "nobody in range". Then + compare <b>Whoami</b> with a friend's badge.</dd> + </dl> + <p>Still stuck? Send virtualtack the output of <code>pio run</code>.</p> + + <p style="text-align:center"><a class="totop" href="../">← back to the badge</a></p> + +</main> +</body> +</html>