Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

Val Town deployment

This folder contains a Val Town version of the demo.

Notes

  • It uses the webauthx build from https://pkg.pr.new/webauthx@308444c.
  • Because Val Town's runtime currently chokes on direct imports from that PR package URL, the server-side webauthx code used by this Val is vendored from that exact installed package into vendor/webauthx/.
  • It serves the UI and API from a single Val.
  • For Val Town portability, it stores the registered credential in a signed cookie instead of Cloudflare KV.
    • This means the passkey is remembered per browser profile, not in a shared server database.
  • Set a SECRET_KEY environment variable in Val Town before using it in production.

Create + push

cd valtown vt create webauth-aaguid --private --upload-if-exists vt push

Then open the Val in the browser and add an environment variable named SECRET_KEY in Val Town settings. Use a long random string.

If you rename the Val, that is fine — WebAuthn origin and RP ID are derived from the request URL at runtime.