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.
This folder contains a Val Town version of the demo.
- It uses the
webauthxbuild fromhttps://pkg.pr.new/webauthx@308444c. - Because Val Town's runtime currently chokes on direct imports from that PR package URL, the server-side
webauthxcode used by this Val is vendored from that exact installed package intovendor/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_KEYenvironment variable in Val Town before using it in production.
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.