{
  "id": "tneemo/hono-auth",
  "kind": "module",
  "description": "Email and password accounts for Hono APIs: register, login, JWT bearer tokens, requireAuth middleware, scrypt password hashing.",
  "version": "1.0.0",
  "keywords": [
    "auth",
    "authentication",
    "login",
    "signup",
    "register",
    "users",
    "accounts",
    "jwt",
    "password",
    "session"
  ],
  "requires": {
    "hono": ">=4.10",
    "typescript": "*"
  },
  "provides": [
    "auth",
    "users",
    "jwt"
  ],
  "license": "MIT",
  "repository": "https://github.com/tneemo/pkg",
  "risk": "ok",
  "quality": 100,
  "downloads": 1,
  "agent_reports": {
    "success": 0,
    "failure": 0,
    "success_rate": 0.5
  },
  "flags": 0,
  "reputation": 0.51,
  "updated_at": "2026-10-19T14:10:32.732Z",
  "latest": "1.0.0",
  "manifest": {
    "$schema": "https://pkg.tneemo.com/schema/pkg.json",
    "name": "hono-auth",
    "version": "1.0.0",
    "kind": "module",
    "description": "Email and password accounts for Hono APIs: register, login, JWT bearer tokens, requireAuth middleware, scrypt password hashing.",
    "license": "MIT",
    "keywords": [
      "auth",
      "authentication",
      "login",
      "signup",
      "register",
      "users",
      "accounts",
      "jwt",
      "password",
      "session"
    ],
    "stack": {
      "requires": {
        "hono": ">=4.10",
        "typescript": "*"
      },
      "provides": [
        "auth",
        "users",
        "jwt"
      ]
    },
    "builds": {
      "tneemo/sqlite-db": "^1.0.0"
    },
    "dependencies": {
      "npm": {
        "zod": ">=3.23.0"
      }
    },
    "env": {
      "JWT_SECRET": {
        "description": "Secret used to sign login tokens. Required in production.",
        "example": "replace-with-a-long-random-string",
        "required": true
      },
      "JWT_TTL_SECONDS": {
        "description": "Token lifetime in seconds (default 7 days)",
        "example": "604800"
      }
    },
    "repository": "https://github.com/tneemo/pkg"
  },
  "readme": "# hono-auth\n\nEmail and password accounts for [Hono](https://hono.dev) APIs.\n\n- `POST /register` `{ email, password }` creates an account and returns `{ user, token }` (201).\n- `POST /login` `{ email, password }` returns `{ user, token }`.\n- `GET /me` with `Authorization: Bearer <token>` returns the current user.\n- `requireAuth` middleware protects any route and exposes `c.get(\"user\")` (`{ id, email }`), typed via `AuthEnv`.\n\nPasswords are hashed with scrypt (Node's crypto, no native modules) and compared in constant time. Tokens are HS256 JWTs signed with `JWT_SECRET` (7-day lifetime by default); in production, signing fails without a secret. Emails are normalized to lower case and unique.\n\nStores users in SQLite through `tneemo/sqlite-db`, which is installed automatically along with the `users` table migration.\n",
  "integration": "1. Mount the routes where the Hono app is created (`src/app.ts` in `tneemo/hono-api`):\n   ```ts\n   import { authRoutes } from \"./auth\";\n   app.route(\"/auth\", authRoutes);\n   ```\n   This adds `POST /auth/register`, `POST /auth/login` and `GET /auth/me`.\n2. Protect your own routes and read the signed-in user:\n   ```ts\n   import { Hono } from \"hono\";\n   import { requireAuth, type AuthEnv } from \"../auth\";\n\n   export const todoRoutes = new Hono<AuthEnv>();\n   todoRoutes.use(requireAuth);\n   todoRoutes.get(\"/\", (c) => {\n     const { id } = c.get(\"user\"); // the signed-in user's id\n     // ...\n   });\n   ```\n3. Reference users from your own tables with `user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE` in a new migration in `db/migrations/`.\n4. Set `JWT_SECRET` in production (tests and development use a built-in development secret).\n",
  "files": [
    {
      "path": "db/migrations/20260101000000_auth_users.sql",
      "size": 181
    },
    {
      "path": "src/auth/index.ts",
      "size": 273
    },
    {
      "path": "src/auth/middleware.ts",
      "size": 871
    },
    {
      "path": "src/auth/password.ts",
      "size": 904
    },
    {
      "path": "src/auth/routes.ts",
      "size": 2215
    },
    {
      "path": "src/auth/token.ts",
      "size": 919
    },
    {
      "path": "src/auth/users.ts",
      "size": 839
    },
    {
      "path": "test/auth.test.ts",
      "size": 2005
    }
  ],
  "checks": {
    "risk": "ok",
    "quality": 100,
    "findings": []
  },
  "integrity": "sha256-COrW1v1etQXhWQ7zlVnhYeWsidzf9krjlLwL4z8ON70=",
  "publisher": "admin:tneemo",
  "published_at": "2026-10-19T14:10:32.732Z",
  "versions": [
    {
      "version": "1.0.0",
      "published_at": "2026-10-19T14:10:32.732Z",
      "risk": "ok",
      "yanked": false
    }
  ]
}