{"id":35169776,"url":"https://github.com/acoyfellow/bio","last_synced_at":"2026-05-17T23:32:54.830Z","repository":{"id":325351051,"uuid":"1100835450","full_name":"acoyfellow/bio","owner":"acoyfellow","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-20T21:12:49.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-20T22:23:24.839Z","etag":null,"topics":["authentication","biometrics","cloudflare-workers"],"latest_commit_sha":null,"homepage":"https://bio.coey.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acoyfellow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-20T20:31:12.000Z","updated_at":"2025-11-20T21:12:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/acoyfellow/bio","commit_stats":null,"previous_names":["acoyfellow/bio"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/acoyfellow/bio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoyfellow%2Fbio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoyfellow%2Fbio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoyfellow%2Fbio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoyfellow%2Fbio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acoyfellow","download_url":"https://codeload.github.com/acoyfellow/bio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acoyfellow%2Fbio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33159099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"ssl_error","status_checked_at":"2026-05-17T22:39:10.741Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","biometrics","cloudflare-workers"],"created_at":"2025-12-28T20:04:44.247Z","updated_at":"2026-05-17T23:32:54.825Z","avatar_url":"https://github.com/acoyfellow.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bio-Authed Edge Agent\n\nA minimal, pragmatic biometric authentication system on Cloudflare Workers with SSR and WebAuthn.\n\n## Bio as a Primitive\n\nThis isn't just a login demo - it's a building block for human-in-the-loop systems.\n\n**The Pattern:**\n\nPasskeys provide cryptographic proof of human intent at a specific moment. Not \"this user logged in yesterday\" - but \"a real human with physical access to this device approved this action right now.\"\n\n**Use Cases:**\n\n- **Agent Authorization**: AI wants to send an email? Delete 1000 messages? Require biometric signature before execution.\n\n- **Time-bound Delegation**: Sign once to authorize \"AI can read my email for 8 hours\" - revokable at any time.\n\n- **High-stakes Operations**: Financial transactions, data deletion, permission changes - anything that shouldn't happen without explicit human approval.\n\n- **Multi-device Control**: Each device gets its own passkey. Revoke access per-device. Track which device authorized what.\n\n**Why Passkeys:**\n\n- Phishing-resistant (bound to your domain)\n\n- No passwords to leak\n\n- Works across devices via cloud sync\n\n- Native OS integration (Face ID, Touch ID, Windows Hello)\n\nThe future of AI agents isn't \"give them full access\" - it's \"they request, humans authorize, cryptographically.\"\n\n## What This Is\n\nSingle \"Auth\" button flow:\n- **New users**: Registers a biometric credential (fingerprint, face, PIN)\n- **Existing users**: Logs in with their registered credential\n- **Session**: One-tap authentication, persistent session cookie\n- **Agent**: Server-side agent runs on auth, results displayed SSR (no client fetch)\n\nNo separate login/register screens. No double biometric prompts. One flow, one credential per user.\n\n## Tech Stack\n\n- **Cloudflare Workers**: Serverless runtime\n- **D1 Database**: SQLite edge database\n- **WebAuthn**: Client-side biometric auth via `@simplewebauthn/server`\n- **Hono + JSX**: Lightweight web framework + SSR\n- **Drizzle ORM**: Type-safe database queries\n\n## Features\n\n- ✅ Biometric registration \u0026 login (single flow)\n- ✅ Server-side session management with cookies\n- ✅ SSR: Auth state \u0026 agent data on page load\n- ✅ Works on localhost \u0026 production domains\n- ✅ Cross-platform authenticators supported (platform + external)\n- ✅ User verification via PIN/fingerprint\n\n## Setup\n\n```bash\n# Install deps\nbun install\n\n# Generate migrations (after schema changes)\nbun run db:generate\n\n# Run dev\nbun run dev\n\n# Deploy\nDOMAINS=yourdomain.com SESSION_SECRET=$(openssl rand -hex 32) bun run deploy\n```\n\n**Environment Variables (Production)**:\n- `DOMAINS`: Comma-separated list of domains (e.g., `yourdomain.com`)\n- `SESSION_SECRET`: 32-character hex string for session signing (generated on deploy if not set)\n\n## Live Demo\n\n[https://bio.coey.dev](https://bio.coey.dev)\n\n**Source**: [github.com/acoyfellow/bio](https://github.com/acoyfellow/bio)\n\n## Project Structure\n\n```\nsrc/\n  app.tsx          # SSR UI component with client-side auth flow\n  worker.tsx       # Hono routes: registration, login, agent\n  webauthn.ts      # WebAuthn setup (start/finish registration \u0026 auth)\n  d1.ts            # Database helpers (users, credentials, sessions)\n  agent.ts         # Agent logic (runs on auth, server-side)\n  cookies.ts       # Session cookie helpers\n  challenges.ts    # Challenge storage (in-memory, for dev)\n  schema.ts        # Drizzle schema\n  utils.ts         # Base64 encoding/decoding\n```\n\n## Auth Flow\n\n1. User clicks \"Auth\"\n2. Client calls `/webauthn/register/start` → server creates challenge\n3. Browser prompts for biometric (fingerprint/face/PIN)\n4. Client calls `/webauthn/register/finish` → server verifies, stores credential\n5. Server creates session cookie \u0026 returns `{ success: true }`\n6. Client reloads page\n7. Server checks session cookie, runs agent, renders SSR with auth state + agent data\n8. User sees \"Logged in as: [username]\" + agent output + Logout button\n\nSubsequent logins re-use the same credential (same biometric, no re-registration).\n\n## Security\n\n- ✅ Session signing with HMAC-SHA256\n- ✅ Rate limiting on auth endpoints (10 reqs/min per IP, per-instance)\n- ✅ CSRF protection (Origin/Referer validation)\n- ✅ Generic error messages (no user enumeration)\n- ✅ Counter rollback detection (cloned key protection)\n- ✅ Challenges stored in D1 with automatic TTL cleanup\n- ✅ Sessions stored in D1 with automatic expiry cleanup\n- ✅ HttpOnly, Secure, SameSite=Strict cookies\n- ✅ Username validation (alphanumeric + underscore)\n- ✅ Input sanitization on agent output\n- ✅ Discoverable credentials (users don't need username to log in)\n\n## Notes\n\n- **RP ID**: Auto-detected from hostname (localhost on dev, prod domain in production)\n- **User Verification**: Set to `\"preferred\"` (PIN, fingerprint, or face unlock)\n- **Resident Keys**: Not required (single device, single credential per user)\n- **Production**: All security features enabled by default\n\n## Why This Approach\n\n- **Minimal**: 400 lines of meaningful code (no bloat)\n- **Pragmatic**: Single auth flow eliminates UX confusion\n- **SSR**: No flashing or hydration mismatch\n- **Fast**: One biometric prompt per auth\n- **Secure**: WebAuthn + server-validated sessions\n\nNo magic, no overthinking. Auth that just works.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facoyfellow%2Fbio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facoyfellow%2Fbio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facoyfellow%2Fbio/lists"}