Skip to content

Cloudflare Worker & WebAssembly

The plyqr/worker package provides an edge-deployed HTTP API and an interactive web demo running on Cloudflare Workers with WebAssembly (wasm32-unknown-unknown).


+--------------------------------------------------------+
| Cloudflare Edge |
| |
| +-----------------------+ +---------------------+ |
| | Static Web Assets | | Serverless API | |
| | - HTML5 Camera Feed | | - POST /api/encode | |
| | - jsQR Locator | | - POST /api/decode | |
| | - In-browser Canvas | | - WASM Rust Engine | |
| +-----------------------+ +---------------------+ |
+--------------------------------------------------------+
  • WASM Core: The core cryptographic and matrix logic is compiled to WebAssembly using wasm-bindgen, delivering near-native execution speed.
  • Serverless API: Generates SVG and PNG symbols on-the-fly with zero cold-start penalty.
  • Client-Side Scanner: Uses browser getUserMedia camera streams with real-time perspective correction and frame extraction.

  • Endpoint: POST /api/encode
  • Content-Type: application/json
{
"public_text": "https://example.com/verify/100",
"private_text": "Secret Serial #4819",
"key_hex": "4a1f...32bytes_hex...",
"version": 10,
"ec_level": "M",
"hidden_per_block": 4,
"noise_reserve": 2,
"private_ecc": 8
}

Response: Returns base64-encoded SVG or PNG image with HTTP 200.

  • Endpoint: POST /api/decode
  • Accepts an uploaded QR image or raw matrix buffer alongside the shared key, outputting the authenticated public and private payloads.