webauthndemo
AGENTS.md635 starsChanged 48 days agoApache-2.0View on GitHub
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> WebAuthnDemo…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 47
Always execute Node.js, npm, and npx commands through mise (/usr/local/google/home/agektmr/.local/bin/mise exec -- ...) rather than nvm.
- Distinctive: line 57
All new source files must include the standard Google LLC Apache 2.0 license header at the top of the file.
- Very specific: line 59
When developing features, updating dependencies, or fixing bugs, always use Git Worktrees under .worktree/<branch-name> (git worktree add …
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!--
Copyright 2026 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->Agent context and guidelines for WebAuthnDemo
Project overview and architecture
WebAuthnDemo (https://try-webauthn.appspot.com) is Google's reference TypeScript Relying Party implementation of the WebAuthn specification, designed for testing and inspecting WebAuthn registration (navigator.credentials.create) and authentication (navigator.credentials.get) ceremonies, CTAP/CBOR structures, and passkey behaviors across web and Android environments.
The backend runs on Node.js (v24+, native ES modules compiled from .mts to .mjs) using Express, express-handlebars for HTML template rendering, and express-session persisted to Google Cloud Firestore via firebase-admin. Server-side WebAuthn ceremony generation and verification are powered by @simplewebauthn/server, with authenticator metadata resolved from aaguid (passkey-authenticator-aaguids). User sign-in is handled by Firebase Authentication (firebase and firebaseui on the client, verified on the server via firebase-admin/auth).
The frontend lives under src/public/ and is built with TypeScript, Lit (lit), Material Web Components (@material/mwc-*, @material/card, @material/ripple), cbor-web for client-side CBOR decoding, and @alenaksu/json-viewer for interactive payload inspection. Rollup (rollup.config.js) bundles client scripts (main.ts and components.ts), compiles SCSS (style.scss), and copies static assets, Handlebars templates, firebase.json, and environment files into dist/.
Directory structure
src/server.mts: Express server entry point, Handlebars view engine setup, Digital Asset Links (/.well-known/assetlinks.json), passkey endpoints (/.well-known/passkey-endpoints), and mounting of/authand/webauthnrouters.src/libs/: Server-side application modules compiled bytsc --project ./src/tsconfig.jsonintodist/libs/*.mjs:config.mts: Environment configuration, Firebase Admin / Firestore initialization (switching automatically to local emulators whenNODE_ENVislocalhostor unset), andexpress-sessionsetup.auth.mts: Firebase Auth ID token verification (POST /auth/verify), session user info (POST /auth/userInfo), and sign-out (POST /auth/signout).webauthn.mts: WebAuthn registration and authentication option generation and response verification (/webauthn/registerRequest,/webauthn/registerResponse,/webauthn/signinRequest,/webauthn/signinResponse), credential management routes, AAGUID lookup (/webauthn/aaguids), and Android APK key hash origin resolution.credential.mts: Firestore CRUD operations for stored WebAuthn credentials.helper.mts: CSRF header validation (X-Requested-With) and session authorization middleware.
src/public/: Frontend source code bundled by Rollup intodist/public/:scripts/main.ts: Main UI logic, Firebase Auth sign-in flow, WebAuthn option form controls, ceremony execution, CBOR/JSON inspection, and credential list rendering.scripts/components.ts: Material Web Components and JSON viewer registration bundle.scripts/common.ts,scripts/util.ts,scripts/base64url.ts: Shared interfaces, DOM/fetch helpers, and base64url utilities.styles/style.scss&styles/style.js: Application styles compiled intodist/public/styles/style.css.tsconfig.json: Client-side TypeScript configuration used by@rollup/plugin-typescript.
src/templates/: Handlebars HTML views (index.html,layouts/main.html, andpartials/).prod.yaml&dev.yaml: Google App Engine Standard (nodejs24) deployment manifests for production (try-webauthn.appspot.com) and development (dev-dot-try-webauthn.appspot.com).
Build, local development, and deployment
Always execute Node.js, npm, and npx commands through mise (/usr/local/google/home/agektmr/.local/bin/mise exec -- ...) rather than nvm.
npm run build: Cleans./dist, runsrollup -c(bundlingsrc/public/and copying templates/assets andsrc/.env.developmenttodist/.env), and runstsc --project ./src/tsconfig.jsonto compile server.mtsfiles intodist/.npm run build:prod: Cleans./distand builds withNODE_ENV:production(disabling inline sourcemaps and copyingsrc/.envif present).npm run emulator: Starts local Firebase Firestore (localhost:8081) and Auth (127.0.0.1:9099) emulators for projecttry-webauthn, importing and exporting seed data from./.data.npm run dev: Starts the compiled server locally (NODE_ENV=localhost node dist/server.mjs) on port8080.npm run deploy/npm run deploy:prod: Deploysdev.yamlorprod.yamlto Google App Engine (--project=try-webauthn).
Coding standards and Git worktree workflow
All new source files must include the standard Google LLC Apache 2.0 license header at the top of the file. Maintain strict TypeScript typing across both backend (src/tsconfig.json) and frontend (src/public/tsconfig.json) targets, and always verify that npm run build succeeds with zero Rollup or TypeScript errors before committing.
When developing features, updating dependencies, or fixing bugs, always use Git Worktrees under .worktree/<branch-name> (git worktree add .worktree/<branch-name> -b <branch-name> origin/main) instead of switching branches in the repository root. Carry out all edits, builds, and commits inside .worktree/<branch-name>, and remove the worktree (git worktree remove .worktree/<branch-name>) once the pull request is merged.
<!-- END_OF_AGENTS_MD -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

