diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..d1c32a5
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,48 @@
+name: CI
+
+on:
+ pull_request:
+ push:
+ branches: [main]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ci-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ check:
+ name: Validate
+ runs-on: ubuntu-latest
+ env:
+ WRANGLER_SEND_METRICS: "false"
+ steps:
+ - uses: actions/checkout@v7
+
+ - uses: pnpm/action-setup@v6
+
+ - uses: actions/setup-node@v7
+ with:
+ node-version: 24
+ cache: pnpm
+
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+
+ - name: Lint
+ run: pnpm lint
+
+ - name: Format check
+ run: pnpm format:check
+
+ - name: Type check
+ run: pnpm typecheck
+
+ - name: Build
+ run: pnpm build
+
+ - name: Test
+ run: pnpm test
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..a683498
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,50 @@
+name: Deploy
+run-name: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.display_title || format('Manual deploy by {0}', github.actor) }}
+
+# ONE-167: 合并即自动部署 Cloudflare,合并/部署关口归用户。
+# Deploy only runs after CI on main is green, or by manual dispatch.
+
+on:
+ workflow_dispatch:
+ workflow_run:
+ workflows: ["CI"]
+ types: [completed]
+
+permissions:
+ contents: read
+
+jobs:
+ deploy:
+ if: ${{ github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main') }}
+ runs-on: ubuntu-latest
+ env:
+ WRANGLER_SEND_METRICS: "false"
+ steps:
+ - uses: actions/checkout@v7
+
+ - uses: pnpm/action-setup@v6
+
+ - uses: actions/setup-node@v7
+ with:
+ node-version: 24
+ cache: pnpm
+
+ - run: pnpm install --frozen-lockfile
+
+ - name: Build web
+ run: pnpm build:web
+
+ # Secrets are written to a private temp file and passed to wrangler as a
+ # secrets file — they never appear in the repo, logs, or wrangler.toml.
+ - name: Materialize secrets
+ env:
+ SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
+ SETUP_SECRET: ${{ secrets.SETUP_SECRET }}
+ run: node scripts/materialize-secrets.mjs
+
+ - name: Deploy Worker
+ working-directory: worker
+ env:
+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+ CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
+ run: pnpm exec wrangler deploy --secrets-file "$RUNNER_TEMP/secrets.json"
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..76857a1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+node_modules
+dist
+.wrangler
+*.local
+.DS_Store
+worker/src/db/schema.generated.ts
+.dev.vars
+*.tsbuildinfo
+web/dist
+pr-body.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..40b675e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,47 @@
+# nav
+
+单人个人导航 / 浏览器起始页(公开 + 私有双层链接)。Cloudflare Workers + D1,域名 `nav.oneboy.app`。
+
+Monorepo:
+- `worker/` — Hono Worker 后端(D1 schema 与迁移、鉴权、三组 API、setup 流程)
+- `web/` — React + Vite 前端(子单 B 开发中,目前为占位)
+
+## 本地开发
+
+```bash
+pnpm install
+cp worker/.dev.vars.example worker/.dev.vars # 填入本地 SESSION_SECRET / SETUP_SECRET
+pnpm dev # 同时起 worker (wrangler dev) 与 web (vite)
+```
+
+`worker/.dev.vars` 与真实密钥永不入库(`.gitignore` 已排除)。
+
+## 测试 / 校验
+
+```bash
+pnpm typecheck # web + worker
+pnpm test # worker 单测(vitest,真 SQLite 内存库跑迁移与 API 契约)
+pnpm lint && pnpm format:check
+```
+
+## 部署
+
+合并 `main` 后 GitHub Actions(`.github/workflows/deploy.yml`)自动部署 Cloudflare。
+需要在仓库 Secrets 配置(见 PR 说明,凭证不写入代码 / issue / 评论):
+
+| Secret | 用途 |
+| ----------------------- | -------------------------- |
+| `CLOUDFLARE_API_TOKEN` | wrangler 部署 |
+| `CLOUDFLARE_ACCOUNT_ID` | Cloudflare 账户 |
+| `SESSION_SECRET` | 会话签名密钥(≥16 位随机) |
+| `SETUP_SECRET` | setup 初始化令牌 |
+
+`worker/wrangler.toml` 中的 `CLOUDFLARE_ACCOUNT_ID_PLACEHOLDER`、`D1_DATABASE_ID_PLACEHOLDER` 需替换为实际值(或改用 wrangler 部署时的环境注入)。
+
+## 初始化(setup)
+
+线上首次部署、库中无账号时开放 setup:`POST /api/auth/setup`(header `X-Setup-Secret`)创建唯一所有者账号,创建后 setup 永久关闭,不设注册接口。
+
+## API 契约
+
+见 `docs/api-contract.md`(与前端冻结的 DTO 清单)。
diff --git a/biome.json b/biome.json
new file mode 100644
index 0000000..6aa2c04
--- /dev/null
+++ b/biome.json
@@ -0,0 +1,29 @@
+{
+ "$schema": "https://biomejs.dev/schemas/2.6.2/schema.json",
+ "files": {
+ "includes": [
+ "**",
+ "!**/node_modules",
+ "!**/dist",
+ "!**/.wrangler",
+ "!**/web/public",
+ "!**/web/dist",
+ "!**/worker/.wrangler",
+ "!**/worker/src/db/schema.generated.ts"
+ ]
+ },
+ "formatter": {
+ "enabled": true,
+ "indentStyle": "space"
+ },
+ "assist": { "actions": { "source": { "organizeImports": "on" } } },
+ "linter": {
+ "enabled": true,
+ "rules": {
+ "preset": "recommended",
+ "suspicious": {
+ "noExplicitAny": "off"
+ }
+ }
+ }
+}
diff --git a/docs/api-contract.md b/docs/api-contract.md
new file mode 100644
index 0000000..986bed2
--- /dev/null
+++ b/docs/api-contract.md
@@ -0,0 +1,121 @@
+# nav API 契约(冻结,ONE-168)
+
+字段命名 camelCase。变更须回父单 ONE-167 由 Mike 裁决。
+
+## 公开
+
+### GET /api/public
+
+200 JSON。只含 `visibility=public` 的分类与链接(分类内嵌其公开链接);私有分类、私有链接、以及「private 分类下的 public 链接」(可见性取更严一方)完全不出现。响应 `Cache-Control: public, max-age=60`。
+
+```json
+{
+ "categories": [
+ {
+ "id": "uuid",
+ "name": "分类名",
+ "icon": null,
+ "sortOrder": 0,
+ "links": [
+ {
+ "id": "uuid",
+ "categoryId": "uuid",
+ "title": "标题",
+ "url": "https://…",
+ "iconUrl": null,
+ "description": null,
+ "sortOrder": 0
+ }
+ ]
+ }
+ ],
+ "searchEngines": [
+ {
+ "id": "uuid",
+ "name": "Google",
+ "urlTemplate": "https://www.google.com/search?q={q}",
+ "icon": null,
+ "sortOrder": 0,
+ "isDefault": true
+ }
+ ],
+ "settings": {
+ "siteTitle": "nav",
+ "backgroundUrl": "",
+ "theme": "system",
+ "columns": 0
+ }
+}
+```
+
+## 私有
+
+### GET /api/private
+
+需有效会话 Cookie(`nav_session`,HttpOnly / Secure / SameSite=Lax)。未登录一律:
+- 状态 `401`
+- Body `{"error":"unauthorized"}`
+- Header `Cache-Control: no-store`
+
+已登录返回与 `/api/public` **同结构**的全量数据(公开 + 私有),`Cache-Control: no-store`。
+
+## 鉴权(/api/auth/*)
+
+| 方法 | 路径 | 说明 |
+| ---- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| GET | `/api/auth/setup` | `{"enabled":true}` 表示可创建所有者 |
+| POST | `/api/auth/setup` | header `X-Setup-Secret`;body `{username, password}`(password ≥ 8)→ 201 并下发会话;已有账号 → 403 |
+| POST | `/api/auth/login` | body `{username, password}` → `{success, user}`;若已启用 TOTP → `{requires2fa:true, tempToken}`;失败 401 `{"error":"invalid credentials","remainingAttempts":N}`;连续失败 5 次锁定 15 分钟 → 429 |
+| POST | `/api/auth/2fa/verify` | body `{tempToken, code}`(TOTP 6 位)→ 200 并下发会话;错误码 401 |
+| POST | `/api/auth/logout` | 吊销当前会话 |
+| GET | `/api/auth/session` | 会话探测:`{"authenticated":true,"userId":…}`;未登录 401 JSON |
+
+Passkey(WebAuthn,/api/auth/passkey/*,@simplewebauthn/server v14):
+
+| 方法 | 路径 | 说明 |
+| ---------- | ------------------------------------------------------------ | ------------------------------------------------- |
+| POST | `/register/options` | 登录后注册 passkey 的 options(rpID = 请求 host) |
+| POST | `/register/verify` | 校验注册响应,落库 `passkey_credentials` |
+| POST | `/authenticate/options` | 免登录取断言 options(可带 `{username}`) |
+| POST | `/authenticate/verify` | 校验断言,成功即建会话 |
+| GET/DELETE | `/credentials` | 查看 / 清除 passkey |
+| GET | `/totp`、POST `/totp/setup`、`/totp/enable`、`/totp/disable` | TOTP 管理(disable 需再输密码) |
+
+登录失败锁定:`login_attempts` 表按 username+IP 计数,5 次失败锁定 15 分钟;`/2fa/verify` 对同一 tempToken 连续 5 次错误即作废。
+
+## 后台(/api/admin/*,全部需会话,未登录 401 JSON `{"error":"unauthorized"}`)
+
+### 分类
+
+- `GET /api/admin/categories` → `{categories:[{id,name,icon,sortOrder,visibility,createdAt,updatedAt}]}`
+- `POST /api/admin/categories` body `{name, icon?, sortOrder?, visibility?}`(visibility: `public`|`private`)→ 201 `{id,…}`
+- `PUT /api/admin/categories/:id`(字段同上,部分更新)→ 更新后对象
+- `DELETE /api/admin/categories/:id` → `{success:true}`(级联删除其链接)
+- `POST /api/admin/categories/reorder` body `{ids:[…]}`(顺序即 sortOrder)→ `{success:true}`
+
+### 链接
+
+- `GET /api/admin/links` → `{links:[{id,categoryId,title,url,iconUrl,description,sortOrder,visibility,createdAt,updatedAt}]}`
+- `POST /api/admin/links` body `{title, url, categoryId, iconUrl?, description?, sortOrder?, visibility?}` → 201 `{id}`
+- `PUT /api/admin/links/:id`(部分更新)→ 更新后对象
+- `DELETE /api/admin/links/:id` → `{success:true}`
+- `POST /api/admin/links/reorder` body `{ids:[…]}` → `{success:true}`
+
+### 搜索引擎
+
+- `GET /api/admin/search-engines` → `{searchEngines:[{id,name,urlTemplate,icon,sortOrder,isDefault}]}`
+- `POST /api/admin/search-engines` body `{name, urlTemplate(含 {q}), icon?, sortOrder?, isDefault?}` → 201 `{id}`
+- `PUT /api/admin/search-engines/:id` → `{id}`(设 `isDefault:true` 会自动清掉其他默认)
+- `DELETE /api/admin/search-engines/:id` → `{success:true}`
+- `POST /api/admin/search-engines/reorder` body `{ids:[…]}` → `{success:true}`
+
+### 站点设置
+
+- `GET /api/admin/settings` → `{siteTitle, backgroundUrl, theme, columns}`
+- `PUT /api/admin/settings` body 可含 `{siteTitle, backgroundUrl, theme(light|dark|system), columns(1–12)}` → 更新后对象
+
+## 说明
+
+- favicon 自动抓取不在后端做:前端直接请求目标站 / 公共 favicon 服务,失败回退首字圆;后端只存 `iconUrl` 字段。
+- 点击计数、服务健康状态为预留字段,v1 不实现(SPEC 第 5 节)。
+- 会话 Cookie `nav_session`:HS256 JWT 签名 + `sessions` 表吊销,7 天有效。
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a3d6255
--- /dev/null
+++ b/package.json
@@ -0,0 +1,29 @@
+{
+ "name": "nav",
+ "version": "0.1.0",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "dev": "concurrently \"pnpm dev:worker\" \"pnpm dev:web\"",
+ "dev:web": "pnpm --filter web dev",
+ "dev:worker": "pnpm --filter worker dev",
+ "lint": "biome lint .",
+ "format:check": "biome format .",
+ "format": "biome format --write .",
+ "build": "pnpm --filter web build && pnpm --filter worker build",
+ "build:web": "pnpm --filter web build",
+ "build:worker": "pnpm --filter worker build",
+ "test": "pnpm --filter worker test",
+ "deploy": "pnpm build:web && pnpm --filter worker deploy",
+ "typecheck": "pnpm --filter web typecheck && pnpm --filter worker typecheck"
+ },
+ "devDependencies": {
+ "@biomejs/biome": "^2.5.0",
+ "concurrently": "^10.0.3",
+ "typescript": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=22.0.0"
+ },
+ "packageManager": "pnpm@12.14.0"
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
new file mode 100644
index 0000000..54d8348
--- /dev/null
+++ b/pnpm-lock.yaml
@@ -0,0 +1,3097 @@
+---
+lockfileVersion: "9.0"
+
+importers:
+ .:
+ configDependencies: {}
+ packageManagerDependencies:
+ pnpm:
+ specifier: 12.14.0
+ version: 12.14.0
+
+packages:
+ "@pnpm/exe.android-arm64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-+iSh7x21C3A2hqc+Z0ZmbKTcn6YNlzrXM142PsnQH/dLj0DYxFzoBvc6XAnL/yfQ5nnH2ebBiRj/zVxr61fZbQ==,
+ }
+ cpu: [arm64]
+ os: [android]
+
+ "@pnpm/exe.android-x64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-qT+0LqEr2wBVaxcG2T8cX/R8SSRz2Rvpp8nRR4fh8tnGUZRch87gFmsHUAoSQh7w6j1h0qTjrA384j4xi8frvw==,
+ }
+ cpu: [x64]
+ os: [android]
+
+ "@pnpm/exe.darwin-arm64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-tnrdUB8ecJoehuKKqi1YHCBVl61xtJ9XVGcx5EviC6fWO4DeGI8GtXrjvJxDBM3nuVjJeWistgsUp/N142x4sw==,
+ }
+ cpu: [arm64]
+ os: [darwin]
+
+ "@pnpm/exe.darwin-x64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-vlBfGkruqQRsEHTW43cPwpYd7QlbIJ//cvpAdb3bVXkI8SgTPoXhCnc05m+ZNiPrrEkBsX/t7KHw9aXpkzPm3Q==,
+ }
+ cpu: [x64]
+ os: [darwin]
+
+ "@pnpm/exe.freebsd-x64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-Qg5rxBrGYl6Tfso+EyygPf84fY1Fzy55E/0or+iuYKtnf0vc0MlHJfVIlT7pBukMRntQHRik7hUi0Z4s7AlJsw==,
+ }
+ cpu: [x64]
+ os: [freebsd]
+
+ "@pnpm/exe.linux-arm64-musl@12.14.0":
+ resolution:
+ {
+ integrity: sha512-DRIe4yQkXBGA/PhVJdzlbnllxBdAtnMMvTVLLcGpsK5FvJz9kxD2Hyxtn68ovmNkVX06f6p45cQwfm3wx2jn1A==,
+ }
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ "@pnpm/exe.linux-arm64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-7joGShZ44Nk3WpNU+60JoOPjCXlgxhJAq11S2UiVtwCUDgTer1yTPPfxGW8pxaD6046actYLIYDbZNlubHWs0A==,
+ }
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ "@pnpm/exe.linux-ppc64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-gSoryn7ySdXd//gjgf3MvvA8ZerJayaSbuMZMtAWq4vb2/wlVEgpl0Kvqt54y58TRj533Qjq2txKgnxd4JyoAQ==,
+ }
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ "@pnpm/exe.linux-riscv64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-EMjew1H9WqQ7pL+tYqCPwiuB+0PeCiJRV7fyWeuFw0wwYUajFBjcaPO3IGAVu9sdmJDU+e+HYv/Zey6aKae0Vw==,
+ }
+ cpu: [riscv64]
+ os: [linux]
+ libc: [glibc]
+
+ "@pnpm/exe.linux-s390x@12.14.0":
+ resolution:
+ {
+ integrity: sha512-shYOj/SFoXD35fHe0pWr2JofwSXulC0BnEIXLj2QokDi0EF//AfKsui35yKIkTEl+s2VJybc3PO4iJNhKIj5Qw==,
+ }
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
+ "@pnpm/exe.linux-x64-musl@12.14.0":
+ resolution:
+ {
+ integrity: sha512-btZiZ2Ot0llKK1ndSfA5i3IRX7/S0VrmzseNH/BJ4c+Cady+S81H6vvU1zByggHMyqQhC8OgxO5PiIY7D9bH0Q==,
+ }
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ "@pnpm/exe.linux-x64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-F6K8e/jWxiuEYJaQtRRUG9ynBSTEHa+t7Lf86MKuOO5UA7WVVMbi+oB8nY6iKW++ncWS2yG6T9faXZGxqNsfoQ==,
+ }
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ "@pnpm/exe.win32-arm64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-DOjlkVB6TtTKeAAe0hNZXn5S7YqESmo1Z6SGbR4BZNQ4isRg31XVHjX2RFTbY8gnZq68IwzyLmPqlEjMmYxofg==,
+ }
+ cpu: [arm64]
+ os: [win32]
+
+ "@pnpm/exe.win32-x64@12.14.0":
+ resolution:
+ {
+ integrity: sha512-/LSX6mew/sLf08XqcjemuklNKf1K/Ftpgj4//hK/HKzI2dKbmxDB27a/2OaQ5a0O3/3OFzlssXDziZsi+yVBwQ==,
+ }
+ cpu: [x64]
+ os: [win32]
+
+ pnpm@12.14.0:
+ resolution:
+ {
+ integrity: sha512-wYum2HmT09Fky16JSPMrLAbuhUSH4GzY2GeBNC+z5btGNDZwNHEehoArqpw3vqkGzhkprQjXCITJfYAd8TOJpg==,
+ }
+ engines: { node: ">=18.*" }
+ hasBin: true
+
+snapshots:
+ "@pnpm/exe.android-arm64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.android-x64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.darwin-arm64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.darwin-x64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.freebsd-x64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.linux-arm64-musl@12.14.0":
+ optional: true
+
+ "@pnpm/exe.linux-arm64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.linux-ppc64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.linux-riscv64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.linux-s390x@12.14.0":
+ optional: true
+
+ "@pnpm/exe.linux-x64-musl@12.14.0":
+ optional: true
+
+ "@pnpm/exe.linux-x64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.win32-arm64@12.14.0":
+ optional: true
+
+ "@pnpm/exe.win32-x64@12.14.0":
+ optional: true
+
+ pnpm@12.14.0:
+ optionalDependencies:
+ "@pnpm/exe.android-arm64": 12.14.0
+ "@pnpm/exe.android-x64": 12.14.0
+ "@pnpm/exe.darwin-arm64": 12.14.0
+ "@pnpm/exe.darwin-x64": 12.14.0
+ "@pnpm/exe.freebsd-x64": 12.14.0
+ "@pnpm/exe.linux-arm64": 12.14.0
+ "@pnpm/exe.linux-arm64-musl": 12.14.0
+ "@pnpm/exe.linux-ppc64": 12.14.0
+ "@pnpm/exe.linux-riscv64": 12.14.0
+ "@pnpm/exe.linux-s390x": 12.14.0
+ "@pnpm/exe.linux-x64": 12.14.0
+ "@pnpm/exe.linux-x64-musl": 12.14.0
+ "@pnpm/exe.win32-arm64": 12.14.0
+ "@pnpm/exe.win32-x64": 12.14.0
+
+---
+lockfileVersion: "9.0"
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false
+
+importers:
+ .:
+ devDependencies:
+ "@biomejs/biome":
+ specifier: ^2.5.0
+ version: 2.6.2
+ concurrently:
+ specifier: ^10.0.3
+ version: 10.0.6
+ typescript:
+ specifier: ^7.0.0
+ version: 7.0.2
+
+ web:
+ devDependencies:
+ typescript:
+ specifier: ^7.0.0
+ version: 7.0.2
+ vite:
+ specifier: ^8.0.15
+ version: 8.3.5(esbuild@0.28.2)
+
+ worker:
+ dependencies:
+ "@simplewebauthn/server":
+ specifier: ^14.0.0
+ version: 14.0.3
+ hono:
+ specifier: ^4.7.9
+ version: 4.13.13
+ devDependencies:
+ "@cloudflare/workers-types":
+ specifier: ^5.0.0
+ version: 5.20261023.1
+ typescript:
+ specifier: ^7.0.0
+ version: 7.0.2
+ vitest:
+ specifier: ^5.0.5
+ version: 5.0.5(vite@8.3.5(esbuild@0.28.2))
+ wrangler:
+ specifier: ^4.14.1
+ version: 4.152.0(@cloudflare/workers-types@5.20261023.1)
+
+packages:
+ "@biomejs/biome@2.6.2":
+ resolution:
+ {
+ integrity: sha512-JLTFAFF9vfJcWwLhwuL4ZHflLg+XfTEC4IUnAlJRX1cMRt57++Xd1Ysb9Fdmlh9YUrvyCXfPEHjjEIqKJGdPKw==,
+ }
+ engines: { node: ">=14.21.3" }
+ hasBin: true
+
+ "@biomejs/cli-android-arm64@2.6.2":
+ resolution:
+ {
+ integrity: sha512-dMpdpH7zFEL5FxuIA9LJW+RoNyC3oeDB7PJyjqVVwtMNoKB5uo8OZYmrVSBikn71txzYwy/3xga7UME6bJQZ6A==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [arm64]
+ os: [android]
+
+ "@biomejs/cli-android-x64@2.6.2":
+ resolution:
+ {
+ integrity: sha512-XCwEhPBGYzuRA502dRkCcQ+5cefQwuxQR7f9wa4do92dvIcuBL6VMLMFB/fL9hlpZ4dGSfHdpGFSIDlp52mg0A==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [x64]
+ os: [android]
+
+ "@biomejs/cli-darwin-arm64@2.6.2":
+ resolution:
+ {
+ integrity: sha512-rpXtabRgyZNz3aCjd/cRoSZGYi92R9eAXdUUe1sigIsRDyfMwgThaa98Yxt1fiZ7mxquqkAyIHIo08N/e1ToBA==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [arm64]
+ os: [darwin]
+
+ "@biomejs/cli-darwin-x64@2.6.2":
+ resolution:
+ {
+ integrity: sha512-7GGzlm1GxUKoQ9CNV8tQZ+XXad4sz+v+uzNsWlhaGjsnZqUOVBw1OmAMpG3uNV/Mr0UrCpRJvSK0qvfuqSQOjg==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [x64]
+ os: [darwin]
+
+ "@biomejs/cli-linux-arm64-musl@2.6.2":
+ resolution:
+ {
+ integrity: sha512-I+FYCLVSmR3cYfKcQ+KNeLOZ5w0wRd9fQFlw3JbSvy7bkegvTqdHaBRRcJzHQB/1ldldTLIcG21ka6X2cTWmJw==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ "@biomejs/cli-linux-arm64@2.6.2":
+ resolution:
+ {
+ integrity: sha512-Qs4CofCE8MdkjZFfEjswh2NAcbyQ7IVYtGSzQBvLqFlla/CSXroGbktUFndWG/kVSTywadauzAspYWtSfqAc2g==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ "@biomejs/cli-linux-x64-musl@2.6.2":
+ resolution:
+ {
+ integrity: sha512-wnjEXAK2pDd2j8r9gKI3L+44sIxjkYzS5aHmD1+K57RNJ3sFyT4n22NH6QFPqqeVdRBxN54H3kckUUCrFKCcJw==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ "@biomejs/cli-linux-x64@2.6.2":
+ resolution:
+ {
+ integrity: sha512-FJKsb95418139xDdbv9XnNJsIIwvsgR21Of0aE9B9U+nQlOtRq5gJl2ps0jZUmYBxTaOlP9BKo8N+Ff8+Rui1g==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ "@biomejs/cli-win32-arm64@2.6.2":
+ resolution:
+ {
+ integrity: sha512-/PEOo6evlgrQOfKhMNtC/4Gk8ai3hySXXEtjUzCqZe/4iAbMdqelpp7qvZEDyLxlZS+BjOMQFpq2gXI/BPaAqw==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [arm64]
+ os: [win32]
+
+ "@biomejs/cli-win32-x64@2.6.2":
+ resolution:
+ {
+ integrity: sha512-FVlWD+mDDz8nN5LWKRWUhhb7wKIK0VE3oXQvQBX7Fwwj00CvqMVhMyiz1iz8O5aZGmnkhFlKSwJPrUvMh5prQw==,
+ }
+ engines: { node: ">=14.21.3" }
+ cpu: [x64]
+ os: [win32]
+
+ "@cloudflare/kv-asset-handler@0.5.0":
+ resolution:
+ {
+ integrity: sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg==,
+ }
+ engines: { node: ">=22.0.0" }
+
+ "@cloudflare/unenv-preset@2.16.2":
+ resolution:
+ {
+ integrity: sha512-JBP1+Z7ZSNG/d4mRP+y8VC5dka3tZVMLEZRvS+rzQ4DGV1EoxRFQckcJTTkXbHSQiTj0DtNI01Zwb/V2fX0mvQ==,
+ }
+ peerDependencies:
+ unenv: 2.0.0-rc.24
+ workerd: ">1.20260305.0 <2.0.0-0"
+ peerDependenciesMeta:
+ workerd:
+ optional: true
+
+ "@cloudflare/workerd-darwin-64@1.20261019.1":
+ resolution:
+ {
+ integrity: sha512-5ZILbAta/fBQvhmAYeCE7dKMMYIr7N9wJEX50fEGLKSIwGtvT0HzSfHNIK/O7cBQ4gHQ2WfIiPClvwcye6E0fA==,
+ }
+ engines: { node: ">=16" }
+ cpu: [x64]
+ os: [darwin]
+
+ "@cloudflare/workerd-darwin-arm64@1.20261019.1":
+ resolution:
+ {
+ integrity: sha512-cww2Ab6lVMxpTiEEjKmPI58p5EMo0vYTZSH+3WkqXJdQgc3ES66GuL247+U2B2YWajhhu2tqj7jySrXneU749g==,
+ }
+ engines: { node: ">=16" }
+ cpu: [arm64]
+ os: [darwin]
+
+ "@cloudflare/workerd-linux-64@1.20261019.1":
+ resolution:
+ {
+ integrity: sha512-4++VRi9vkQROYqrpZYOixIJuVDmujkwrT4kszsxNFlvcmsX6Mr2GumvxIN3gIixS3vJUh3Umdtkthqj5X0S3Xw==,
+ }
+ engines: { node: ">=16" }
+ cpu: [x64]
+ os: [linux]
+
+ "@cloudflare/workerd-linux-arm64@1.20261019.1":
+ resolution:
+ {
+ integrity: sha512-75PVtJOwfjScQ53sbLtQXI7D8yP1c21t+WEUPaYbqkzaz4ZqfR5wAd+zuWs8G5Q7kOj2SQIvEfY5Sn8Y+UVrnA==,
+ }
+ engines: { node: ">=16" }
+ cpu: [arm64]
+ os: [linux]
+
+ "@cloudflare/workerd-windows-64@1.20261019.1":
+ resolution:
+ {
+ integrity: sha512-z49fvKTETMCnG6wnMcQwxx9CpryFceiKz04FRjq26EkhCyzRNJ6c3UXhyZz3r5f1CXnnBZc5DcU8ZouPkUJCqw==,
+ }
+ engines: { node: ">=16" }
+ cpu: [x64]
+ os: [win32]
+
+ "@cloudflare/workers-types@5.20261023.1":
+ resolution:
+ {
+ integrity: sha512-jRaMsWUF/08dd0dWnX3zPGPOjakkkA2JPnK5vLsCQFmYC40kbMPZ02fvOPO8kqjqgljoMZrKsRiXpR1u1Lp0Qg==,
+ }
+
+ "@cspotcode/source-map-support@0.8.1":
+ resolution:
+ {
+ integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==,
+ }
+ engines: { node: ">=12" }
+
+ "@emnapi/runtime@1.11.3":
+ resolution:
+ {
+ integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==,
+ }
+
+ "@esbuild/aix-ppc64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==,
+ }
+ engines: { node: ">=18" }
+ cpu: [ppc64]
+ os: [aix]
+
+ "@esbuild/android-arm64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm64]
+ os: [android]
+
+ "@esbuild/android-arm@0.28.2":
+ resolution:
+ {
+ integrity: sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm]
+ os: [android]
+
+ "@esbuild/android-x64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==,
+ }
+ engines: { node: ">=18" }
+ cpu: [x64]
+ os: [android]
+
+ "@esbuild/darwin-arm64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm64]
+ os: [darwin]
+
+ "@esbuild/darwin-x64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==,
+ }
+ engines: { node: ">=18" }
+ cpu: [x64]
+ os: [darwin]
+
+ "@esbuild/freebsd-arm64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm64]
+ os: [freebsd]
+
+ "@esbuild/freebsd-x64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==,
+ }
+ engines: { node: ">=18" }
+ cpu: [x64]
+ os: [freebsd]
+
+ "@esbuild/linux-arm64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm64]
+ os: [linux]
+
+ "@esbuild/linux-arm@0.28.2":
+ resolution:
+ {
+ integrity: sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm]
+ os: [linux]
+
+ "@esbuild/linux-ia32@0.28.2":
+ resolution:
+ {
+ integrity: sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==,
+ }
+ engines: { node: ">=18" }
+ cpu: [ia32]
+ os: [linux]
+
+ "@esbuild/linux-loong64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==,
+ }
+ engines: { node: ">=18" }
+ cpu: [loong64]
+ os: [linux]
+
+ "@esbuild/linux-mips64el@0.28.2":
+ resolution:
+ {
+ integrity: sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==,
+ }
+ engines: { node: ">=18" }
+ cpu: [mips64el]
+ os: [linux]
+
+ "@esbuild/linux-ppc64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==,
+ }
+ engines: { node: ">=18" }
+ cpu: [ppc64]
+ os: [linux]
+
+ "@esbuild/linux-riscv64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==,
+ }
+ engines: { node: ">=18" }
+ cpu: [riscv64]
+ os: [linux]
+
+ "@esbuild/linux-s390x@0.28.2":
+ resolution:
+ {
+ integrity: sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==,
+ }
+ engines: { node: ">=18" }
+ cpu: [s390x]
+ os: [linux]
+
+ "@esbuild/linux-x64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==,
+ }
+ engines: { node: ">=18" }
+ cpu: [x64]
+ os: [linux]
+
+ "@esbuild/netbsd-arm64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm64]
+ os: [netbsd]
+
+ "@esbuild/netbsd-x64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==,
+ }
+ engines: { node: ">=18" }
+ cpu: [x64]
+ os: [netbsd]
+
+ "@esbuild/openbsd-arm64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm64]
+ os: [openbsd]
+
+ "@esbuild/openbsd-x64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==,
+ }
+ engines: { node: ">=18" }
+ cpu: [x64]
+ os: [openbsd]
+
+ "@esbuild/openharmony-arm64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm64]
+ os: [openharmony]
+
+ "@esbuild/sunos-x64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==,
+ }
+ engines: { node: ">=18" }
+ cpu: [x64]
+ os: [sunos]
+
+ "@esbuild/win32-arm64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==,
+ }
+ engines: { node: ">=18" }
+ cpu: [arm64]
+ os: [win32]
+
+ "@esbuild/win32-ia32@0.28.2":
+ resolution:
+ {
+ integrity: sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==,
+ }
+ engines: { node: ">=18" }
+ cpu: [ia32]
+ os: [win32]
+
+ "@esbuild/win32-x64@0.28.2":
+ resolution:
+ {
+ integrity: sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==,
+ }
+ engines: { node: ">=18" }
+ cpu: [x64]
+ os: [win32]
+
+ "@hexagon/base64@1.1.28":
+ resolution:
+ {
+ integrity: sha512-lhqDEAvWixy3bZ+UOYbPwUbBkwBq5C1LAJ/xPC8Oi+lL54oyakv/npbA0aU2hgCsx/1NUd4IBvV03+aUBWxerw==,
+ }
+
+ "@img/colour@1.1.0":
+ resolution:
+ {
+ integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==,
+ }
+ engines: { node: ">=18" }
+
+ "@img/sharp-darwin-arm64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [arm64]
+ os: [darwin]
+
+ "@img/sharp-darwin-x64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [x64]
+ os: [darwin]
+
+ "@img/sharp-freebsd-wasm32@0.35.5":
+ resolution:
+ {
+ integrity: sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==,
+ }
+ engines: { node: ">=20.9.0" }
+ os: [freebsd]
+
+ "@img/sharp-libvips-darwin-arm64@1.3.4":
+ resolution:
+ {
+ integrity: sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==,
+ }
+ cpu: [arm64]
+ os: [darwin]
+
+ "@img/sharp-libvips-darwin-x64@1.3.4":
+ resolution:
+ {
+ integrity: sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==,
+ }
+ cpu: [x64]
+ os: [darwin]
+
+ "@img/sharp-libvips-linux-arm64@1.3.4":
+ resolution:
+ {
+ integrity: sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==,
+ }
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-libvips-linux-arm@1.3.4":
+ resolution:
+ {
+ integrity: sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==,
+ }
+ cpu: [arm]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-libvips-linux-ppc64@1.3.4":
+ resolution:
+ {
+ integrity: sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==,
+ }
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-libvips-linux-riscv64@1.3.4":
+ resolution:
+ {
+ integrity: sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==,
+ }
+ cpu: [riscv64]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-libvips-linux-s390x@1.3.4":
+ resolution:
+ {
+ integrity: sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==,
+ }
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-libvips-linux-x64@1.3.4":
+ resolution:
+ {
+ integrity: sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==,
+ }
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-libvips-linuxmusl-arm64@1.3.4":
+ resolution:
+ {
+ integrity: sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==,
+ }
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ "@img/sharp-libvips-linuxmusl-x64@1.3.4":
+ resolution:
+ {
+ integrity: sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==,
+ }
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ "@img/sharp-linux-arm64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-linux-arm@0.35.5":
+ resolution:
+ {
+ integrity: sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [arm]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-linux-ppc64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-linux-riscv64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [riscv64]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-linux-s390x@0.35.5":
+ resolution:
+ {
+ integrity: sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-linux-x64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ "@img/sharp-linuxmusl-arm64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ "@img/sharp-linuxmusl-x64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ "@img/sharp-wasm32@0.35.5":
+ resolution:
+ {
+ integrity: sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==,
+ }
+ engines: { node: ">=20.9.0" }
+
+ "@img/sharp-webcontainers-wasm32@0.35.5":
+ resolution:
+ {
+ integrity: sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [wasm32]
+
+ "@img/sharp-win32-arm64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [arm64]
+ os: [win32]
+
+ "@img/sharp-win32-ia32@0.35.5":
+ resolution:
+ {
+ integrity: sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==,
+ }
+ engines: { node: ^20.9.0 }
+ cpu: [ia32]
+ os: [win32]
+
+ "@img/sharp-win32-x64@0.35.5":
+ resolution:
+ {
+ integrity: sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==,
+ }
+ engines: { node: ">=20.9.0" }
+ cpu: [x64]
+ os: [win32]
+
+ "@jridgewell/resolve-uri@3.1.2":
+ resolution:
+ {
+ integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==,
+ }
+ engines: { node: ">=6.0.0" }
+
+ "@jridgewell/sourcemap-codec@1.6.0":
+ resolution:
+ {
+ integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==,
+ }
+
+ "@jridgewell/trace-mapping@0.3.31":
+ resolution:
+ {
+ integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==,
+ }
+
+ "@jridgewell/trace-mapping@0.3.9":
+ resolution:
+ {
+ integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==,
+ }
+
+ "@levischuck/tiny-cbor@0.2.11":
+ resolution:
+ {
+ integrity: sha512-llBRm4dT4Z89aRsm6u2oEZ8tfwL/2l6BwpZ7JcyieouniDECM5AqNgr/y08zalEIvW3RSK4upYyybDcmjXqAow==,
+ }
+
+ "@oxc-project/types@0.155.0":
+ resolution:
+ {
+ integrity: sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==,
+ }
+
+ "@peculiar/asn1-android@2.11.0":
+ resolution:
+ {
+ integrity: sha512-llW/qjavL+tOxt5i9whUv4wsbsLpUwI6k/DrvKsdA/H7A/TB/6CosMFgvei28fcJ8ncD0c5lig1oBBlo4KGMCw==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-asym-key@2.11.0":
+ resolution:
+ {
+ integrity: sha512-r2957WdSZle/Zt4t9og7OMQYXNJ9/3ANXVtFwLCDJuHORlBZ4AFmDt1Qee0CzyTbHQg4ZZApBGEz5/6cFsyCRg==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-cms@2.11.0":
+ resolution:
+ {
+ integrity: sha512-SlAiDoT/Cd8qaNmbTt78gqyaEvu2fQd6ML6KWJkdjXGrgDKnHHrusVkfQUelkfinL2p665IIADb0JBixtT8W1g==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-csr@2.11.0":
+ resolution:
+ {
+ integrity: sha512-M/ED0yJ05qMK+UADPKnIa8vhAeewOJALSxTAZB7RQ/batRHhIJZkwznCcWAbFO5saHJ1yEQ+m4lncEcG9RnQSg==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-ecc@2.11.0":
+ resolution:
+ {
+ integrity: sha512-jj1alGEKev7/un+cI+exyVK9m31lmP7cCBMCZuCb0wkFQH2zmKmJzNiG4wqXFNzlcP8timHLnzf3lV3OxBpb/Q==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-pfx@2.11.0":
+ resolution:
+ {
+ integrity: sha512-ykSAWRu8KkmzU8LRpk9ZQC3zuLmBEtoSMjIv9XHVamD5W7amqreV5wttKqnvtjWOzzSJQxA/HVT8/tHwpEEGSQ==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-pkcs8@2.11.0":
+ resolution:
+ {
+ integrity: sha512-lragjkjQGnQ5luxC+sxoAfAO/jBiQ7hOEGlDKJUk7MC5zY3AzjB2DU0GyPUH1Sswdv10t7DurY0zylOYMLb88w==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-pkcs9@2.11.0":
+ resolution:
+ {
+ integrity: sha512-gDdFjpqV0weJjgNUvueUVf4D8uVbpq+VbG0TsxLAY2QGljAkJyL9qwQ7avol9j0jaYSJ7Ey7v7RZp0M3GTcQSA==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-rsa@2.11.0":
+ resolution:
+ {
+ integrity: sha512-S2sBJmbfI09Kzdt9cEhE6pDNjHpVTkURs+811+PxS8AvsTLxC4woMNRhxHYaIbClkkNfAVt0tZxJdINVfUmzuA==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-schema@2.11.0":
+ resolution:
+ {
+ integrity: sha512-8xh4avo53/vXO6UEv9yaoJ83hY581geaLTygf61NPIXP5AeIZCPjJhpTaYU23IZkG+NpLN/C9FYzWp7hphIT9A==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-x509-attr@2.11.0":
+ resolution:
+ {
+ integrity: sha512-Fgvnd9REmLxEj/4cbDP54dNUNUXkzUksXLqEHqs1mHBuSRjSTCUSPM/WQIZYSvrdG7ND9CX1AQtPoIBekhgQSA==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-x509-post-quantum@2.11.0":
+ resolution:
+ {
+ integrity: sha512-K6EnquTX3xJ2G+uLPFH0jVkh7W8y6eTzoCxvSoXAj0sWS5uvVB2PEvpBPdzY4+ytaedUM3x9ZVgX0AZKb316ew==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/asn1-x509@2.11.0":
+ resolution:
+ {
+ integrity: sha512-J1sHAwGNlk+8J+FeR1eLVc6Gq0T9f9ITc3HWyPYgJraoW6U8AJuQiWVJ3SCEpltfTdpOY7fHdHT5oKAsbK/jww==,
+ }
+ engines: { node: ">=14" }
+
+ "@peculiar/utils@2.0.3":
+ resolution:
+ {
+ integrity: sha512-+oL3HPFRIZ1St2K50lWCXiioIgSoxzz7R1J3uF6neO2yl1sgmpgY6XXJH4BdpoDkMWznQTeYF6oWNDZLCdQ4eQ==,
+ }
+
+ "@peculiar/x509@2.2.0":
+ resolution:
+ {
+ integrity: sha512-adpW58ySPQMOUPv8pTKT3RIyCFqfUFt8X05ukPdtkQToXDVr8dMtxuenik1yx8tNFTbpApWsM/Hi5SzlIx48+Q==,
+ }
+ engines: { node: ">=20.0.0" }
+
+ "@poppinss/colors@4.1.6":
+ resolution:
+ {
+ integrity: sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==,
+ }
+
+ "@poppinss/dumper@0.6.5":
+ resolution:
+ {
+ integrity: sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==,
+ }
+
+ "@poppinss/exception@1.2.3":
+ resolution:
+ {
+ integrity: sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==,
+ }
+
+ "@rolldown/binding-android-arm-eabi@1.2.15":
+ resolution:
+ {
+ integrity: sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [arm]
+ os: [android]
+
+ "@rolldown/binding-android-arm64@1.2.15":
+ resolution:
+ {
+ integrity: sha512-xD7DdZCrbThKuxNg7ooQmvp07ys4J/pnSEMTG3/OdOWl6daC67m/Q4fL78sRHMxTH/N4fGUbYhcPM0MF5WFHkg==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [arm64]
+ os: [android]
+
+ "@rolldown/binding-darwin-arm64@1.2.15":
+ resolution:
+ {
+ integrity: sha512-m2WuQ6r0B4OTYxyPpNLtXaMRbRDUbG8YQV2Q3KTdSSK8Th6KHCnC8jVCJt8bvYeSB5WivkkNbc85mKadaSdOxA==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [arm64]
+ os: [darwin]
+
+ "@rolldown/binding-darwin-x64@1.2.15":
+ resolution:
+ {
+ integrity: sha512-5RtnsHM36nodM9WbMy+zip0LGS/G+y5wro5RHrpOlr4ac24+1zSi9kiV2MP1myZeZ/ifEHfulQcWjnAXzc2C2A==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [x64]
+ os: [darwin]
+
+ "@rolldown/binding-freebsd-x64@1.2.15":
+ resolution:
+ {
+ integrity: sha512-g3l09pyFqhu+135JKkbkwiKGQmwU5hUMUPJ4VdBADvuqR8d33L6H578rh8m7rtxbdp+VmX/+nzI7nvhSZlzpUQ==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [x64]
+ os: [freebsd]
+
+ "@rolldown/binding-linux-arm-gnueabihf@1.2.15":
+ resolution:
+ {
+ integrity: sha512-nIe3VugI97nGQtspPxDqA4sXMUpeiocKIP/CqpY/u/vgbT+alX+cVxu1C/oVBPKg4feNTmYovE91v4DgXvXNwQ==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [arm]
+ os: [linux]
+
+ "@rolldown/binding-linux-arm64-gnu@1.2.15":
+ resolution:
+ {
+ integrity: sha512-iTBjXx+B5QSvgI89lJfmqh4wTh8NabR1YZIIN3hNx4zSG0EVfVqkOvLulNpG4251pbd6/IAmZ/LefVk1Y4rPhw==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ "@rolldown/binding-linux-arm64-musl@1.2.15":
+ resolution:
+ {
+ integrity: sha512-uN26XOnVR7rqQupG3V9oAG2EGGatWjcJHOeDOHUFCh4TBWmP2tHTFoVN13aYbwfm0aHqJAEmcwhAu6sooIjfqQ==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ "@rolldown/binding-linux-ppc64-gnu@1.2.15":
+ resolution:
+ {
+ integrity: sha512-9nWkcdd+H+XhaA3fQIwpHnKIrfx/PQ6rO0pivr78Og07tXlUlctBBJoEYLPfhTmCR/QxEVdn6uPjHV5SymPhdw==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ "@rolldown/binding-linux-s390x-gnu@1.2.15":
+ resolution:
+ {
+ integrity: sha512-Ggh0ciFjLwIusLSLz7LZYEaGdxOAUJXI+Qu5JCbhPJJHEt8vP+IjRATTJheiJsdzzTYgUiHUiw3X1Ea3ZpMBdA==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
+ "@rolldown/binding-linux-x64-gnu@1.2.15":
+ resolution:
+ {
+ integrity: sha512-FHg60rS6DBePAYZ9X9F67x+JObFdmgn6tupA1C/a3B+CufFmTD4mX+e8M75tCiAO3foR/6xwVBI0KQiI7sn/rw==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ "@rolldown/binding-linux-x64-musl@1.2.15":
+ resolution:
+ {
+ integrity: sha512-/cvV/7v5VGz/moiz0XKRj2dE8DzsKyhIu1KpOvJGPjRywg3yscON889UGvAe8zfiJLHup7VLjBduoGWi3HusWQ==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ "@rolldown/binding-openharmony-arm64@1.2.15":
+ resolution:
+ {
+ integrity: sha512-MyzC5Hrv/sm+Z7TSGKP/j8001RO2xQm1zOpCNVL4j0cY/VhBZviludA2YFQ7i4lH6ZAXxQm0lcMdBzM+99mE7w==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [arm64]
+ os: [openharmony]
+
+ "@rolldown/binding-win32-arm64-msvc@1.2.15":
+ resolution:
+ {
+ integrity: sha512-+PgYiS+AH5omy6L45ZLxybasauJaj3M8buoT83D+nzPmCayXlxUV9hydhciCKVyIg0B/v0BtXPDE1uGqNwCPpg==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [arm64]
+ os: [win32]
+
+ "@rolldown/binding-win32-x64-msvc@1.2.15":
+ resolution:
+ {
+ integrity: sha512-HFZd2QNQYn1JbIi+Hpd7H+r/lkWxcfIu28nirZ6eCn2LafuvmExMlb/P96Sfx5tf7pPArw39IdhmCF8vmV+NhQ==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ cpu: [x64]
+ os: [win32]
+
+ "@rolldown/pluginutils@1.0.1":
+ resolution:
+ {
+ integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==,
+ }
+
+ "@simplewebauthn/server@14.0.3":
+ resolution:
+ {
+ integrity: sha512-D39/0fiDiYmGV+nraY9s63D1Ho2AX/waMLy22/9gUadTUuvbAnstfb4bpbHYbwZuV5ZLDYN1SmzDKuiHzKAA4Q==,
+ }
+ engines: { node: ">=20.0.0" }
+
+ "@sindresorhus/is@7.2.0":
+ resolution:
+ {
+ integrity: sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==,
+ }
+ engines: { node: ">=18" }
+
+ "@speed-highlight/core@1.2.24":
+ resolution:
+ {
+ integrity: sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==,
+ }
+
+ "@types/chai@5.2.3":
+ resolution:
+ {
+ integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==,
+ }
+
+ "@types/deep-eql@4.0.2":
+ resolution:
+ {
+ integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==,
+ }
+
+ "@types/estree@1.0.9":
+ resolution:
+ {
+ integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==,
+ }
+
+ "@typescript/typescript-aix-ppc64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [ppc64]
+ os: [aix]
+
+ "@typescript/typescript-darwin-arm64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [arm64]
+ os: [darwin]
+
+ "@typescript/typescript-darwin-x64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [x64]
+ os: [darwin]
+
+ "@typescript/typescript-freebsd-arm64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [arm64]
+ os: [freebsd]
+
+ "@typescript/typescript-freebsd-x64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [x64]
+ os: [freebsd]
+
+ "@typescript/typescript-linux-arm64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [arm64]
+ os: [linux]
+
+ "@typescript/typescript-linux-arm@7.0.2":
+ resolution:
+ {
+ integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [arm]
+ os: [linux]
+
+ "@typescript/typescript-linux-loong64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [loong64]
+ os: [linux]
+
+ "@typescript/typescript-linux-mips64el@7.0.2":
+ resolution:
+ {
+ integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [mips64el]
+ os: [linux]
+
+ "@typescript/typescript-linux-ppc64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [ppc64]
+ os: [linux]
+
+ "@typescript/typescript-linux-riscv64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [riscv64]
+ os: [linux]
+
+ "@typescript/typescript-linux-s390x@7.0.2":
+ resolution:
+ {
+ integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [s390x]
+ os: [linux]
+
+ "@typescript/typescript-linux-x64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [x64]
+ os: [linux]
+
+ "@typescript/typescript-netbsd-arm64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [arm64]
+ os: [netbsd]
+
+ "@typescript/typescript-netbsd-x64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [x64]
+ os: [netbsd]
+
+ "@typescript/typescript-openbsd-arm64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [arm64]
+ os: [openbsd]
+
+ "@typescript/typescript-openbsd-x64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [x64]
+ os: [openbsd]
+
+ "@typescript/typescript-sunos-x64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [x64]
+ os: [sunos]
+
+ "@typescript/typescript-win32-arm64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [arm64]
+ os: [win32]
+
+ "@typescript/typescript-win32-x64@7.0.2":
+ resolution:
+ {
+ integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==,
+ }
+ engines: { node: ">=16.20.0" }
+ cpu: [x64]
+ os: [win32]
+
+ "@vitest/mocker@5.0.5":
+ resolution:
+ {
+ integrity: sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==,
+ }
+ peerDependencies:
+ msw: ^2.4.9 || ^3.0.0
+ vite: ^6.0.0 || ^7.0.0 || ^8.0.0
+ peerDependenciesMeta:
+ msw:
+ optional: true
+ vite:
+ optional: true
+
+ "@vitest/spy@5.0.5":
+ resolution:
+ {
+ integrity: sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==,
+ }
+
+ ansi-regex@6.4.0:
+ resolution:
+ {
+ integrity: sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw==,
+ }
+ engines: { node: ">=12" }
+
+ ansi-styles@6.2.3:
+ resolution:
+ {
+ integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==,
+ }
+ engines: { node: ">=12" }
+
+ asn1js@3.1.0:
+ resolution:
+ {
+ integrity: sha512-HWYi1THkOqguCiO+vwj09ZkQFD2kKEsejYHAYCtX0D80WVdoDnvRc9IukXX/jeb0T9NRWJnRtqwdbHltnFjwXA==,
+ }
+ engines: { node: ">=12.0.0" }
+
+ assertion-error@2.0.1:
+ resolution:
+ {
+ integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==,
+ }
+ engines: { node: ">=12" }
+
+ blake3-wasm@2.1.5:
+ resolution:
+ {
+ integrity: sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==,
+ }
+
+ chai@6.3.0:
+ resolution:
+ {
+ integrity: sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==,
+ }
+ engines: { node: ">=18" }
+
+ chalk@5.6.2:
+ resolution:
+ {
+ integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==,
+ }
+ engines: { node: ^12.17.0 || ^14.13 || >=16.0.0 }
+
+ cliui@9.0.1:
+ resolution:
+ {
+ integrity: sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==,
+ }
+ engines: { node: ">=20" }
+
+ concurrently@10.0.6:
+ resolution:
+ {
+ integrity: sha512-qgICXXFp2/3nAebRLmxcINKEXM1mLK3ij/y31P02VTs/KIkddIeC05n73DxOXsXMB9LFSqNU1/na3lDlOhcbIw==,
+ }
+ engines: { node: ">=22" }
+ hasBin: true
+
+ cookie@1.1.1:
+ resolution:
+ {
+ integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==,
+ }
+ engines: { node: ">=18" }
+
+ detect-libc@2.1.2:
+ resolution:
+ {
+ integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==,
+ }
+ engines: { node: ">=8" }
+
+ emoji-regex@10.6.0:
+ resolution:
+ {
+ integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==,
+ }
+
+ error-stack-parser-es@1.0.5:
+ resolution:
+ {
+ integrity: sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==,
+ }
+
+ es-module-lexer@2.3.2:
+ resolution:
+ {
+ integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==,
+ }
+
+ esbuild@0.28.2:
+ resolution:
+ {
+ integrity: sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==,
+ }
+ engines: { node: ">=18" }
+ hasBin: true
+
+ escalade@3.2.0:
+ resolution:
+ {
+ integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==,
+ }
+ engines: { node: ">=6" }
+
+ estree-walker@3.0.3:
+ resolution:
+ {
+ integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==,
+ }
+
+ expect-type@1.4.0:
+ resolution:
+ {
+ integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==,
+ }
+ engines: { node: ">=12.0.0" }
+
+ fdir@6.5.0:
+ resolution:
+ {
+ integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==,
+ }
+ engines: { node: ">=12.0.0" }
+ peerDependencies:
+ picomatch: ^3 || ^4
+ peerDependenciesMeta:
+ picomatch:
+ optional: true
+
+ fsevents@2.3.3:
+ resolution:
+ {
+ integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==,
+ }
+ engines: { node: ^8.16.0 || ^10.6.0 || >=11.0.0 }
+ os: [darwin]
+
+ get-caller-file@2.0.5:
+ resolution:
+ {
+ integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==,
+ }
+ engines: { node: 6.* || 8.* || >= 10.* }
+
+ get-east-asian-width@1.7.0:
+ resolution:
+ {
+ integrity: sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==,
+ }
+ engines: { node: ">=18" }
+
+ hono@4.13.13:
+ resolution:
+ {
+ integrity: sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA==,
+ }
+ engines: { node: ">=16.9.0" }
+
+ kleur@4.1.5:
+ resolution:
+ {
+ integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==,
+ }
+ engines: { node: ">=6" }
+
+ lightningcss-android-arm64@1.33.0:
+ resolution:
+ {
+ integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [arm64]
+ os: [android]
+
+ lightningcss-darwin-arm64@1.33.0:
+ resolution:
+ {
+ integrity: sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [arm64]
+ os: [darwin]
+
+ lightningcss-darwin-x64@1.33.0:
+ resolution:
+ {
+ integrity: sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [x64]
+ os: [darwin]
+
+ lightningcss-freebsd-x64@1.33.0:
+ resolution:
+ {
+ integrity: sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [x64]
+ os: [freebsd]
+
+ lightningcss-linux-arm-gnueabihf@1.33.0:
+ resolution:
+ {
+ integrity: sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [arm]
+ os: [linux]
+
+ lightningcss-linux-arm64-gnu@1.33.0:
+ resolution:
+ {
+ integrity: sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ lightningcss-linux-arm64-musl@1.33.0:
+ resolution:
+ {
+ integrity: sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ lightningcss-linux-x64-gnu@1.33.0:
+ resolution:
+ {
+ integrity: sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ lightningcss-linux-x64-musl@1.33.0:
+ resolution:
+ {
+ integrity: sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ lightningcss-win32-arm64-msvc@1.33.0:
+ resolution:
+ {
+ integrity: sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [arm64]
+ os: [win32]
+
+ lightningcss-win32-x64-msvc@1.33.0:
+ resolution:
+ {
+ integrity: sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==,
+ }
+ engines: { node: ">= 12.0.0" }
+ cpu: [x64]
+ os: [win32]
+
+ lightningcss@1.33.0:
+ resolution:
+ {
+ integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==,
+ }
+ engines: { node: ">= 12.0.0" }
+
+ magic-string@1.4.3:
+ resolution:
+ {
+ integrity: sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==,
+ }
+
+ miniflare@5.20261019.2-beta:
+ resolution:
+ {
+ integrity: sha512-QNgCA/axizZ7kv7RV3nwbRoz+w4watBlwIsyXjwgYHw4eSw5BrR1F2152s3Kz+Bzy/YxjKFHrZl3LzBRbPgYoQ==,
+ }
+ engines: { node: ">=22.0.0" }
+
+ nanoid@3.3.20:
+ resolution:
+ {
+ integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==,
+ }
+ engines: { node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1 }
+ hasBin: true
+
+ obug@3.0.0:
+ resolution:
+ {
+ integrity: sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==,
+ }
+ engines: { node: ">=12.20.0" }
+
+ path-to-regexp@6.3.0:
+ resolution:
+ {
+ integrity: sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==,
+ }
+
+ pathe@2.0.3:
+ resolution:
+ {
+ integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==,
+ }
+
+ picocolors@1.1.1:
+ resolution:
+ {
+ integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==,
+ }
+
+ picomatch@4.0.7:
+ resolution:
+ {
+ integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==,
+ }
+ engines: { node: ">=12" }
+
+ postcss@8.5.31:
+ resolution:
+ {
+ integrity: sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==,
+ }
+ engines: { node: ^10 || ^12 || >=14 }
+
+ pvtsutils@1.3.6:
+ resolution:
+ {
+ integrity: sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==,
+ }
+
+ pvutils@1.2.0:
+ resolution:
+ {
+ integrity: sha512-BbubeCEyTuQjVMakvJQ/Sxbc93F2pwmbsxONT/ZRrwU7Ua38d8unYTwXpTVLAKJ4BDuH9IGztCjQcd/N/39Dvg==,
+ }
+ engines: { node: ">=16.0.0" }
+
+ reflect-metadata@0.2.2:
+ resolution:
+ {
+ integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==,
+ }
+
+ rolldown@1.2.15:
+ resolution:
+ {
+ integrity: sha512-6odND+fel5zVw3I4Yc2e69gvguDnX0CAAGiNDZSq4ik5WUcaLrkD2GLuog0XcODbor31hZ5ayEMgVDno+KPV5g==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ hasBin: true
+
+ rxjs@7.8.2:
+ resolution:
+ {
+ integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==,
+ }
+
+ semver@7.8.5:
+ resolution:
+ {
+ integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==,
+ }
+ engines: { node: ">=10" }
+ hasBin: true
+
+ sharp@0.35.5:
+ resolution:
+ {
+ integrity: sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==,
+ }
+ engines: { node: ">=20.9.0" }
+ peerDependencies:
+ "@types/node": "*"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+
+ shell-quote@1.12.0:
+ resolution:
+ {
+ integrity: sha512-PcByqNyT/38F2kDNi006HAMRJaULuBzq/FOsw3qdZvX/GA9W/jamDaRskgHjubHiftXK5sIFxLNkvrXUwcof6Q==,
+ }
+ engines: { node: ">= 0.4" }
+
+ source-map-js@1.2.2:
+ resolution:
+ {
+ integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==,
+ }
+ engines: { node: ">=0.10.0" }
+
+ std-env@4.3.0:
+ resolution:
+ {
+ integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==,
+ }
+
+ string-width@7.2.0:
+ resolution:
+ {
+ integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==,
+ }
+ engines: { node: ">=18" }
+
+ strip-ansi@7.2.0:
+ resolution:
+ {
+ integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==,
+ }
+ engines: { node: ">=12" }
+
+ supports-color@10.2.2:
+ resolution:
+ {
+ integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==,
+ }
+ engines: { node: ">=18" }
+
+ tinybench@6.2.2:
+ resolution:
+ {
+ integrity: sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==,
+ }
+ engines: { node: ">=20.0.0" }
+
+ tinyexec@1.3.1:
+ resolution:
+ {
+ integrity: sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==,
+ }
+ engines: { node: ">=18" }
+
+ tinyglobby@0.2.17:
+ resolution:
+ {
+ integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==,
+ }
+ engines: { node: ">=12.0.0" }
+
+ tree-kill@1.2.2:
+ resolution:
+ {
+ integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==,
+ }
+ hasBin: true
+
+ tslib@1.14.1:
+ resolution:
+ {
+ integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==,
+ }
+
+ tslib@2.8.1:
+ resolution:
+ {
+ integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==,
+ }
+
+ tsyringe@4.10.0:
+ resolution:
+ {
+ integrity: sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==,
+ }
+ engines: { node: ">= 6.0.0" }
+
+ typescript@7.0.2:
+ resolution:
+ {
+ integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==,
+ }
+ engines: { node: ">=16.20.0" }
+ hasBin: true
+
+ undici@7.29.1:
+ resolution:
+ {
+ integrity: sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==,
+ }
+ engines: { node: ">=20.18.1" }
+
+ unenv@2.0.0-rc.24:
+ resolution:
+ {
+ integrity: sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==,
+ }
+
+ vite@8.3.5:
+ resolution:
+ {
+ integrity: sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==,
+ }
+ engines: { node: ^20.19.0 || >=22.12.0 }
+ hasBin: true
+ peerDependencies:
+ "@types/node": ^20.19.0 || >=22.12.0
+ "@vitejs/devtools": ^0.7.1 || ^0.8.0
+ esbuild: ^0.27.0 || ^0.28.0
+ jiti: ">=1.21.0"
+ less: ^4.0.0
+ sass: ^1.70.0
+ sass-embedded: ^1.70.0
+ stylus: ">=0.54.8"
+ sugarss: ^5.0.0
+ terser: ^5.16.0
+ tsx: ^4.8.1
+ yaml: ^2.4.2
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ "@vitejs/devtools":
+ optional: true
+ esbuild:
+ optional: true
+ jiti:
+ optional: true
+ less:
+ optional: true
+ sass:
+ optional: true
+ sass-embedded:
+ optional: true
+ stylus:
+ optional: true
+ sugarss:
+ optional: true
+ terser:
+ optional: true
+ tsx:
+ optional: true
+ yaml:
+ optional: true
+
+ vitest@5.0.5:
+ resolution:
+ {
+ integrity: sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==,
+ }
+ engines: { node: ^22.12.0 || ^24.0.0 || >=26.0.0 }
+ hasBin: true
+ peerDependencies:
+ "@edge-runtime/vm": "*"
+ "@opentelemetry/api": ^1.9.0
+ "@types/node": ^22.0.0 || >=24.0.0
+ "@vitest/browser-playwright": 5.0.5
+ "@vitest/browser-preview": 5.0.5
+ "@vitest/browser-webdriverio": ^5.0.0-beta.5 || >=5.0.0
+ "@vitest/coverage-istanbul": 5.0.5
+ "@vitest/coverage-v8": 5.0.5
+ "@vitest/ui": 5.0.5
+ happy-dom: "*"
+ jsdom: "*"
+ vite: ^6.4.0 || ^7.0.0 || ^8.0.0
+ peerDependenciesMeta:
+ "@edge-runtime/vm":
+ optional: true
+ "@opentelemetry/api":
+ optional: true
+ "@types/node":
+ optional: true
+ "@vitest/browser-playwright":
+ optional: true
+ "@vitest/browser-preview":
+ optional: true
+ "@vitest/browser-webdriverio":
+ optional: true
+ "@vitest/coverage-istanbul":
+ optional: true
+ "@vitest/coverage-v8":
+ optional: true
+ "@vitest/ui":
+ optional: true
+ happy-dom:
+ optional: true
+ jsdom:
+ optional: true
+
+ why-is-node-running@3.2.1:
+ resolution:
+ {
+ integrity: sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==,
+ }
+ engines: { node: ">=20.11" }
+ hasBin: true
+
+ workerd@1.20261019.1:
+ resolution:
+ {
+ integrity: sha512-UUYRUq/7DmeCl11YriNbcVbjUZVLtt8uuCXFu+nz77hGFf8d4DEVXoCYtnA+MlBatE4+wxoj47DVqzK3xGBAiw==,
+ }
+ engines: { node: ">=16" }
+ hasBin: true
+
+ wrangler@4.152.0:
+ resolution:
+ {
+ integrity: sha512-lmXTF1sCDEqBaEMpreGczvg/x3AIh1d/qxc4BN7utQ4jEDwdA4YG0L6kr3ev0TtVLHRb6QLySNAOAunwn+dHeA==,
+ }
+ engines: { node: ">=22.0.0" }
+ hasBin: true
+ peerDependencies:
+ "@cloudflare/workers-types": ^5.20261019.1
+ peerDependenciesMeta:
+ "@cloudflare/workers-types":
+ optional: true
+
+ wrap-ansi@9.0.2:
+ resolution:
+ {
+ integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==,
+ }
+ engines: { node: ">=18" }
+
+ ws@8.21.0:
+ resolution:
+ {
+ integrity: sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==,
+ }
+ engines: { node: ">=10.0.0" }
+ peerDependencies:
+ bufferutil: ^4.0.1
+ utf-8-validate: ">=5.0.2"
+ peerDependenciesMeta:
+ bufferutil:
+ optional: true
+ utf-8-validate:
+ optional: true
+
+ y18n@5.0.8:
+ resolution:
+ {
+ integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==,
+ }
+ engines: { node: ">=10" }
+
+ yargs-parser@22.0.0:
+ resolution:
+ {
+ integrity: sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==,
+ }
+ engines: { node: ^20.19.0 || ^22.12.0 || >=23 }
+
+ yargs@18.0.0:
+ resolution:
+ {
+ integrity: sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==,
+ }
+ engines: { node: ^20.19.0 || ^22.12.0 || >=23 }
+
+ youch-core@0.3.3:
+ resolution:
+ {
+ integrity: sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==,
+ }
+
+ youch@4.1.0-beta.10:
+ resolution:
+ {
+ integrity: sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==,
+ }
+
+snapshots:
+ "@biomejs/biome@2.6.2":
+ optionalDependencies:
+ "@biomejs/cli-android-arm64": 2.6.2
+ "@biomejs/cli-android-x64": 2.6.2
+ "@biomejs/cli-darwin-arm64": 2.6.2
+ "@biomejs/cli-darwin-x64": 2.6.2
+ "@biomejs/cli-linux-arm64": 2.6.2
+ "@biomejs/cli-linux-arm64-musl": 2.6.2
+ "@biomejs/cli-linux-x64": 2.6.2
+ "@biomejs/cli-linux-x64-musl": 2.6.2
+ "@biomejs/cli-win32-arm64": 2.6.2
+ "@biomejs/cli-win32-x64": 2.6.2
+
+ "@biomejs/cli-android-arm64@2.6.2":
+ optional: true
+
+ "@biomejs/cli-android-x64@2.6.2":
+ optional: true
+
+ "@biomejs/cli-darwin-arm64@2.6.2":
+ optional: true
+
+ "@biomejs/cli-darwin-x64@2.6.2":
+ optional: true
+
+ "@biomejs/cli-linux-arm64-musl@2.6.2":
+ optional: true
+
+ "@biomejs/cli-linux-arm64@2.6.2":
+ optional: true
+
+ "@biomejs/cli-linux-x64-musl@2.6.2":
+ optional: true
+
+ "@biomejs/cli-linux-x64@2.6.2":
+ optional: true
+
+ "@biomejs/cli-win32-arm64@2.6.2":
+ optional: true
+
+ "@biomejs/cli-win32-x64@2.6.2":
+ optional: true
+
+ "@cloudflare/kv-asset-handler@0.5.0": {}
+
+ "@cloudflare/unenv-preset@2.16.2(unenv@2.0.0-rc.24)(workerd@1.20261019.1)":
+ dependencies:
+ unenv: 2.0.0-rc.24
+ optionalDependencies:
+ workerd: 1.20261019.1
+
+ "@cloudflare/workerd-darwin-64@1.20261019.1":
+ optional: true
+
+ "@cloudflare/workerd-darwin-arm64@1.20261019.1":
+ optional: true
+
+ "@cloudflare/workerd-linux-64@1.20261019.1":
+ optional: true
+
+ "@cloudflare/workerd-linux-arm64@1.20261019.1":
+ optional: true
+
+ "@cloudflare/workerd-windows-64@1.20261019.1":
+ optional: true
+
+ "@cloudflare/workers-types@5.20261023.1": {}
+
+ "@cspotcode/source-map-support@0.8.1":
+ dependencies:
+ "@jridgewell/trace-mapping": 0.3.9
+
+ "@emnapi/runtime@1.11.3":
+ dependencies:
+ tslib: 2.8.1
+ optional: true
+
+ "@esbuild/aix-ppc64@0.28.2":
+ optional: true
+
+ "@esbuild/android-arm64@0.28.2":
+ optional: true
+
+ "@esbuild/android-arm@0.28.2":
+ optional: true
+
+ "@esbuild/android-x64@0.28.2":
+ optional: true
+
+ "@esbuild/darwin-arm64@0.28.2":
+ optional: true
+
+ "@esbuild/darwin-x64@0.28.2":
+ optional: true
+
+ "@esbuild/freebsd-arm64@0.28.2":
+ optional: true
+
+ "@esbuild/freebsd-x64@0.28.2":
+ optional: true
+
+ "@esbuild/linux-arm64@0.28.2":
+ optional: true
+
+ "@esbuild/linux-arm@0.28.2":
+ optional: true
+
+ "@esbuild/linux-ia32@0.28.2":
+ optional: true
+
+ "@esbuild/linux-loong64@0.28.2":
+ optional: true
+
+ "@esbuild/linux-mips64el@0.28.2":
+ optional: true
+
+ "@esbuild/linux-ppc64@0.28.2":
+ optional: true
+
+ "@esbuild/linux-riscv64@0.28.2":
+ optional: true
+
+ "@esbuild/linux-s390x@0.28.2":
+ optional: true
+
+ "@esbuild/linux-x64@0.28.2":
+ optional: true
+
+ "@esbuild/netbsd-arm64@0.28.2":
+ optional: true
+
+ "@esbuild/netbsd-x64@0.28.2":
+ optional: true
+
+ "@esbuild/openbsd-arm64@0.28.2":
+ optional: true
+
+ "@esbuild/openbsd-x64@0.28.2":
+ optional: true
+
+ "@esbuild/openharmony-arm64@0.28.2":
+ optional: true
+
+ "@esbuild/sunos-x64@0.28.2":
+ optional: true
+
+ "@esbuild/win32-arm64@0.28.2":
+ optional: true
+
+ "@esbuild/win32-ia32@0.28.2":
+ optional: true
+
+ "@esbuild/win32-x64@0.28.2":
+ optional: true
+
+ "@hexagon/base64@1.1.28": {}
+
+ "@img/colour@1.1.0": {}
+
+ "@img/sharp-darwin-arm64@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-darwin-arm64": 1.3.4
+ optional: true
+
+ "@img/sharp-darwin-x64@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-darwin-x64": 1.3.4
+ optional: true
+
+ "@img/sharp-freebsd-wasm32@0.35.5":
+ dependencies:
+ "@img/sharp-wasm32": 0.35.5
+ optional: true
+
+ "@img/sharp-libvips-darwin-arm64@1.3.4":
+ optional: true
+
+ "@img/sharp-libvips-darwin-x64@1.3.4":
+ optional: true
+
+ "@img/sharp-libvips-linux-arm64@1.3.4":
+ optional: true
+
+ "@img/sharp-libvips-linux-arm@1.3.4":
+ optional: true
+
+ "@img/sharp-libvips-linux-ppc64@1.3.4":
+ optional: true
+
+ "@img/sharp-libvips-linux-riscv64@1.3.4":
+ optional: true
+
+ "@img/sharp-libvips-linux-s390x@1.3.4":
+ optional: true
+
+ "@img/sharp-libvips-linux-x64@1.3.4":
+ optional: true
+
+ "@img/sharp-libvips-linuxmusl-arm64@1.3.4":
+ optional: true
+
+ "@img/sharp-libvips-linuxmusl-x64@1.3.4":
+ optional: true
+
+ "@img/sharp-linux-arm64@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-linux-arm64": 1.3.4
+ optional: true
+
+ "@img/sharp-linux-arm@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-linux-arm": 1.3.4
+ optional: true
+
+ "@img/sharp-linux-ppc64@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-linux-ppc64": 1.3.4
+ optional: true
+
+ "@img/sharp-linux-riscv64@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-linux-riscv64": 1.3.4
+ optional: true
+
+ "@img/sharp-linux-s390x@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-linux-s390x": 1.3.4
+ optional: true
+
+ "@img/sharp-linux-x64@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-linux-x64": 1.3.4
+ optional: true
+
+ "@img/sharp-linuxmusl-arm64@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-linuxmusl-arm64": 1.3.4
+ optional: true
+
+ "@img/sharp-linuxmusl-x64@0.35.5":
+ optionalDependencies:
+ "@img/sharp-libvips-linuxmusl-x64": 1.3.4
+ optional: true
+
+ "@img/sharp-wasm32@0.35.5":
+ dependencies:
+ "@emnapi/runtime": 1.11.3
+ optional: true
+
+ "@img/sharp-webcontainers-wasm32@0.35.5":
+ dependencies:
+ "@img/sharp-wasm32": 0.35.5
+ optional: true
+
+ "@img/sharp-win32-arm64@0.35.5":
+ optional: true
+
+ "@img/sharp-win32-ia32@0.35.5":
+ optional: true
+
+ "@img/sharp-win32-x64@0.35.5":
+ optional: true
+
+ "@jridgewell/resolve-uri@3.1.2": {}
+
+ "@jridgewell/sourcemap-codec@1.6.0": {}
+
+ "@jridgewell/trace-mapping@0.3.31":
+ dependencies:
+ "@jridgewell/resolve-uri": 3.1.2
+ "@jridgewell/sourcemap-codec": 1.6.0
+
+ "@jridgewell/trace-mapping@0.3.9":
+ dependencies:
+ "@jridgewell/resolve-uri": 3.1.2
+ "@jridgewell/sourcemap-codec": 1.6.0
+
+ "@levischuck/tiny-cbor@0.2.11": {}
+
+ "@oxc-project/types@0.155.0": {}
+
+ "@peculiar/asn1-android@2.11.0":
+ dependencies:
+ "@peculiar/asn1-schema": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-asym-key@2.11.0":
+ dependencies:
+ "@peculiar/asn1-pkcs8": 2.11.0
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-cms@2.11.0":
+ dependencies:
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ "@peculiar/asn1-x509-attr": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-csr@2.11.0":
+ dependencies:
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-ecc@2.11.0":
+ dependencies:
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-pfx@2.11.0":
+ dependencies:
+ "@peculiar/asn1-cms": 2.11.0
+ "@peculiar/asn1-pkcs8": 2.11.0
+ "@peculiar/asn1-rsa": 2.11.0
+ "@peculiar/asn1-schema": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-pkcs8@2.11.0":
+ dependencies:
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-pkcs9@2.11.0":
+ dependencies:
+ "@peculiar/asn1-cms": 2.11.0
+ "@peculiar/asn1-pfx": 2.11.0
+ "@peculiar/asn1-pkcs8": 2.11.0
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ "@peculiar/asn1-x509-attr": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-rsa@2.11.0":
+ dependencies:
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-schema@2.11.0":
+ dependencies:
+ "@peculiar/utils": 2.0.3
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-x509-attr@2.11.0":
+ dependencies:
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-x509-post-quantum@2.11.0":
+ dependencies:
+ "@peculiar/asn1-asym-key": 2.11.0
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/asn1-x509@2.11.0":
+ dependencies:
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/utils": 2.0.3
+ asn1js: 3.1.0
+ tslib: 2.8.1
+
+ "@peculiar/utils@2.0.3":
+ dependencies:
+ tslib: 2.8.1
+
+ "@peculiar/x509@2.2.0":
+ dependencies:
+ "@peculiar/asn1-cms": 2.11.0
+ "@peculiar/asn1-csr": 2.11.0
+ "@peculiar/asn1-ecc": 2.11.0
+ "@peculiar/asn1-pkcs9": 2.11.0
+ "@peculiar/asn1-rsa": 2.11.0
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ "@peculiar/asn1-x509-post-quantum": 2.11.0
+ pvtsutils: 1.3.6
+ tslib: 2.8.1
+ tsyringe: 4.10.0
+
+ "@poppinss/colors@4.1.6":
+ dependencies:
+ kleur: 4.1.5
+
+ "@poppinss/dumper@0.6.5":
+ dependencies:
+ "@poppinss/colors": 4.1.6
+ "@sindresorhus/is": 7.2.0
+ supports-color: 10.2.2
+
+ "@poppinss/exception@1.2.3": {}
+
+ "@rolldown/binding-android-arm-eabi@1.2.15":
+ optional: true
+
+ "@rolldown/binding-android-arm64@1.2.15":
+ optional: true
+
+ "@rolldown/binding-darwin-arm64@1.2.15":
+ optional: true
+
+ "@rolldown/binding-darwin-x64@1.2.15":
+ optional: true
+
+ "@rolldown/binding-freebsd-x64@1.2.15":
+ optional: true
+
+ "@rolldown/binding-linux-arm-gnueabihf@1.2.15":
+ optional: true
+
+ "@rolldown/binding-linux-arm64-gnu@1.2.15":
+ optional: true
+
+ "@rolldown/binding-linux-arm64-musl@1.2.15":
+ optional: true
+
+ "@rolldown/binding-linux-ppc64-gnu@1.2.15":
+ optional: true
+
+ "@rolldown/binding-linux-s390x-gnu@1.2.15":
+ optional: true
+
+ "@rolldown/binding-linux-x64-gnu@1.2.15":
+ optional: true
+
+ "@rolldown/binding-linux-x64-musl@1.2.15":
+ optional: true
+
+ "@rolldown/binding-openharmony-arm64@1.2.15":
+ optional: true
+
+ "@rolldown/binding-win32-arm64-msvc@1.2.15":
+ optional: true
+
+ "@rolldown/binding-win32-x64-msvc@1.2.15":
+ optional: true
+
+ "@rolldown/pluginutils@1.0.1": {}
+
+ "@simplewebauthn/server@14.0.3":
+ dependencies:
+ "@hexagon/base64": 1.1.28
+ "@levischuck/tiny-cbor": 0.2.11
+ "@peculiar/asn1-android": 2.11.0
+ "@peculiar/asn1-ecc": 2.11.0
+ "@peculiar/asn1-rsa": 2.11.0
+ "@peculiar/asn1-schema": 2.11.0
+ "@peculiar/asn1-x509": 2.11.0
+ "@peculiar/asn1-x509-post-quantum": 2.11.0
+ "@peculiar/x509": 2.2.0
+ reflect-metadata: 0.2.2
+
+ "@sindresorhus/is@7.2.0": {}
+
+ "@speed-highlight/core@1.2.24": {}
+
+ "@types/chai@5.2.3":
+ dependencies:
+ "@types/deep-eql": 4.0.2
+ assertion-error: 2.0.1
+
+ "@types/deep-eql@4.0.2": {}
+
+ "@types/estree@1.0.9": {}
+
+ "@typescript/typescript-aix-ppc64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-darwin-arm64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-darwin-x64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-freebsd-arm64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-freebsd-x64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-linux-arm64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-linux-arm@7.0.2":
+ optional: true
+
+ "@typescript/typescript-linux-loong64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-linux-mips64el@7.0.2":
+ optional: true
+
+ "@typescript/typescript-linux-ppc64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-linux-riscv64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-linux-s390x@7.0.2":
+ optional: true
+
+ "@typescript/typescript-linux-x64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-netbsd-arm64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-netbsd-x64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-openbsd-arm64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-openbsd-x64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-sunos-x64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-win32-arm64@7.0.2":
+ optional: true
+
+ "@typescript/typescript-win32-x64@7.0.2":
+ optional: true
+
+ "@vitest/mocker@5.0.5(vite@8.3.5(esbuild@0.28.2))":
+ dependencies:
+ "@jridgewell/trace-mapping": 0.3.31
+ "@vitest/spy": 5.0.5
+ estree-walker: 3.0.3
+ magic-string: 1.4.3
+ optionalDependencies:
+ vite: 8.3.5(esbuild@0.28.2)
+
+ "@vitest/spy@5.0.5": {}
+
+ ansi-regex@6.4.0: {}
+
+ ansi-styles@6.2.3: {}
+
+ asn1js@3.1.0:
+ dependencies:
+ pvtsutils: 1.3.6
+ pvutils: 1.2.0
+ tslib: 2.8.1
+
+ assertion-error@2.0.1: {}
+
+ blake3-wasm@2.1.5: {}
+
+ chai@6.3.0: {}
+
+ chalk@5.6.2: {}
+
+ cliui@9.0.1:
+ dependencies:
+ string-width: 7.2.0
+ strip-ansi: 7.2.0
+ wrap-ansi: 9.0.2
+
+ concurrently@10.0.6:
+ dependencies:
+ chalk: 5.6.2
+ rxjs: 7.8.2
+ shell-quote: 1.12.0
+ supports-color: 10.2.2
+ tree-kill: 1.2.2
+ yargs: 18.0.0
+
+ cookie@1.1.1: {}
+
+ detect-libc@2.1.2: {}
+
+ emoji-regex@10.6.0: {}
+
+ error-stack-parser-es@1.0.5: {}
+
+ es-module-lexer@2.3.2: {}
+
+ esbuild@0.28.2:
+ optionalDependencies:
+ "@esbuild/aix-ppc64": 0.28.2
+ "@esbuild/android-arm": 0.28.2
+ "@esbuild/android-arm64": 0.28.2
+ "@esbuild/android-x64": 0.28.2
+ "@esbuild/darwin-arm64": 0.28.2
+ "@esbuild/darwin-x64": 0.28.2
+ "@esbuild/freebsd-arm64": 0.28.2
+ "@esbuild/freebsd-x64": 0.28.2
+ "@esbuild/linux-arm": 0.28.2
+ "@esbuild/linux-arm64": 0.28.2
+ "@esbuild/linux-ia32": 0.28.2
+ "@esbuild/linux-loong64": 0.28.2
+ "@esbuild/linux-mips64el": 0.28.2
+ "@esbuild/linux-ppc64": 0.28.2
+ "@esbuild/linux-riscv64": 0.28.2
+ "@esbuild/linux-s390x": 0.28.2
+ "@esbuild/linux-x64": 0.28.2
+ "@esbuild/netbsd-arm64": 0.28.2
+ "@esbuild/netbsd-x64": 0.28.2
+ "@esbuild/openbsd-arm64": 0.28.2
+ "@esbuild/openbsd-x64": 0.28.2
+ "@esbuild/openharmony-arm64": 0.28.2
+ "@esbuild/sunos-x64": 0.28.2
+ "@esbuild/win32-arm64": 0.28.2
+ "@esbuild/win32-ia32": 0.28.2
+ "@esbuild/win32-x64": 0.28.2
+
+ escalade@3.2.0: {}
+
+ estree-walker@3.0.3:
+ dependencies:
+ "@types/estree": 1.0.9
+
+ expect-type@1.4.0: {}
+
+ fdir@6.5.0(picomatch@4.0.7):
+ optionalDependencies:
+ picomatch: 4.0.7
+
+ fsevents@2.3.3:
+ optional: true
+
+ get-caller-file@2.0.5: {}
+
+ get-east-asian-width@1.7.0: {}
+
+ hono@4.13.13: {}
+
+ kleur@4.1.5: {}
+
+ lightningcss-android-arm64@1.33.0:
+ optional: true
+
+ lightningcss-darwin-arm64@1.33.0:
+ optional: true
+
+ lightningcss-darwin-x64@1.33.0:
+ optional: true
+
+ lightningcss-freebsd-x64@1.33.0:
+ optional: true
+
+ lightningcss-linux-arm-gnueabihf@1.33.0:
+ optional: true
+
+ lightningcss-linux-arm64-gnu@1.33.0:
+ optional: true
+
+ lightningcss-linux-arm64-musl@1.33.0:
+ optional: true
+
+ lightningcss-linux-x64-gnu@1.33.0:
+ optional: true
+
+ lightningcss-linux-x64-musl@1.33.0:
+ optional: true
+
+ lightningcss-win32-arm64-msvc@1.33.0:
+ optional: true
+
+ lightningcss-win32-x64-msvc@1.33.0:
+ optional: true
+
+ lightningcss@1.33.0:
+ dependencies:
+ detect-libc: 2.1.2
+ optionalDependencies:
+ lightningcss-android-arm64: 1.33.0
+ lightningcss-darwin-arm64: 1.33.0
+ lightningcss-darwin-x64: 1.33.0
+ lightningcss-freebsd-x64: 1.33.0
+ lightningcss-linux-arm-gnueabihf: 1.33.0
+ lightningcss-linux-arm64-gnu: 1.33.0
+ lightningcss-linux-arm64-musl: 1.33.0
+ lightningcss-linux-x64-gnu: 1.33.0
+ lightningcss-linux-x64-musl: 1.33.0
+ lightningcss-win32-arm64-msvc: 1.33.0
+ lightningcss-win32-x64-msvc: 1.33.0
+
+ magic-string@1.4.3:
+ dependencies:
+ "@jridgewell/sourcemap-codec": 1.6.0
+
+ miniflare@5.20261019.2-beta:
+ dependencies:
+ "@cspotcode/source-map-support": 0.8.1
+ sharp: 0.35.5
+ undici: 7.29.1
+ workerd: 1.20261019.1
+ ws: 8.21.0
+ youch: 4.1.0-beta.10
+ transitivePeerDependencies:
+ - "@types/node"
+ - bufferutil
+ - utf-8-validate
+
+ nanoid@3.3.20: {}
+
+ obug@3.0.0: {}
+
+ path-to-regexp@6.3.0: {}
+
+ pathe@2.0.3: {}
+
+ picocolors@1.1.1: {}
+
+ picomatch@4.0.7: {}
+
+ postcss@8.5.31:
+ dependencies:
+ nanoid: 3.3.20
+ picocolors: 1.1.1
+ source-map-js: 1.2.2
+
+ pvtsutils@1.3.6:
+ dependencies:
+ tslib: 2.8.1
+
+ pvutils@1.2.0: {}
+
+ reflect-metadata@0.2.2: {}
+
+ rolldown@1.2.15:
+ dependencies:
+ "@oxc-project/types": 0.155.0
+ "@rolldown/pluginutils": 1.0.1
+ optionalDependencies:
+ "@rolldown/binding-android-arm-eabi": 1.2.15
+ "@rolldown/binding-android-arm64": 1.2.15
+ "@rolldown/binding-darwin-arm64": 1.2.15
+ "@rolldown/binding-darwin-x64": 1.2.15
+ "@rolldown/binding-freebsd-x64": 1.2.15
+ "@rolldown/binding-linux-arm-gnueabihf": 1.2.15
+ "@rolldown/binding-linux-arm64-gnu": 1.2.15
+ "@rolldown/binding-linux-arm64-musl": 1.2.15
+ "@rolldown/binding-linux-ppc64-gnu": 1.2.15
+ "@rolldown/binding-linux-s390x-gnu": 1.2.15
+ "@rolldown/binding-linux-x64-gnu": 1.2.15
+ "@rolldown/binding-linux-x64-musl": 1.2.15
+ "@rolldown/binding-openharmony-arm64": 1.2.15
+ "@rolldown/binding-win32-arm64-msvc": 1.2.15
+ "@rolldown/binding-win32-x64-msvc": 1.2.15
+
+ rxjs@7.8.2:
+ dependencies:
+ tslib: 2.8.1
+
+ semver@7.8.5: {}
+
+ sharp@0.35.5:
+ dependencies:
+ "@img/colour": 1.1.0
+ detect-libc: 2.1.2
+ semver: 7.8.5
+ optionalDependencies:
+ "@img/sharp-darwin-arm64": 0.35.5
+ "@img/sharp-darwin-x64": 0.35.5
+ "@img/sharp-freebsd-wasm32": 0.35.5
+ "@img/sharp-libvips-darwin-arm64": 1.3.4
+ "@img/sharp-libvips-darwin-x64": 1.3.4
+ "@img/sharp-libvips-linux-arm": 1.3.4
+ "@img/sharp-libvips-linux-arm64": 1.3.4
+ "@img/sharp-libvips-linux-ppc64": 1.3.4
+ "@img/sharp-libvips-linux-riscv64": 1.3.4
+ "@img/sharp-libvips-linux-s390x": 1.3.4
+ "@img/sharp-libvips-linux-x64": 1.3.4
+ "@img/sharp-libvips-linuxmusl-arm64": 1.3.4
+ "@img/sharp-libvips-linuxmusl-x64": 1.3.4
+ "@img/sharp-linux-arm": 0.35.5
+ "@img/sharp-linux-arm64": 0.35.5
+ "@img/sharp-linux-ppc64": 0.35.5
+ "@img/sharp-linux-riscv64": 0.35.5
+ "@img/sharp-linux-s390x": 0.35.5
+ "@img/sharp-linux-x64": 0.35.5
+ "@img/sharp-linuxmusl-arm64": 0.35.5
+ "@img/sharp-linuxmusl-x64": 0.35.5
+ "@img/sharp-webcontainers-wasm32": 0.35.5
+ "@img/sharp-win32-arm64": 0.35.5
+ "@img/sharp-win32-ia32": 0.35.5
+ "@img/sharp-win32-x64": 0.35.5
+
+ shell-quote@1.12.0: {}
+
+ source-map-js@1.2.2: {}
+
+ std-env@4.3.0: {}
+
+ string-width@7.2.0:
+ dependencies:
+ emoji-regex: 10.6.0
+ get-east-asian-width: 1.7.0
+ strip-ansi: 7.2.0
+
+ strip-ansi@7.2.0:
+ dependencies:
+ ansi-regex: 6.4.0
+
+ supports-color@10.2.2: {}
+
+ tinybench@6.2.2: {}
+
+ tinyexec@1.3.1: {}
+
+ tinyglobby@0.2.17:
+ dependencies:
+ fdir: 6.5.0(picomatch@4.0.7)
+ picomatch: 4.0.7
+
+ tree-kill@1.2.2: {}
+
+ tslib@1.14.1: {}
+
+ tslib@2.8.1: {}
+
+ tsyringe@4.10.0:
+ dependencies:
+ tslib: 1.14.1
+
+ typescript@7.0.2:
+ optionalDependencies:
+ "@typescript/typescript-aix-ppc64": 7.0.2
+ "@typescript/typescript-darwin-arm64": 7.0.2
+ "@typescript/typescript-darwin-x64": 7.0.2
+ "@typescript/typescript-freebsd-arm64": 7.0.2
+ "@typescript/typescript-freebsd-x64": 7.0.2
+ "@typescript/typescript-linux-arm": 7.0.2
+ "@typescript/typescript-linux-arm64": 7.0.2
+ "@typescript/typescript-linux-loong64": 7.0.2
+ "@typescript/typescript-linux-mips64el": 7.0.2
+ "@typescript/typescript-linux-ppc64": 7.0.2
+ "@typescript/typescript-linux-riscv64": 7.0.2
+ "@typescript/typescript-linux-s390x": 7.0.2
+ "@typescript/typescript-linux-x64": 7.0.2
+ "@typescript/typescript-netbsd-arm64": 7.0.2
+ "@typescript/typescript-netbsd-x64": 7.0.2
+ "@typescript/typescript-openbsd-arm64": 7.0.2
+ "@typescript/typescript-openbsd-x64": 7.0.2
+ "@typescript/typescript-sunos-x64": 7.0.2
+ "@typescript/typescript-win32-arm64": 7.0.2
+ "@typescript/typescript-win32-x64": 7.0.2
+
+ undici@7.29.1: {}
+
+ unenv@2.0.0-rc.24:
+ dependencies:
+ pathe: 2.0.3
+
+ vite@8.3.5(esbuild@0.28.2):
+ dependencies:
+ lightningcss: 1.33.0
+ picomatch: 4.0.7
+ postcss: 8.5.31
+ rolldown: 1.2.15
+ tinyglobby: 0.2.17
+ optionalDependencies:
+ esbuild: 0.28.2
+ fsevents: 2.3.3
+
+ vitest@5.0.5(vite@8.3.5(esbuild@0.28.2)):
+ dependencies:
+ "@types/chai": 5.2.3
+ "@vitest/mocker": 5.0.5(vite@8.3.5(esbuild@0.28.2))
+ chai: 6.3.0
+ es-module-lexer: 2.3.2
+ expect-type: 1.4.0
+ magic-string: 1.4.3
+ obug: 3.0.0
+ picomatch: 4.0.7
+ std-env: 4.3.0
+ tinybench: 6.2.2
+ tinyexec: 1.3.1
+ tinyglobby: 0.2.17
+ vite: 8.3.5(esbuild@0.28.2)
+ why-is-node-running: 3.2.1
+ transitivePeerDependencies:
+ - msw
+
+ why-is-node-running@3.2.1: {}
+
+ workerd@1.20261019.1:
+ optionalDependencies:
+ "@cloudflare/workerd-darwin-64": 1.20261019.1
+ "@cloudflare/workerd-darwin-arm64": 1.20261019.1
+ "@cloudflare/workerd-linux-64": 1.20261019.1
+ "@cloudflare/workerd-linux-arm64": 1.20261019.1
+ "@cloudflare/workerd-windows-64": 1.20261019.1
+
+ wrangler@4.152.0(@cloudflare/workers-types@5.20261023.1):
+ dependencies:
+ "@cloudflare/kv-asset-handler": 0.5.0
+ "@cloudflare/unenv-preset": 2.16.2(unenv@2.0.0-rc.24)(workerd@1.20261019.1)
+ blake3-wasm: 2.1.5
+ esbuild: 0.28.2
+ miniflare: 5.20261019.2-beta
+ path-to-regexp: 6.3.0
+ unenv: 2.0.0-rc.24
+ workerd: 1.20261019.1
+ optionalDependencies:
+ "@cloudflare/workers-types": 5.20261023.1
+ fsevents: 2.3.3
+ transitivePeerDependencies:
+ - "@types/node"
+ - bufferutil
+ - utf-8-validate
+
+ wrap-ansi@9.0.2:
+ dependencies:
+ ansi-styles: 6.2.3
+ string-width: 7.2.0
+ strip-ansi: 7.2.0
+
+ ws@8.21.0: {}
+
+ y18n@5.0.8: {}
+
+ yargs-parser@22.0.0: {}
+
+ yargs@18.0.0:
+ dependencies:
+ cliui: 9.0.1
+ escalade: 3.2.0
+ get-caller-file: 2.0.5
+ string-width: 7.2.0
+ y18n: 5.0.8
+ yargs-parser: 22.0.0
+
+ youch-core@0.3.3:
+ dependencies:
+ "@poppinss/exception": 1.2.3
+ error-stack-parser-es: 1.0.5
+
+ youch@4.1.0-beta.10:
+ dependencies:
+ "@poppinss/colors": 4.1.6
+ "@poppinss/dumper": 0.6.5
+ "@speed-highlight/core": 1.2.24
+ cookie: 1.1.1
+ youch-core: 0.3.3
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
new file mode 100644
index 0000000..9dfce21
--- /dev/null
+++ b/pnpm-workspace.yaml
@@ -0,0 +1,7 @@
+packages:
+ - web
+ - worker
+allowBuilds:
+ "@biomejs/biome": true
+ esbuild: true
+ workerd: true
diff --git a/scripts/materialize-secrets.mjs b/scripts/materialize-secrets.mjs
new file mode 100644
index 0000000..7d83dbb
--- /dev/null
+++ b/scripts/materialize-secrets.mjs
@@ -0,0 +1,25 @@
+// Writes Cloudflare secrets to a private temp file for `wrangler deploy
+// --secrets-file`. Values come from GitHub Actions secrets via env; they are
+// never printed or committed.
+import { mkdirSync, writeFileSync } from "node:fs";
+
+if (!process.env.RUNNER_TEMP) {
+ console.error("RUNNER_TEMP is not set");
+ process.exit(1);
+}
+
+const secrets = {
+ SESSION_SECRET: process.env.SESSION_SECRET,
+ SETUP_SECRET: process.env.SETUP_SECRET,
+};
+for (const [key, value] of Object.entries(secrets)) {
+ if (!value) {
+ console.error(`${key} is missing — configure it as a repository secret`);
+ process.exit(1);
+ }
+}
+
+const path = `${process.env.RUNNER_TEMP}/secrets.json`;
+mkdirSync(process.env.RUNNER_TEMP, { recursive: true });
+writeFileSync(path, JSON.stringify(secrets), { mode: 0o600 });
+console.log(`secrets written to ${path}`);
diff --git a/tsconfig.base.json b/tsconfig.base.json
new file mode 100644
index 0000000..4897141
--- /dev/null
+++ b/tsconfig.base.json
@@ -0,0 +1,14 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true
+ }
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..460e327
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ "files": [],
+ "references": [{ "path": "./web" }, { "path": "./worker" }]
+}
diff --git a/web/index.html b/web/index.html
new file mode 100644
index 0000000..a3faa79
--- /dev/null
+++ b/web/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ nav
+
+
+
+
+
+
diff --git a/web/package.json b/web/package.json
new file mode 100644
index 0000000..7b55d7d
--- /dev/null
+++ b/web/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "web",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "dev": "vite",
+ "build": "tsc -b && vite build",
+ "typecheck": "tsc -b",
+ "preview": "vite preview"
+ },
+ "devDependencies": {
+ "typescript": "^7.0.0",
+ "vite": "^8.0.15"
+ }
+}
diff --git a/web/src/main.ts b/web/src/main.ts
new file mode 100644
index 0000000..854ac20
--- /dev/null
+++ b/web/src/main.ts
@@ -0,0 +1,8 @@
+// Placeholder entry — the real SPA is developed in the frontend sub-issue.
+// This stub keeps the monorepo build green until then.
+const root = document.getElementById("root");
+if (root) {
+ root.textContent = "nav — frontend coming soon";
+}
+
+export {};
diff --git a/web/tsconfig.json b/web/tsconfig.json
new file mode 100644
index 0000000..7a86e8f
--- /dev/null
+++ b/web/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../tsconfig.base.json",
+ "compilerOptions": {
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
+ "types": []
+ },
+ "include": ["src/**/*.ts"]
+}
diff --git a/web/vite.config.ts b/web/vite.config.ts
new file mode 100644
index 0000000..fed0eb1
--- /dev/null
+++ b/web/vite.config.ts
@@ -0,0 +1,7 @@
+import { defineConfig } from "vite";
+
+export default defineConfig({
+ build: {
+ outDir: "dist",
+ },
+});
diff --git a/worker/.dev.vars.example b/worker/.dev.vars.example
new file mode 100644
index 0000000..f9d400d
--- /dev/null
+++ b/worker/.dev.vars.example
@@ -0,0 +1,7 @@
+# Minimal `.dev.vars` template for local `wrangler dev`.
+# Copy to `.dev.vars` (gitignored) and fill in real values — never commit them.
+# Production receives these as wrangler secrets (see .github/workflows/deploy.yml).
+# SESSION_SECRET: signs the nav_session cookie (HS256)
+SESSION_SECRET=replace-with-a-long-random-string
+# SETUP_SECRET: one-time token for creating the owner account
+SETUP_SECRET=replace-with-a-long-random-setup-token
diff --git a/worker/package.json b/worker/package.json
new file mode 100644
index 0000000..8bdb3fa
--- /dev/null
+++ b/worker/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "worker",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "codegen": "node scripts/gen-schema.mjs",
+ "dev": "pnpm codegen && wrangler dev",
+ "build": "pnpm codegen && tsc --noEmit",
+ "typecheck": "pnpm codegen && tsc --noEmit",
+ "test": "pnpm codegen && vitest run",
+ "deploy": "wrangler deploy"
+ },
+ "dependencies": {
+ "@simplewebauthn/server": "^14.0.0",
+ "hono": "^4.7.9"
+ },
+ "devDependencies": {
+ "@cloudflare/workers-types": "^5.0.0",
+ "typescript": "^7.0.0",
+ "vitest": "^5.0.5",
+ "wrangler": "^4.14.1"
+ }
+}
diff --git a/worker/scripts/gen-schema.mjs b/worker/scripts/gen-schema.mjs
new file mode 100644
index 0000000..583803f
--- /dev/null
+++ b/worker/scripts/gen-schema.mjs
@@ -0,0 +1,19 @@
+#!/usr/bin/env node
+// Generates src/db/schema.generated.ts from src/db/schema.sql so the schema can
+// be imported as a plain string in both the Worker build and the test runner.
+// Run via `pnpm --filter worker codegen` (also invoked before typecheck/test).
+import { readFileSync, writeFileSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+
+const sqlPath = fileURLToPath(new URL("../src/db/schema.sql", import.meta.url));
+const outPath = fileURLToPath(
+ new URL("../src/db/schema.generated.ts", import.meta.url),
+);
+const sql = readFileSync(sqlPath, "utf8");
+
+const banner = `// AUTO-GENERATED by scripts/gen-schema.mjs from src/db/schema.sql — do not edit.
+export const SCHEMA_SQL = ${JSON.stringify(sql)};
+`;
+
+writeFileSync(outPath, banner);
+console.log("schema.generated.ts written");
diff --git a/worker/src/core/auth.ts b/worker/src/core/auth.ts
new file mode 100644
index 0000000..de5419e
--- /dev/null
+++ b/worker/src/core/auth.ts
@@ -0,0 +1,233 @@
+import type { JWTPayload } from "../types";
+
+// ─── Buffer helpers ───────────────────────────────────────────────────────────
+
+function bufToHex(buf: Uint8Array | ArrayBuffer): string {
+ const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);
+ return Array.from(bytes)
+ .map((b) => b.toString(16).padStart(2, "0"))
+ .join("");
+}
+
+function hexToBytes(hex: string): Uint8Array {
+ const bytes = new Uint8Array(hex.length / 2);
+ for (let i = 0; i < hex.length; i += 2) {
+ bytes[i / 2] = Number.parseInt(hex.slice(i, i + 2), 16);
+ }
+ return bytes;
+}
+
+// ─── Base64url helpers ────────────────────────────────────────────────────────
+
+function base64urlEncodeString(input: string): string {
+ const bytes = new TextEncoder().encode(input);
+ let binary = "";
+ for (let i = 0; i < bytes.length; i++)
+ binary += String.fromCharCode(bytes[i]);
+ return btoa(binary)
+ .replace(/\+/g, "-")
+ .replace(/\//g, "_")
+ .replace(/=+$/, "");
+}
+
+function base64urlEncodeBuffer(input: ArrayBuffer): string {
+ const bytes = new Uint8Array(input);
+ let binary = "";
+ for (let i = 0; i < bytes.length; i++)
+ binary += String.fromCharCode(bytes[i]);
+ return btoa(binary)
+ .replace(/\+/g, "-")
+ .replace(/\//g, "_")
+ .replace(/=+$/, "");
+}
+
+function base64urlDecodeToString(input: string): string {
+ const padded = input.replace(/-/g, "+").replace(/_/g, "/");
+ const pad = padded.length % 4;
+ return atob(pad ? padded + "=".repeat(4 - pad) : padded);
+}
+
+function base64urlDecodeToBuffer(input: string): ArrayBuffer {
+ const binary = base64urlDecodeToString(input);
+ const bytes = new Uint8Array(binary.length);
+ for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
+ return bytes.buffer;
+}
+
+// ─── Password hashing (PBKDF2-SHA256, 100k iterations — eNotify/Zeta scheme) ─
+
+export async function hashPassword(password: string): Promise {
+ const salt = crypto.getRandomValues(new Uint8Array(32));
+
+ const keyMaterial = await crypto.subtle.importKey(
+ "raw",
+ new TextEncoder().encode(password),
+ "PBKDF2",
+ false,
+ ["deriveBits"],
+ );
+
+ const hashBuffer = await crypto.subtle.deriveBits(
+ { name: "PBKDF2", salt, iterations: 100_000, hash: "SHA-256" },
+ keyMaterial,
+ 256,
+ );
+
+ return `${bufToHex(salt)}:${bufToHex(hashBuffer)}`;
+}
+
+export async function verifyPassword(
+ password: string,
+ stored: string,
+): Promise {
+ const colonIdx = stored.indexOf(":");
+ if (colonIdx === -1) return false;
+
+ const saltHex = stored.slice(0, colonIdx);
+ const storedHash = stored.slice(colonIdx + 1);
+ if (!saltHex || !storedHash) return false;
+
+ const salt = hexToBytes(saltHex);
+
+ const keyMaterial = await crypto.subtle.importKey(
+ "raw",
+ new TextEncoder().encode(password),
+ "PBKDF2",
+ false,
+ ["deriveBits"],
+ );
+
+ const hashBuffer = await crypto.subtle.deriveBits(
+ { name: "PBKDF2", salt, iterations: 100_000, hash: "SHA-256" },
+ keyMaterial,
+ 256,
+ );
+
+ const hashHex = bufToHex(hashBuffer);
+
+ // Constant-time comparison
+ if (hashHex.length !== storedHash.length) return false;
+ let diff = 0;
+ for (let i = 0; i < hashHex.length; i++) {
+ diff |= hashHex.charCodeAt(i) ^ storedHash.charCodeAt(i);
+ }
+ return diff === 0;
+}
+
+// ─── Session token (HS256 JWT, eNotify/Zeta scheme) ──────────────────────────
+
+export async function signJWT(
+ payload: JWTPayload,
+ secret: string,
+): Promise {
+ const encodedHeader = base64urlEncodeString(
+ JSON.stringify({ alg: "HS256", typ: "JWT" }),
+ );
+ const encodedPayload = base64urlEncodeString(JSON.stringify(payload));
+ const signingInput = `${encodedHeader}.${encodedPayload}`;
+
+ const key = await crypto.subtle.importKey(
+ "raw",
+ new TextEncoder().encode(secret),
+ { name: "HMAC", hash: "SHA-256" },
+ false,
+ ["sign"],
+ );
+
+ const signature = await crypto.subtle.sign(
+ "HMAC",
+ key,
+ new TextEncoder().encode(signingInput),
+ );
+
+ return `${signingInput}.${base64urlEncodeBuffer(signature)}`;
+}
+
+export async function verifyJWT(
+ token: string,
+ secret: string,
+): Promise {
+ const parts = token.split(".");
+ if (parts.length !== 3) return null;
+
+ const [encodedHeader, encodedPayload, encodedSignature] = parts;
+ const signingInput = `${encodedHeader}.${encodedPayload}`;
+
+ const key = await crypto.subtle.importKey(
+ "raw",
+ new TextEncoder().encode(secret),
+ { name: "HMAC", hash: "SHA-256" },
+ false,
+ ["verify"],
+ );
+
+ let valid: boolean;
+ try {
+ valid = await crypto.subtle.verify(
+ "HMAC",
+ key,
+ base64urlDecodeToBuffer(encodedSignature),
+ new TextEncoder().encode(signingInput),
+ );
+ } catch {
+ return null;
+ }
+
+ if (!valid) return null;
+
+ let header: { alg?: string; typ?: string };
+ try {
+ header = JSON.parse(base64urlDecodeToString(encodedHeader));
+ } catch {
+ return null;
+ }
+ if (header.alg !== "HS256") return null;
+
+ let payload: JWTPayload;
+ try {
+ payload = JSON.parse(base64urlDecodeToString(encodedPayload));
+ } catch {
+ return null;
+ }
+
+ if (typeof payload.exp === "number" && Date.now() / 1000 > payload.exp)
+ return null;
+
+ if (!payload.sub || !payload.jti || !payload.sid) return null;
+
+ return payload;
+}
+
+// ─── Misc ────────────────────────────────────────────────────────────────────
+
+export async function safeEqual(a: string, b: string): Promise {
+ const enc = new TextEncoder();
+ const [ha, hb] = await Promise.all([
+ crypto.subtle.digest("SHA-256", enc.encode(a)),
+ crypto.subtle.digest("SHA-256", enc.encode(b)),
+ ]);
+ const va = new Uint8Array(ha);
+ const vb = new Uint8Array(hb);
+ let diff = 0;
+ for (let i = 0; i < va.length; i++) diff |= va[i] ^ vb[i];
+ return diff === 0;
+}
+
+export function generateId(): string {
+ return crypto.randomUUID();
+}
+
+/** Random opaque string (session cookie / challenge values). */
+export function generateToken(bytes = 32): string {
+ const buf = crypto.getRandomValues(new Uint8Array(bytes));
+ return base64urlEncodeBuffer(buf.buffer as ArrayBuffer);
+}
+
+/** Hash used to look up session cookies without storing the raw token. */
+export async function sha256Hex(input: string): Promise {
+ const digest = await crypto.subtle.digest(
+ "SHA-256",
+ new TextEncoder().encode(input),
+ );
+ return bufToHex(digest);
+}
diff --git a/worker/src/core/challenges.ts b/worker/src/core/challenges.ts
new file mode 100644
index 0000000..1c2533b
--- /dev/null
+++ b/worker/src/core/challenges.ts
@@ -0,0 +1,88 @@
+import { nowIso } from "../db/sql";
+
+export interface ChallengeRecord {
+ id: string;
+ kind: string;
+ user_id: string | null;
+ value: string;
+ created_at: string;
+ expires_at: string;
+}
+
+/**
+ * Ephemeral single-use values (WebAuthn challenges, pending TOTP secrets,
+ * 2FA temp tokens). Stored in D1 (the project's single store — no KV as primary
+ * storage); expired rows are purged opportunistically.
+ */
+export async function putChallenge(
+ db: D1Database,
+ prefix: string,
+ data: {
+ id: string;
+ kind: string;
+ user_id?: string | null;
+ value: string;
+ ttlSeconds: number;
+ },
+): Promise {
+ const now = new Date();
+ const expires = new Date(
+ now.getTime() + data.ttlSeconds * 1000,
+ ).toISOString();
+ await db
+ .prepare(
+ `INSERT INTO ${prefix}challenges (id, kind, user_id, value, created_at, expires_at)
+ VALUES (?, ?, ?, ?, ?, ?)
+ ON CONFLICT(id) DO UPDATE SET value = excluded.value, expires_at = excluded.expires_at`,
+ )
+ .bind(
+ data.id,
+ data.kind,
+ data.user_id ?? null,
+ data.value,
+ nowIso(),
+ expires,
+ )
+ .run();
+ await purgeChallenges(db, prefix);
+}
+
+export async function getChallenge(
+ db: D1Database,
+ prefix: string,
+ id: string,
+ kind?: string,
+): Promise {
+ const row = await db
+ .prepare(`SELECT * FROM ${prefix}challenges WHERE id = ?`)
+ .bind(id)
+ .first();
+ if (!row) return null;
+ if (kind && row.kind !== kind) return null;
+ if (row.expires_at < nowIso()) {
+ await deleteChallenge(db, prefix, id);
+ return null;
+ }
+ return row;
+}
+
+export async function deleteChallenge(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ await db
+ .prepare(`DELETE FROM ${prefix}challenges WHERE id = ?`)
+ .bind(id)
+ .run();
+}
+
+export async function purgeChallenges(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ await db
+ .prepare(`DELETE FROM ${prefix}challenges WHERE expires_at < ?`)
+ .bind(nowIso())
+ .run();
+}
diff --git a/worker/src/core/login-attempts.ts b/worker/src/core/login-attempts.ts
new file mode 100644
index 0000000..66c0729
--- /dev/null
+++ b/worker/src/core/login-attempts.ts
@@ -0,0 +1,121 @@
+import { nowIso } from "../db/sql";
+
+export const MAX_FAILED_ATTEMPTS = 5;
+export const LOCKOUT_SECONDS = 15 * 60;
+export const ATTEMPT_WINDOW_SECONDS = 15 * 60;
+
+/**
+ * Login throttling + progressive lockout, D1-backed (single store, no KV).
+ * - rate limit: at most MAX_FAILED_ATTEMPTS failures per username+IP window
+ * - lockout: after MAX_FAILED_ATTEMPTS consecutive failures the account is
+ * locked for LOCKOUT_SECONDS (locked_until on the latest attempt row)
+ */
+export async function isLockedOut(
+ db: D1Database,
+ prefix: string,
+ username: string,
+ ip: string,
+): Promise {
+ const row = await db
+ .prepare(
+ `SELECT locked_until FROM ${prefix}login_attempts
+ WHERE username = ? COLLATE NOCASE AND locked_until IS NOT NULL AND locked_until > ?
+ ORDER BY created_at DESC LIMIT 1`,
+ )
+ .bind(username, nowIso())
+ .first<{ locked_until: string }>();
+ void ip;
+ return Boolean(row);
+}
+
+export async function countRecentFailures(
+ db: D1Database,
+ prefix: string,
+ username: string,
+ ip: string,
+): Promise {
+ const since = new Date(
+ Date.now() - ATTEMPT_WINDOW_SECONDS * 1000,
+ ).toISOString();
+ const row = await db
+ .prepare(
+ `SELECT COUNT(*) AS n FROM ${prefix}login_attempts
+ WHERE username = ? COLLATE NOCASE AND ip = ? AND success = 0 AND created_at > ?`,
+ )
+ .bind(username, ip, since)
+ .first<{ n: number }>();
+ return row?.n ?? 0;
+}
+
+export async function recordAttempt(
+ db: D1Database,
+ prefix: string,
+ data: {
+ id: string;
+ username: string;
+ ip: string;
+ success: boolean;
+ lockUntil?: string | null;
+ },
+): Promise {
+ await db
+ .prepare(
+ `INSERT INTO ${prefix}login_attempts (id, username, ip, success, created_at, locked_until)
+ VALUES (?, ?, ?, ?, ?, ?)`,
+ )
+ .bind(
+ data.id,
+ data.username,
+ data.ip,
+ data.success ? 1 : 0,
+ nowIso(),
+ data.lockUntil ?? null,
+ )
+ .run();
+}
+
+export async function clearFailures(
+ db: D1Database,
+ prefix: string,
+ username: string,
+): Promise {
+ await db
+ .prepare(
+ `DELETE FROM ${prefix}login_attempts WHERE username = ? COLLATE NOCASE AND success = 0`,
+ )
+ .bind(username)
+ .run();
+}
+
+export async function purgeOldAttempts(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ const cutoff = new Date(Date.now() - 24 * 3600 * 1000).toISOString();
+ await db
+ .prepare(`DELETE FROM ${prefix}login_attempts WHERE created_at < ?`)
+ .bind(cutoff)
+ .run();
+}
+
+/** Record a failure; returns the remaining attempts before lockout. */
+export async function recordFailure(
+ db: D1Database,
+ prefix: string,
+ data: { id: string; username: string; ip: string },
+): Promise<{ locked: boolean; remaining: number }> {
+ const fails =
+ (await countRecentFailures(db, prefix, data.username, data.ip)) + 1;
+ const locked = fails >= MAX_FAILED_ATTEMPTS;
+ const lockUntil = locked
+ ? new Date(Date.now() + LOCKOUT_SECONDS * 1000).toISOString()
+ : null;
+ await recordAttempt(db, prefix, {
+ id: data.id,
+ username: data.username,
+ ip: data.ip,
+ success: false,
+ lockUntil,
+ });
+ return { locked, remaining: Math.max(0, MAX_FAILED_ATTEMPTS - fails) };
+}
diff --git a/worker/src/core/totp.ts b/worker/src/core/totp.ts
new file mode 100644
index 0000000..62a8635
--- /dev/null
+++ b/worker/src/core/totp.ts
@@ -0,0 +1,98 @@
+// TOTP (RFC 6238) primitives — eNotify/Zeta scheme: SHA-1, 6 digits, 30s period.
+// Implemented on WebCrypto (the runtime-native primitive); the TOTP math is
+// standard-library-free everywhere in the Worker ecosystem.
+
+const BASE32_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+
+export function base32Encode(data: Uint8Array): string {
+ let result = "";
+ let bits = 0;
+ let value = 0;
+
+ for (const byte of data) {
+ value = (value << 8) | byte;
+ bits += 8;
+ while (bits >= 5) {
+ bits -= 5;
+ result += BASE32_CHARS[(value >>> bits) & 0x1f];
+ }
+ }
+
+ if (bits > 0) {
+ result += BASE32_CHARS[(value << (5 - bits)) & 0x1f];
+ }
+
+ return result;
+}
+
+function base32Decode(encoded: string): Uint8Array {
+ const cleaned = encoded.replace(/[=\s]/g, "").toUpperCase();
+ const bytes: number[] = [];
+ let bits = 0;
+ let value = 0;
+
+ for (const char of cleaned) {
+ const idx = BASE32_CHARS.indexOf(char);
+ if (idx === -1) continue;
+ value = (value << 5) | idx;
+ bits += 5;
+ if (bits >= 8) {
+ bits -= 8;
+ bytes.push((value >>> bits) & 0xff);
+ }
+ }
+
+ return new Uint8Array(bytes);
+}
+
+export function generateTOTPSecret(): { secret: string; uri: string } {
+ const bytes = new Uint8Array(20);
+ crypto.getRandomValues(bytes);
+ const secret = base32Encode(bytes);
+ const issuer = "nav";
+ const uri = `otpauth://totp/${issuer}?secret=${secret}&issuer=${issuer}&algorithm=SHA1&digits=6&period=30`;
+ return { secret, uri };
+}
+
+export async function generateTOTPCode(
+ secret: string,
+ counter: number,
+): Promise {
+ const key = base32Decode(secret);
+ const buffer = new ArrayBuffer(8);
+ const view = new DataView(buffer);
+ view.setBigUint64(0, BigInt(counter));
+
+ const cryptoKey = await crypto.subtle.importKey(
+ "raw",
+ key,
+ { name: "HMAC", hash: "SHA-1" },
+ false,
+ ["sign"],
+ );
+
+ const signature = await crypto.subtle.sign("HMAC", cryptoKey, buffer);
+ const hash = new Uint8Array(signature);
+
+ const offset = hash[hash.length - 1] & 0x0f;
+ const binary =
+ ((hash[offset] & 0x7f) << 24) |
+ ((hash[offset + 1] & 0xff) << 16) |
+ ((hash[offset + 2] & 0xff) << 8) |
+ (hash[offset + 3] & 0xff);
+
+ return (binary % 1000000).toString().padStart(6, "0");
+}
+
+/** Verify a TOTP code with ±1 step drift (same as eNotify). */
+export async function verifyTOTP(
+ secret: string,
+ code: string,
+): Promise {
+ const time = Math.floor(Date.now() / 1000 / 30);
+ for (let i = -1; i <= 1; i++) {
+ const expected = await generateTOTPCode(secret, time + i);
+ if (expected === code) return true;
+ }
+ return false;
+}
diff --git a/worker/src/db/queries/content.ts b/worker/src/db/queries/content.ts
new file mode 100644
index 0000000..68b3d77
--- /dev/null
+++ b/worker/src/db/queries/content.ts
@@ -0,0 +1,351 @@
+import type { Category, Link, SearchEngine } from "../../types";
+import { nowIso } from "../sql";
+
+const CATEGORY_COLUMNS = ["name", "icon", "sort_order", "visibility"] as const;
+const LINK_COLUMNS = [
+ "category_id",
+ "title",
+ "url",
+ "icon_url",
+ "description",
+ "sort_order",
+ "visibility",
+] as const;
+const ENGINE_COLUMNS = [
+ "name",
+ "url_template",
+ "icon",
+ "sort_order",
+ "is_default",
+] as const;
+
+function assertColumns(
+ table: string,
+ data: Record,
+ allowed: readonly string[],
+): void {
+ for (const key of Object.keys(data)) {
+ if (!allowed.includes(key))
+ throw new Error(`invalid column ${key} for ${table}`);
+ }
+}
+
+// ─── Categories ──────────────────────────────────────────────────────────────
+
+export async function listCategories(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ const result = await db
+ .prepare(
+ `SELECT * FROM ${prefix}categories ORDER BY sort_order, created_at`,
+ )
+ .all();
+ return result.results;
+}
+
+export async function findCategory(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ return db
+ .prepare(`SELECT * FROM ${prefix}categories WHERE id = ?`)
+ .bind(id)
+ .first();
+}
+
+export async function insertCategory(
+ db: D1Database,
+ prefix: string,
+ data: {
+ id: string;
+ name: string;
+ icon: string | null;
+ sort_order: number;
+ visibility: string;
+ },
+): Promise {
+ const now = nowIso();
+ await db
+ .prepare(
+ `INSERT INTO ${prefix}categories (id, name, icon, sort_order, visibility, created_at, updated_at)
+ VALUES (?, ?, ?, ?, ?, ?, ?)`,
+ )
+ .bind(
+ data.id,
+ data.name,
+ data.icon,
+ data.sort_order,
+ data.visibility,
+ now,
+ now,
+ )
+ .run();
+}
+
+export async function updateCategory(
+ db: D1Database,
+ prefix: string,
+ id: string,
+ data: Partial<{
+ name: string;
+ icon: string | null;
+ sort_order: number;
+ visibility: string;
+ }>,
+): Promise {
+ assertColumns(
+ "updateCategory",
+ data as Record,
+ CATEGORY_COLUMNS,
+ );
+ const fields = Object.keys(data);
+ if (fields.length === 0) return;
+ const sets = fields.map((f) => `${f} = ?`);
+ sets.push("updated_at = ?");
+ const values = [
+ ...fields.map((f) => (data as Record)[f]),
+ nowIso(),
+ id,
+ ];
+ await db
+ .prepare(`UPDATE ${prefix}categories SET ${sets.join(", ")} WHERE id = ?`)
+ .bind(...values)
+ .run();
+}
+
+export async function deleteCategory(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ await db
+ .prepare(`DELETE FROM ${prefix}categories WHERE id = ?`)
+ .bind(id)
+ .run();
+}
+
+// ─── Links ───────────────────────────────────────────────────────────────────
+
+export async function listLinks(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ const result = await db
+ .prepare(`SELECT * FROM ${prefix}links ORDER BY sort_order, created_at`)
+ .all();
+ return result.results;
+}
+
+export async function findLink(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ return db
+ .prepare(`SELECT * FROM ${prefix}links WHERE id = ?`)
+ .bind(id)
+ .first();
+}
+
+export async function insertLink(
+ db: D1Database,
+ prefix: string,
+ data: {
+ id: string;
+ category_id: string;
+ title: string;
+ url: string;
+ icon_url: string | null;
+ description: string | null;
+ sort_order: number;
+ visibility: string;
+ },
+): Promise {
+ const now = nowIso();
+ await db
+ .prepare(
+ `INSERT INTO ${prefix}links (id, category_id, title, url, icon_url, description, sort_order, visibility, created_at, updated_at)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
+ )
+ .bind(
+ data.id,
+ data.category_id,
+ data.title,
+ data.url,
+ data.icon_url,
+ data.description,
+ data.sort_order,
+ data.visibility,
+ now,
+ now,
+ )
+ .run();
+}
+
+export async function updateLink(
+ db: D1Database,
+ prefix: string,
+ id: string,
+ data: Partial<{
+ category_id: string;
+ title: string;
+ url: string;
+ icon_url: string | null;
+ description: string | null;
+ sort_order: number;
+ visibility: string;
+ }>,
+): Promise {
+ assertColumns("updateLink", data as Record, LINK_COLUMNS);
+ const fields = Object.keys(data);
+ if (fields.length === 0) return;
+ const sets = fields.map((f) => `${f} = ?`);
+ sets.push("updated_at = ?");
+ const values = [
+ ...fields.map((f) => (data as Record)[f]),
+ nowIso(),
+ id,
+ ];
+ await db
+ .prepare(`UPDATE ${prefix}links SET ${sets.join(", ")} WHERE id = ?`)
+ .bind(...values)
+ .run();
+}
+
+export async function deleteLink(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ await db.prepare(`DELETE FROM ${prefix}links WHERE id = ?`).bind(id).run();
+}
+
+/**
+ * SQLite/D1 does not enforce FK constraints by default, so deleting a category
+ * must remove its links explicitly (no orphans).
+ */
+export async function deleteLinksByCategory(
+ db: D1Database,
+ prefix: string,
+ categoryId: string,
+): Promise {
+ await db
+ .prepare(`DELETE FROM ${prefix}links WHERE category_id = ?`)
+ .bind(categoryId)
+ .run();
+}
+
+// ─── Search engines ──────────────────────────────────────────────────────────
+
+export async function listSearchEngines(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ const result = await db
+ .prepare(
+ `SELECT * FROM ${prefix}search_engines ORDER BY sort_order, created_at`,
+ )
+ .all();
+ return result.results;
+}
+
+export async function findSearchEngine(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ return db
+ .prepare(`SELECT * FROM ${prefix}search_engines WHERE id = ?`)
+ .bind(id)
+ .first();
+}
+
+export async function insertSearchEngine(
+ db: D1Database,
+ prefix: string,
+ data: {
+ id: string;
+ name: string;
+ url_template: string;
+ icon: string | null;
+ sort_order: number;
+ is_default: number;
+ },
+): Promise {
+ const now = nowIso();
+ await db
+ .prepare(
+ `INSERT INTO ${prefix}search_engines (id, name, url_template, icon, sort_order, is_default, created_at, updated_at)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
+ )
+ .bind(
+ data.id,
+ data.name,
+ data.url_template,
+ data.icon,
+ data.sort_order,
+ data.is_default,
+ now,
+ now,
+ )
+ .run();
+}
+
+export async function updateSearchEngine(
+ db: D1Database,
+ prefix: string,
+ id: string,
+ data: Partial<{
+ name: string;
+ url_template: string;
+ icon: string | null;
+ sort_order: number;
+ is_default: number;
+ }>,
+): Promise {
+ assertColumns(
+ "updateSearchEngine",
+ data as Record,
+ ENGINE_COLUMNS,
+ );
+ const fields = Object.keys(data);
+ if (fields.length === 0) return;
+ const sets = fields.map((f) => `${f} = ?`);
+ sets.push("updated_at = ?");
+ const values = [
+ ...fields.map((f) => (data as Record)[f]),
+ nowIso(),
+ id,
+ ];
+ await db
+ .prepare(
+ `UPDATE ${prefix}search_engines SET ${sets.join(", ")} WHERE id = ?`,
+ )
+ .bind(...values)
+ .run();
+}
+
+export async function deleteSearchEngine(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ await db
+ .prepare(`DELETE FROM ${prefix}search_engines WHERE id = ?`)
+ .bind(id)
+ .run();
+}
+
+export async function clearDefaultSearchEngines(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ await db
+ .prepare(
+ `UPDATE ${prefix}search_engines SET is_default = 0, updated_at = ?`,
+ )
+ .bind(nowIso())
+ .run();
+}
diff --git a/worker/src/db/queries/settings.ts b/worker/src/db/queries/settings.ts
new file mode 100644
index 0000000..2ca8314
--- /dev/null
+++ b/worker/src/db/queries/settings.ts
@@ -0,0 +1,39 @@
+import type { Setting } from "../../types";
+import { nowIso } from "../sql";
+
+export async function getSetting(
+ db: D1Database,
+ prefix: string,
+ key: string,
+): Promise {
+ const row = await db
+ .prepare(`SELECT value FROM ${prefix}settings WHERE key = ?`)
+ .bind(key)
+ .first<{ value: string }>();
+ return row?.value ?? null;
+}
+
+export async function setSetting(
+ db: D1Database,
+ prefix: string,
+ key: string,
+ value: string,
+): Promise {
+ await db
+ .prepare(
+ `INSERT INTO ${prefix}settings (key, value, updated_at) VALUES (?, ?, ?)
+ ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at`,
+ )
+ .bind(key, value, nowIso())
+ .run();
+}
+
+export async function getAllSettings(
+ db: D1Database,
+ prefix: string,
+): Promise> {
+ const result = await db
+ .prepare(`SELECT key, value FROM ${prefix}settings`)
+ .all>();
+ return Object.fromEntries(result.results.map((r) => [r.key, r.value]));
+}
diff --git a/worker/src/db/queries/users.ts b/worker/src/db/queries/users.ts
new file mode 100644
index 0000000..9d02a09
--- /dev/null
+++ b/worker/src/db/queries/users.ts
@@ -0,0 +1,203 @@
+import type { PasskeyCredential, Session, User } from "../../types";
+import { nowIso } from "../sql";
+
+export async function countUsers(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ const row = await db
+ .prepare(`SELECT COUNT(*) AS n FROM ${prefix}users`)
+ .first<{ n: number }>();
+ return row?.n ?? 0;
+}
+
+export async function findUserByUsername(
+ db: D1Database,
+ prefix: string,
+ username: string,
+): Promise {
+ return db
+ .prepare(`SELECT * FROM ${prefix}users WHERE username = ? COLLATE NOCASE`)
+ .bind(username.trim())
+ .first();
+}
+
+export async function findUserById(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ return db
+ .prepare(`SELECT * FROM ${prefix}users WHERE id = ?`)
+ .bind(id)
+ .first();
+}
+
+/**
+ * Single-statement insert so "the only owner account" cannot race: the INSERT
+ * only succeeds while the users table is empty.
+ */
+export async function createOwner(
+ db: D1Database,
+ prefix: string,
+ data: { id: string; username: string; password_hash: string },
+): Promise {
+ const now = nowIso();
+ await db
+ .prepare(
+ `INSERT INTO ${prefix}users (id, username, password_hash, is_active, created_at, updated_at)
+ SELECT ?, ?, ?, 1, ?, ? WHERE (SELECT COUNT(*) FROM ${prefix}users) = 0`,
+ )
+ .bind(data.id, data.username, data.password_hash, now, now)
+ .run();
+}
+
+export async function updatePasswordHash(
+ db: D1Database,
+ prefix: string,
+ userId: string,
+ passwordHash: string,
+): Promise {
+ await db
+ .prepare(
+ `UPDATE ${prefix}users SET password_hash = ?, updated_at = ? WHERE id = ?`,
+ )
+ .bind(passwordHash, nowIso(), userId)
+ .run();
+}
+
+// ─── Passkey credentials ─────────────────────────────────────────────────────
+
+export async function listPasskeys(
+ db: D1Database,
+ prefix: string,
+ userId: string,
+): Promise {
+ const result = await db
+ .prepare(`SELECT * FROM ${prefix}passkey_credentials WHERE user_id = ?`)
+ .bind(userId)
+ .all();
+ return result.results;
+}
+
+export async function findPasskey(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ return db
+ .prepare(`SELECT * FROM ${prefix}passkey_credentials WHERE id = ?`)
+ .bind(id)
+ .first();
+}
+
+export async function insertPasskey(
+ db: D1Database,
+ prefix: string,
+ data: { id: string; user_id: string; public_key: string; counter: number },
+): Promise {
+ const now = nowIso();
+ await db
+ .prepare(
+ `INSERT INTO ${prefix}passkey_credentials (id, user_id, public_key, counter, created_at, updated_at)
+ VALUES (?, ?, ?, ?, ?, ?)`,
+ )
+ .bind(data.id, data.user_id, data.public_key, data.counter, now, now)
+ .run();
+}
+
+export async function updatePasskeyCounter(
+ db: D1Database,
+ prefix: string,
+ id: string,
+ counter: number,
+): Promise {
+ await db
+ .prepare(
+ `UPDATE ${prefix}passkey_credentials SET counter = ?, updated_at = ? WHERE id = ?`,
+ )
+ .bind(counter, nowIso(), id)
+ .run();
+}
+
+export async function deletePasskeys(
+ db: D1Database,
+ prefix: string,
+ userId: string,
+): Promise {
+ await db
+ .prepare(`DELETE FROM ${prefix}passkey_credentials WHERE user_id = ?`)
+ .bind(userId)
+ .run();
+}
+
+// ─── Sessions ────────────────────────────────────────────────────────────────
+
+export async function insertSession(
+ db: D1Database,
+ prefix: string,
+ data: {
+ id: string;
+ user_id: string;
+ expires_at: string;
+ ip: string | null;
+ user_agent: string | null;
+ },
+): Promise {
+ const now = nowIso();
+ await db
+ .prepare(
+ `INSERT INTO ${prefix}sessions (id, user_id, created_at, expires_at, last_seen_at, ip, user_agent)
+ VALUES (?, ?, ?, ?, ?, ?, ?)`,
+ )
+ .bind(
+ data.id,
+ data.user_id,
+ now,
+ data.expires_at,
+ now,
+ data.ip,
+ data.user_agent,
+ )
+ .run();
+}
+
+export async function findSession(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ return db
+ .prepare(`SELECT * FROM ${prefix}sessions WHERE id = ?`)
+ .bind(id)
+ .first();
+}
+
+export async function touchSession(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ await db
+ .prepare(`UPDATE ${prefix}sessions SET last_seen_at = ? WHERE id = ?`)
+ .bind(nowIso(), id)
+ .run();
+}
+
+export async function deleteSession(
+ db: D1Database,
+ prefix: string,
+ id: string,
+): Promise {
+ await db.prepare(`DELETE FROM ${prefix}sessions WHERE id = ?`).bind(id).run();
+}
+
+export async function deleteExpiredSessions(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ await db
+ .prepare(`DELETE FROM ${prefix}sessions WHERE expires_at < ?`)
+ .bind(nowIso())
+ .run();
+}
diff --git a/worker/src/db/schema.sql b/worker/src/db/schema.sql
new file mode 100644
index 0000000..cf70403
--- /dev/null
+++ b/worker/src/db/schema.sql
@@ -0,0 +1,113 @@
+-- nav database schema
+-- All table names use {prefix} placeholder, replaced at runtime.
+-- Idempotent: every statement is IF NOT EXISTS / OR IGNORE so the migration
+-- can be re-run safely on an empty or already-initialized database.
+
+CREATE TABLE IF NOT EXISTS {prefix}users (
+ id TEXT PRIMARY KEY,
+ username TEXT UNIQUE NOT NULL,
+ password_hash TEXT NOT NULL,
+ is_active INTEGER NOT NULL DEFAULT 1,
+ created_at TEXT NOT NULL,
+ updated_at TEXT NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS {prefix}passkey_credentials (
+ id TEXT PRIMARY KEY,
+ user_id TEXT NOT NULL REFERENCES {prefix}users(id) ON DELETE CASCADE,
+ public_key TEXT NOT NULL,
+ counter INTEGER NOT NULL DEFAULT 0,
+ created_at TEXT NOT NULL,
+ updated_at TEXT NOT NULL
+);
+
+CREATE INDEX IF NOT EXISTS idx_{prefix}passkey_credentials_user_id
+ ON {prefix}passkey_credentials(user_id);
+
+CREATE TABLE IF NOT EXISTS {prefix}sessions (
+ id TEXT PRIMARY KEY,
+ user_id TEXT NOT NULL REFERENCES {prefix}users(id) ON DELETE CASCADE,
+ created_at TEXT NOT NULL,
+ expires_at TEXT NOT NULL,
+ last_seen_at TEXT NOT NULL,
+ ip TEXT,
+ user_agent TEXT
+);
+
+CREATE INDEX IF NOT EXISTS idx_{prefix}sessions_user_id
+ ON {prefix}sessions(user_id);
+
+CREATE TABLE IF NOT EXISTS {prefix}login_attempts (
+ id TEXT PRIMARY KEY,
+ username TEXT NOT NULL,
+ ip TEXT NOT NULL,
+ success INTEGER NOT NULL DEFAULT 0,
+ created_at TEXT NOT NULL,
+ locked_until TEXT
+);
+
+CREATE INDEX IF NOT EXISTS idx_{prefix}login_attempts_created_at
+ ON {prefix}login_attempts(created_at);
+
+CREATE TABLE IF NOT EXISTS {prefix}challenges (
+ id TEXT PRIMARY KEY,
+ kind TEXT NOT NULL,
+ user_id TEXT,
+ value TEXT NOT NULL,
+ created_at TEXT NOT NULL,
+ expires_at TEXT NOT NULL
+);
+
+CREATE INDEX IF NOT EXISTS idx_{prefix}challenges_expires_at
+ ON {prefix}challenges(expires_at);
+
+CREATE TABLE IF NOT EXISTS {prefix}categories (
+ id TEXT PRIMARY KEY,
+ name TEXT NOT NULL,
+ icon TEXT,
+ sort_order INTEGER NOT NULL DEFAULT 0,
+ visibility TEXT NOT NULL DEFAULT 'public' CHECK (visibility IN ('public', 'private')),
+ created_at TEXT NOT NULL,
+ updated_at TEXT NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS {prefix}links (
+ id TEXT PRIMARY KEY,
+ category_id TEXT NOT NULL REFERENCES {prefix}categories(id) ON DELETE CASCADE,
+ title TEXT NOT NULL,
+ url TEXT NOT NULL,
+ icon_url TEXT,
+ description TEXT,
+ sort_order INTEGER NOT NULL DEFAULT 0,
+ visibility TEXT NOT NULL DEFAULT 'public' CHECK (visibility IN ('public', 'private')),
+ -- Reserved per SPEC §5, not implemented in v1: click counting and
+ -- private-service health status.
+ click_count INTEGER NOT NULL DEFAULT 0,
+ status TEXT,
+ last_checked_at TEXT,
+ created_at TEXT NOT NULL,
+ updated_at TEXT NOT NULL
+);
+
+CREATE INDEX IF NOT EXISTS idx_{prefix}links_category_id
+ ON {prefix}links(category_id);
+
+CREATE TABLE IF NOT EXISTS {prefix}search_engines (
+ id TEXT PRIMARY KEY,
+ name TEXT NOT NULL,
+ url_template TEXT NOT NULL,
+ icon TEXT,
+ sort_order INTEGER NOT NULL DEFAULT 0,
+ is_default INTEGER NOT NULL DEFAULT 0,
+ created_at TEXT NOT NULL,
+ updated_at TEXT NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS {prefix}settings (
+ key TEXT PRIMARY KEY,
+ value TEXT NOT NULL,
+ updated_at TEXT NOT NULL
+);
+
+INSERT OR IGNORE INTO {prefix}settings (key, value, updated_at)
+VALUES ('setup_completed', '0', strftime('%Y-%m-%dT%H:%M:%fZ', 'now'));
diff --git a/worker/src/db/sql.ts b/worker/src/db/sql.ts
new file mode 100644
index 0000000..395e740
--- /dev/null
+++ b/worker/src/db/sql.ts
@@ -0,0 +1,18 @@
+// Shared SQL helpers.
+
+export function splitStatements(sql: string): string[] {
+ return sql
+ .split(";")
+ .map((s) => s.trim())
+ .filter((s) => s.length > 0);
+}
+
+export async function runScript(db: D1Database, sql: string): Promise {
+ for (const stmt of splitStatements(sql)) {
+ await db.prepare(stmt).run();
+ }
+}
+
+export function nowIso(): string {
+ return new Date().toISOString();
+}
diff --git a/worker/src/env.d.ts b/worker/src/env.d.ts
new file mode 100644
index 0000000..cab6e86
--- /dev/null
+++ b/worker/src/env.d.ts
@@ -0,0 +1 @@
+declare const APP_VERSION: string | undefined;
diff --git a/worker/src/index.ts b/worker/src/index.ts
new file mode 100644
index 0000000..b070395
--- /dev/null
+++ b/worker/src/index.ts
@@ -0,0 +1,97 @@
+import { Hono } from "hono";
+import type { Env, HonoEnv } from "./types";
+import { getTablePrefix } from "./types";
+import { authRoutes } from "./routes/auth";
+import { webauthnRoutes } from "./routes/passkey";
+import { publicRoutes } from "./routes/public";
+import { privateRoutes } from "./routes/private";
+import { adminRoutes } from "./routes/admin";
+import { getSetting } from "./db/queries/settings";
+import { countUsers, deleteExpiredSessions } from "./db/queries/users";
+
+const app = new Hono();
+
+app.onError((err, c) => {
+ console.error("Unhandled error:", err);
+ if (err instanceof SyntaxError) {
+ return c.json({ error: "invalid request body" }, 400);
+ }
+ return c.json({ error: "internal server error" }, 500);
+});
+
+// Config guard: the session secret must be a real secret before any authed API.
+app.use("/api/*", async (c, next) => {
+ const secret = c.env.SESSION_SECRET;
+ if (!secret || secret.length < 16 || secret.endsWith("_PLACEHOLDER")) {
+ console.error(
+ "SESSION_SECRET is missing, too short, or still a placeholder",
+ );
+ return c.json({ error: "server misconfigured" }, 500);
+ }
+ await next();
+});
+
+app.use("*", async (c, next) => {
+ const prefix = c.env.TABLE_PREFIX || "";
+ if (prefix && !/^[a-zA-Z0-9_]+$/.test(prefix)) {
+ return c.json({ error: "invalid TABLE_PREFIX configuration" }, 500);
+ }
+ await next();
+});
+
+app.route("/api/auth", authRoutes);
+app.route("/api/auth/passkey", webauthnRoutes);
+app.route("/api/public", publicRoutes);
+app.route("/api/private", privateRoutes);
+app.route("/api/admin", adminRoutes);
+
+app.get("/api/health", (c) =>
+ c.json({ status: "ok", timestamp: new Date().toISOString() }),
+);
+
+/**
+ * GET /api/setup/status — the one endpoint the SPA calls before rendering.
+ * 200 { enabled: true } while the owner account does not exist yet.
+ */
+app.get("/api/setup/status", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ try {
+ const users = await countUsers(c.env.DB, prefix);
+ return c.json({ enabled: users === 0 });
+ } catch {
+ // Uninitialized DB: setup is open (migration runs on first setup call).
+ return c.json({ enabled: true });
+ }
+});
+
+app.get("/api/system/info", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ try {
+ const settings = await getSetting(c.env.DB, prefix, "site_title");
+ return c.json({
+ app_name: settings ?? "nav",
+ version: typeof APP_VERSION !== "undefined" ? APP_VERSION : "0.0.0",
+ });
+ } catch {
+ return c.json({
+ app_name: "nav",
+ version: typeof APP_VERSION !== "undefined" ? APP_VERSION : "0.0.0",
+ });
+ }
+});
+
+// Static assets (Workers Static Assets binding), SPA fallback to index.html.
+app.get("*", async (c) => {
+ const res = await c.env.ASSETS.fetch(c.req.raw);
+ if (res.status !== 404) return res;
+ return c.env.ASSETS.fetch(new Request(new URL("/", c.req.url), c.req.raw));
+});
+
+export default {
+ fetch: app.fetch,
+ async scheduled(_event: ScheduledEvent, env: Env, ctx: ExecutionContext) {
+ // Opportunistic cleanup of expired sessions (no cron config required).
+ const prefix = getTablePrefix(env);
+ ctx.waitUntil(deleteExpiredSessions(env.DB, prefix));
+ },
+};
diff --git a/worker/src/lib/migrate.ts b/worker/src/lib/migrate.ts
new file mode 100644
index 0000000..0122d2c
--- /dev/null
+++ b/worker/src/lib/migrate.ts
@@ -0,0 +1,34 @@
+import { getTablePrefix, type Env } from "../types";
+import { countUsers } from "../db/queries/users";
+
+// Per-isolate flag: after the first successful run in this Worker isolate the
+// schema is guaranteed to exist for the isolate's lifetime, so read paths skip
+// the DDL replay entirely (D1 tables persist across requests).
+let schemaReady = false;
+import { runScript } from "../db/sql";
+// Schema source of truth: src/db/schema.sql. It is loaded through a generated
+// module so both the Worker build and the test runner can import it plainly.
+import { SCHEMA_SQL } from "../db/schema.generated";
+
+/**
+ * Applies the D1 schema. Idempotent by construction: every statement in
+ * schema.sql uses IF NOT EXISTS / OR IGNORE, so re-running on an empty or an
+ * already-initialized database succeeds (acceptance: "空库迁移可重复执行成功").
+ */
+export async function runMigrations(env: Env): Promise<{ applied: boolean }> {
+ const prefix = getTablePrefix(env);
+ const resolved = SCHEMA_SQL.replace(/\{prefix\}/g, prefix);
+ await runScript(env.DB, resolved);
+ schemaReady = true;
+ return { applied: true };
+}
+
+/**
+ * Read-surface guard: ensures the schema exists at most once per isolate.
+ * Runs the idempotent DDL on first request, then only a cheap COUNT probe.
+ */
+export async function ensureSchema(env: Env): Promise {
+ if (schemaReady) return;
+ await runMigrations(env);
+ await countUsers(env.DB, getTablePrefix(env));
+}
diff --git a/worker/src/middleware/auth.ts b/worker/src/middleware/auth.ts
new file mode 100644
index 0000000..cf6b473
--- /dev/null
+++ b/worker/src/middleware/auth.ts
@@ -0,0 +1,43 @@
+import type { Context, Next } from "hono";
+import { getCookie } from "hono/cookie";
+import { getTablePrefix, type HonoEnv } from "../types";
+import { verifyJWT } from "../core/auth";
+import { findSession, findUserById } from "../db/queries/users";
+import { nowIso } from "../db/sql";
+
+export const SESSION_COOKIE = "nav_session";
+const SESSION_TTL_SECONDS = 7 * 24 * 3600;
+
+export function sessionMaxAge(): number {
+ return SESSION_TTL_SECONDS;
+}
+
+/** 401 JSON helper shared by the private API surface. */
+export function unauthorized(): Response {
+ return new Response(JSON.stringify({ error: "unauthorized" }), {
+ status: 401,
+ headers: {
+ "content-type": "application/json; charset=UTF-8",
+ "cache-control": "no-store",
+ },
+ });
+}
+
+export async function authMiddleware(c: Context, next: Next) {
+ const token = getCookie(c, SESSION_COOKIE);
+ if (!token) return unauthorized();
+
+ const payload = await verifyJWT(token, c.env.SESSION_SECRET);
+ if (!payload) return unauthorized();
+
+ const prefix = getTablePrefix(c.env);
+ const session = await findSession(c.env.DB, prefix, payload.sid);
+ if (!session || session.expires_at < nowIso()) return unauthorized();
+ if (session.user_id !== payload.sub) return unauthorized();
+
+ const user = await findUserById(c.env.DB, prefix, session.user_id);
+ if (!user?.is_active) return unauthorized();
+
+ c.set("userId", user.id);
+ await next();
+}
diff --git a/worker/src/middleware/setup-guard.ts b/worker/src/middleware/setup-guard.ts
new file mode 100644
index 0000000..c2be95d
--- /dev/null
+++ b/worker/src/middleware/setup-guard.ts
@@ -0,0 +1,37 @@
+import type { Context, Next } from "hono";
+import { getTablePrefix, type HonoEnv } from "../types";
+import { getSetting } from "../db/queries/settings";
+import { countUsers } from "../db/queries/users";
+import { nowIso } from "../db/sql";
+import { unauthorized } from "./auth";
+
+/**
+ * Setup is open while no owner account exists AND the setup token is presented.
+ * Once the owner exists, setup is permanently closed.
+ */
+export async function setupGuard(c: Context, next: Next) {
+ const prefix = getTablePrefix(c.env);
+ const users = await countUsers(c.env.DB, prefix);
+ if (users > 0) {
+ return c.json({ error: "setup already completed" }, 403);
+ }
+ await next();
+}
+
+export async function setupCompleted(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ const value = await getSetting(db, prefix, "setup_completed");
+ return value === "1";
+}
+
+export async function markSetupCompleted(
+ db: D1Database,
+ prefix: string,
+): Promise {
+ const { setSetting } = await import("../db/queries/settings");
+ await setSetting(db, prefix, "setup_completed", "1");
+}
+
+export { unauthorized, nowIso };
diff --git a/worker/src/routes/admin.ts b/worker/src/routes/admin.ts
new file mode 100644
index 0000000..03f7092
--- /dev/null
+++ b/worker/src/routes/admin.ts
@@ -0,0 +1,448 @@
+import { Hono } from "hono";
+import {
+ getTablePrefix,
+ isVisibility,
+ type HonoEnv,
+ type SiteSettingsDto,
+} from "../types";
+import { authMiddleware } from "../middleware/auth";
+import {
+ clearDefaultSearchEngines,
+ deleteCategory,
+ deleteLinksByCategory,
+ deleteLink,
+ deleteSearchEngine,
+ findCategory,
+ findLink,
+ findSearchEngine,
+ insertCategory,
+ insertLink,
+ insertSearchEngine,
+ listCategories,
+ listLinks,
+ listSearchEngines,
+ updateCategory,
+ updateLink,
+ updateSearchEngine,
+} from "../db/queries/content";
+import { getAllSettings, setSetting } from "../db/queries/settings";
+import { generateId } from "../core/auth";
+import type { Link } from "../types";
+import { toSearchEngineDto, toSiteSettingsDto } from "../services/site-data";
+
+export const adminRoutes = new Hono();
+
+// Contract ONE-168: all /api/admin/* writes require a session; 401 JSON otherwise.
+adminRoutes.use("*", authMiddleware);
+
+function badRequest(message: string): Response {
+ return new Response(JSON.stringify({ error: message }), {
+ status: 400,
+ headers: { "content-type": "application/json; charset=UTF-8" },
+ });
+}
+
+type Visibility = "public" | "private";
+
+function readVisibility(value: unknown): Visibility | undefined {
+ if (value === undefined) return undefined;
+ return isVisibility(value) ? value : undefined;
+}
+
+function parseSortOrder(value: unknown, fallback: number): number {
+ const n =
+ typeof value === "number"
+ ? value
+ : Number.parseInt(String(value ?? ""), 10);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+// ─── Categories ──────────────────────────────────────────────────────────────
+
+adminRoutes.get("/categories", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const categories = await listCategories(c.env.DB, prefix);
+ return c.json({
+ categories: categories.map((cat) => ({
+ id: cat.id,
+ name: cat.name,
+ icon: cat.icon,
+ sortOrder: cat.sort_order,
+ visibility: cat.visibility,
+ createdAt: cat.created_at,
+ updatedAt: cat.updated_at,
+ })),
+ });
+});
+
+adminRoutes.post("/categories", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req
+ .json<{
+ name?: unknown;
+ icon?: unknown;
+ sortOrder?: unknown;
+ visibility?: unknown;
+ }>()
+ .catch(
+ (): {
+ name?: unknown;
+ icon?: unknown;
+ sortOrder?: unknown;
+ visibility?: unknown;
+ } => ({}),
+ );
+
+ const name = typeof body.name === "string" ? body.name.trim() : "";
+ if (!name) return badRequest("name is required");
+ const visibility = readVisibility(body.visibility) ?? "public";
+ if (body.visibility !== undefined && !isVisibility(body.visibility))
+ return badRequest("visibility must be 'public' or 'private'");
+
+ const id = generateId();
+ await insertCategory(c.env.DB, prefix, {
+ id,
+ name,
+ icon: typeof body.icon === "string" ? body.icon : null,
+ sort_order: parseSortOrder(body.sortOrder, 0),
+ visibility,
+ });
+
+ return c.json(
+ {
+ id,
+ name,
+ icon: typeof body.icon === "string" ? body.icon : null,
+ sortOrder: parseSortOrder(body.sortOrder, 0),
+ visibility,
+ },
+ 201,
+ );
+});
+
+adminRoutes.put("/categories/:id", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const id = c.req.param("id");
+ const existing = await findCategory(c.env.DB, prefix, id);
+ if (!existing) return c.json({ error: "not found" }, 404);
+
+ const body = await c.req.json().catch(() => ({}));
+ const data: Record = {};
+ if (body.name !== undefined) {
+ const name = typeof body.name === "string" ? body.name.trim() : "";
+ if (!name) return badRequest("name must not be empty");
+ data.name = name;
+ }
+ if (body.icon !== undefined)
+ data.icon = typeof body.icon === "string" ? body.icon : null;
+ if (body.sortOrder !== undefined)
+ data.sort_order = parseSortOrder(body.sortOrder, existing.sort_order);
+ if (body.visibility !== undefined) {
+ if (!isVisibility(body.visibility))
+ return badRequest("visibility must be 'public' or 'private'");
+ data.visibility = body.visibility;
+ }
+
+ await updateCategory(c.env.DB, prefix, id, data);
+ const updated = await findCategory(c.env.DB, prefix, id);
+ return c.json({
+ id: updated?.id,
+ name: updated?.name,
+ icon: updated?.icon,
+ sortOrder: updated?.sort_order,
+ visibility: updated?.visibility,
+ });
+});
+
+adminRoutes.delete("/categories/:id", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const id = c.req.param("id");
+ const existing = await findCategory(c.env.DB, prefix, id);
+ if (!existing) return c.json({ error: "not found" }, 404);
+ await deleteLinksByCategory(c.env.DB, prefix, id);
+ await deleteCategory(c.env.DB, prefix, id);
+ return c.json({ success: true });
+});
+
+// ─── Links ───────────────────────────────────────────────────────────────────
+
+/** Admin link DTO: full row incl. visibility + timestamps (contract: docs/api-contract.md). */
+function adminLinkDto(link: Link) {
+ return {
+ id: link.id,
+ categoryId: link.category_id,
+ title: link.title,
+ url: link.url,
+ iconUrl: link.icon_url,
+ description: link.description,
+ sortOrder: link.sort_order,
+ visibility: link.visibility,
+ createdAt: link.created_at,
+ updatedAt: link.updated_at,
+ };
+}
+
+adminRoutes.get("/links", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const links = await listLinks(c.env.DB, prefix);
+ return c.json({ links: links.map(adminLinkDto) });
+});
+
+adminRoutes.post("/links", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req.json().catch(() => ({}));
+
+ const title = typeof body.title === "string" ? body.title.trim() : "";
+ const url = typeof body.url === "string" ? body.url.trim() : "";
+ const categoryId = typeof body.categoryId === "string" ? body.categoryId : "";
+ if (!title) return badRequest("title is required");
+ if (!url) return badRequest("url is required");
+ if (!categoryId) return badRequest("categoryId is required");
+
+ const category = await findCategory(c.env.DB, prefix, categoryId);
+ if (!category) return badRequest("categoryId does not exist");
+ if (body.visibility !== undefined && !isVisibility(body.visibility))
+ return badRequest("visibility must be 'public' or 'private'");
+
+ const id = generateId();
+ const visibility = readVisibility(body.visibility) ?? "public";
+ await insertLink(c.env.DB, prefix, {
+ id,
+ category_id: categoryId,
+ title,
+ url,
+ icon_url:
+ typeof body.iconUrl === "string" && body.iconUrl ? body.iconUrl : null,
+ description: typeof body.description === "string" ? body.description : null,
+ sort_order: parseSortOrder(body.sortOrder, 0),
+ visibility,
+ });
+
+ return c.json({ id }, 201);
+});
+
+adminRoutes.put("/links/:id", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const id = c.req.param("id");
+ const existing = await findLink(c.env.DB, prefix, id);
+ if (!existing) return c.json({ error: "not found" }, 404);
+
+ const body = await c.req.json().catch(() => ({}));
+ const data: Record = {};
+
+ if (body.title !== undefined) {
+ const title = typeof body.title === "string" ? body.title.trim() : "";
+ if (!title) return badRequest("title must not be empty");
+ data.title = title;
+ }
+ if (body.url !== undefined) {
+ const url = typeof body.url === "string" ? body.url.trim() : "";
+ if (!url) return badRequest("url must not be empty");
+ data.url = url;
+ }
+ if (body.categoryId !== undefined) {
+ const category = await findCategory(
+ c.env.DB,
+ prefix,
+ String(body.categoryId),
+ );
+ if (!category) return badRequest("categoryId does not exist");
+ data.category_id = body.categoryId;
+ }
+ if (body.iconUrl !== undefined)
+ data.icon_url =
+ typeof body.iconUrl === "string" && body.iconUrl ? body.iconUrl : null;
+ if (body.description !== undefined)
+ data.description =
+ typeof body.description === "string" ? body.description : null;
+ if (body.sortOrder !== undefined)
+ data.sort_order = parseSortOrder(body.sortOrder, existing.sort_order);
+ if (body.visibility !== undefined) {
+ if (!isVisibility(body.visibility))
+ return badRequest("visibility must be 'public' or 'private'");
+ data.visibility = body.visibility;
+ }
+
+ await updateLink(c.env.DB, prefix, id, data);
+ const updated = await findLink(c.env.DB, prefix, id);
+ return c.json(updated ? adminLinkDto(updated) : { id });
+});
+
+adminRoutes.delete("/links/:id", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const id = c.req.param("id");
+ const existing = await findLink(c.env.DB, prefix, id);
+ if (!existing) return c.json({ error: "not found" }, 404);
+ await deleteLink(c.env.DB, prefix, id);
+ return c.json({ success: true });
+});
+
+// ─── Search engines ──────────────────────────────────────────────────────────
+
+adminRoutes.get("/search-engines", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const engines = await listSearchEngines(c.env.DB, prefix);
+ return c.json({ searchEngines: engines.map(toSearchEngineDto) });
+});
+
+adminRoutes.post("/search-engines", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req.json().catch(() => ({}));
+
+ const name = typeof body.name === "string" ? body.name.trim() : "";
+ const urlTemplate =
+ typeof body.urlTemplate === "string" ? body.urlTemplate.trim() : "";
+ if (!name) return badRequest("name is required");
+ if (!urlTemplate) return badRequest("urlTemplate is required");
+ if (!urlTemplate.includes("{q}"))
+ return badRequest("urlTemplate must contain {q}");
+
+ const id = generateId();
+ const isDefault = body.isDefault === true || body.isDefault === 1;
+ if (isDefault) await clearDefaultSearchEngines(c.env.DB, prefix);
+
+ await insertSearchEngine(c.env.DB, prefix, {
+ id,
+ name,
+ url_template: urlTemplate,
+ icon: typeof body.icon === "string" ? body.icon : null,
+ sort_order: parseSortOrder(body.sortOrder, 0),
+ is_default: isDefault ? 1 : 0,
+ });
+
+ return c.json({ id }, 201);
+});
+
+adminRoutes.put("/search-engines/:id", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const id = c.req.param("id");
+ const existing = await findSearchEngine(c.env.DB, prefix, id);
+ if (!existing) return c.json({ error: "not found" }, 404);
+
+ const body = await c.req.json().catch(() => ({}));
+ const data: Record = {};
+ if (body.name !== undefined) {
+ const name = typeof body.name === "string" ? body.name.trim() : "";
+ if (!name) return badRequest("name must not be empty");
+ data.name = name;
+ }
+ if (body.urlTemplate !== undefined) {
+ const urlTemplate =
+ typeof body.urlTemplate === "string" ? body.urlTemplate.trim() : "";
+ if (!urlTemplate.includes("{q}"))
+ return badRequest("urlTemplate must contain {q}");
+ data.url_template = urlTemplate;
+ }
+ if (body.icon !== undefined)
+ data.icon = typeof body.icon === "string" ? body.icon : null;
+ if (body.sortOrder !== undefined)
+ data.sort_order = parseSortOrder(body.sortOrder, existing.sort_order);
+ if (body.isDefault !== undefined) {
+ const isDefault = body.isDefault === true || body.isDefault === 1;
+ if (isDefault) await clearDefaultSearchEngines(c.env.DB, prefix);
+ data.is_default = isDefault ? 1 : 0;
+ }
+
+ await updateSearchEngine(c.env.DB, prefix, id, data);
+ return c.json({ id });
+});
+
+adminRoutes.delete("/search-engines/:id", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const id = c.req.param("id");
+ const existing = await findSearchEngine(c.env.DB, prefix, id);
+ if (!existing) return c.json({ error: "not found" }, 404);
+ await deleteSearchEngine(c.env.DB, prefix, id);
+ return c.json({ success: true });
+});
+
+// ─── Sort order (batch) ──────────────────────────────────────────────────────
+
+adminRoutes.post("/categories/reorder", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req.json().catch(() => ({}));
+ if (!Array.isArray(body.ids))
+ return badRequest("ids must be an array of category ids");
+ for (const [index, id] of body.ids.entries()) {
+ if (typeof id !== "string")
+ return badRequest("ids must be an array of category ids");
+ await updateCategory(c.env.DB, prefix, id, { sort_order: index });
+ }
+ return c.json({ success: true });
+});
+
+adminRoutes.post("/links/reorder", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req.json().catch(() => ({}));
+ if (!Array.isArray(body.ids))
+ return badRequest("ids must be an array of link ids");
+ for (const [index, id] of body.ids.entries()) {
+ if (typeof id !== "string")
+ return badRequest("ids must be an array of link ids");
+ await updateLink(c.env.DB, prefix, id, { sort_order: index });
+ }
+ return c.json({ success: true });
+});
+
+adminRoutes.post("/search-engines/reorder", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req.json().catch(() => ({}));
+ if (!Array.isArray(body.ids))
+ return badRequest("ids must be an array of search engine ids");
+ for (const [index, id] of body.ids.entries()) {
+ if (typeof id !== "string")
+ return badRequest("ids must be an array of search engine ids");
+ await updateSearchEngine(c.env.DB, prefix, id, { sort_order: index });
+ }
+ return c.json({ success: true });
+});
+
+// ─── Settings ────────────────────────────────────────────────────────────────
+
+const SETTING_KEYS = [
+ "site_title",
+ "background_url",
+ "theme",
+ "columns",
+] as const;
+
+adminRoutes.get("/settings", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const settings = await getAllSettings(c.env.DB, prefix);
+ const dto: SiteSettingsDto = toSiteSettingsDto(settings);
+ return c.json(dto);
+});
+
+adminRoutes.put("/settings", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req.json().catch(() => ({}));
+
+ const updates: Record = {};
+ if (body.siteTitle !== undefined) updates.site_title = String(body.siteTitle);
+ if (body.backgroundUrl !== undefined)
+ updates.background_url = String(body.backgroundUrl);
+ if (body.theme !== undefined) {
+ const theme = String(body.theme);
+ if (!["light", "dark", "system"].includes(theme))
+ return badRequest("theme must be light, dark or system");
+ updates.theme = theme;
+ }
+ if (body.columns !== undefined) {
+ const columns = Number.parseInt(String(body.columns), 10);
+ if (!Number.isFinite(columns) || columns < 1 || columns > 12)
+ return badRequest("columns must be between 1 and 12");
+ updates.columns = String(columns);
+ }
+
+ for (const [key, value] of Object.entries(updates)) {
+ await setSetting(c.env.DB, prefix, key, value);
+ }
+
+ const settings = await getAllSettings(c.env.DB, prefix);
+ return c.json(toSiteSettingsDto(settings));
+});
+
+adminRoutes.get("/settings/keys", (c) => c.json({ keys: SETTING_KEYS }));
+
+// Fallbacks kept intentionally strict: unknown admin routes are 404 JSON.
+adminRoutes.all("*", (c) => c.json({ error: "not found" }, 404));
diff --git a/worker/src/routes/auth.ts b/worker/src/routes/auth.ts
new file mode 100644
index 0000000..3c37a4f
--- /dev/null
+++ b/worker/src/routes/auth.ts
@@ -0,0 +1,272 @@
+import { Hono } from "hono";
+import { deleteCookie, getCookie } from "hono/cookie";
+import { getTablePrefix, type HonoEnv } from "../types";
+import {
+ generateId,
+ generateToken,
+ hashPassword,
+ safeEqual,
+ verifyJWT,
+ verifyPassword,
+} from "../core/auth";
+import {
+ countUsers,
+ createOwner,
+ deleteSession,
+ findSession,
+ findUserById,
+ findUserByUsername,
+} from "../db/queries/users";
+import {
+ clearFailures,
+ isLockedOut,
+ purgeOldAttempts,
+ recordAttempt,
+ recordFailure,
+ LOCKOUT_SECONDS,
+ MAX_FAILED_ATTEMPTS,
+} from "../core/login-attempts";
+import {
+ deleteChallenge,
+ getChallenge,
+ putChallenge,
+} from "../core/challenges";
+import { getSetting } from "../db/queries/settings";
+import { verifyTOTP } from "../core/totp";
+import { SESSION_COOKIE, unauthorized } from "../middleware/auth";
+import { issueSession, clientIp } from "../services/session";
+import { nowIso } from "../db/sql";
+
+export const authRoutes = new Hono();
+
+const USERNAME_RE = /^[a-zA-Z0-9_.-]{3,64}$/;
+const PENDING_LOGIN_TTL = 300;
+
+// ─── Setup ───────────────────────────────────────────────────────────────────
+
+/**
+ * GET /api/auth/setup — reports whether owner setup is still open.
+ * POST /api/auth/setup — creates the single owner account (X-Setup-Secret).
+ * After the owner exists, setup is permanently closed (SPEC §4); there is no
+ * registration endpoint anywhere in this service.
+ */
+authRoutes.get("/setup", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const users = await countUsers(c.env.DB, prefix);
+ return c.json({ enabled: users === 0 });
+});
+
+authRoutes.post("/setup", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const users = await countUsers(c.env.DB, prefix);
+ if (users > 0) return c.json({ error: "setup already completed" }, 403);
+
+ const secret = c.req.header("X-Setup-Secret");
+ const expected = c.env.SETUP_SECRET;
+ if (!expected || expected.endsWith("_PLACEHOLDER")) {
+ return c.json({ error: "server misconfigured" }, 500);
+ }
+ if (!secret || !(await safeEqual(secret, expected))) {
+ return c.json({ error: "invalid setup secret" }, 403);
+ }
+
+ const body = await c.req.json().catch(() => ({}));
+ const username =
+ typeof body.username === "string" ? body.username.trim() : "";
+ const password = typeof body.password === "string" ? body.password : "";
+
+ if (!USERNAME_RE.test(username))
+ return c.json({ error: "invalid username" }, 400);
+ if (password.length < 8)
+ return c.json({ error: "password must be at least 8 characters" }, 400);
+
+ const passwordHash = await hashPassword(password);
+ await createOwner(c.env.DB, prefix, {
+ id: generateId(),
+ username,
+ password_hash: passwordHash,
+ });
+
+ const created = await findUserByUsername(c.env.DB, prefix, username);
+ if (!created) return c.json({ error: "setup failed" }, 500);
+
+ await issueSession(c, created.id);
+ return c.json(
+ { success: true, user: { id: created.id, username: created.username } },
+ 201,
+ );
+});
+
+// ─── Password login (step 1; TOTP step 2 when enabled) ───────────────────────
+
+authRoutes.post("/login", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const ip = clientIp(c);
+ const body = await c.req.json().catch(() => ({}));
+ const username =
+ typeof body.username === "string" ? body.username.trim() : "";
+ const password = typeof body.password === "string" ? body.password : "";
+
+ if (!username || !password)
+ return c.json({ error: "username and password required" }, 400);
+
+ if (await isLockedOut(c.env.DB, prefix, username, ip)) {
+ return c.json(
+ {
+ error: "too many failed attempts, try again later",
+ lockedForSeconds: LOCKOUT_SECONDS,
+ },
+ 429,
+ );
+ }
+
+ await purgeOldAttempts(c.env.DB, prefix);
+
+ const user = await findUserByUsername(c.env.DB, prefix, username);
+ // Constant-ish work on unknown usernames so response timing doesn't reveal
+ // whether the account exists (same pattern as eNotify).
+ const valid = user
+ ? await verifyPassword(password, user.password_hash)
+ : await verifyPassword(
+ password,
+ "0000000000000000000000000000000000000000000000000000000000000000:0000000000000000000000000000000000000000000000000000000000000000",
+ );
+
+ if (!user || !valid || !user.is_active) {
+ const result = await recordFailure(c.env.DB, prefix, {
+ id: generateId(),
+ username,
+ ip,
+ });
+ return c.json(
+ {
+ error: "invalid credentials",
+ remainingAttempts: result.remaining,
+ ...(result.locked ? { lockedForSeconds: LOCKOUT_SECONDS } : {}),
+ },
+ 401,
+ );
+ }
+
+ await recordAttempt(c.env.DB, prefix, {
+ id: generateId(),
+ username,
+ ip,
+ success: true,
+ lockUntil: null,
+ });
+ await clearFailures(c.env.DB, prefix, username);
+
+ const totpEnabled =
+ (await getSetting(c.env.DB, prefix, "totp_enabled")) === "1";
+ if (totpEnabled) {
+ const pendingId = generateToken(24);
+ await putChallenge(c.env.DB, prefix, {
+ id: `pending:${pendingId}`,
+ kind: "pending_login",
+ user_id: user.id,
+ value: "password",
+ ttlSeconds: PENDING_LOGIN_TTL,
+ });
+ return c.json({ requires2fa: true, tempToken: pendingId });
+ }
+
+ await issueSession(c, user.id);
+ return c.json({
+ success: true,
+ user: { id: user.id, username: user.username },
+ });
+});
+
+// ─── TOTP second factor (step 2) ─────────────────────────────────────────────
+
+authRoutes.post("/2fa/verify", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req.json().catch(() => ({}));
+ const tempToken = typeof body.tempToken === "string" ? body.tempToken : "";
+ const code = typeof body.code === "string" ? body.code : "";
+
+ if (!tempToken || !code)
+ return c.json({ error: "tempToken and code required" }, 400);
+
+ const pending = await getChallenge(
+ c.env.DB,
+ prefix,
+ `pending:${tempToken}`,
+ "pending_login",
+ );
+ if (!pending?.user_id)
+ return c.json({ error: "invalid or expired session" }, 401);
+
+ const secret = await getSetting(c.env.DB, prefix, "totp_secret");
+ if (!secret) {
+ await deleteChallenge(c.env.DB, prefix, `pending:${tempToken}`);
+ return c.json({ error: "2fa not configured" }, 400);
+ }
+
+ const valid = await verifyTOTP(secret, code);
+ if (!valid) {
+ const failKey = `pending_fail:${tempToken}`;
+ const failRow = await getChallenge(c.env.DB, prefix, failKey);
+ const fails = Number(failRow?.value ?? "0") + 1;
+ if (fails >= MAX_FAILED_ATTEMPTS) {
+ await deleteChallenge(c.env.DB, prefix, `pending:${tempToken}`);
+ await deleteChallenge(c.env.DB, prefix, failKey);
+ return c.json({ error: "too many failed attempts" }, 429);
+ }
+ await putChallenge(c.env.DB, prefix, {
+ id: failKey,
+ kind: "pending_fail",
+ value: String(fails),
+ ttlSeconds: PENDING_LOGIN_TTL,
+ });
+ return c.json(
+ {
+ error: "invalid verification code",
+ remainingAttempts: MAX_FAILED_ATTEMPTS - fails,
+ },
+ 401,
+ );
+ }
+
+ await deleteChallenge(c.env.DB, prefix, `pending:${tempToken}`);
+ await deleteChallenge(c.env.DB, prefix, `pending_fail:${tempToken}`);
+
+ const user = await findUserById(c.env.DB, prefix, pending.user_id);
+ if (!user?.is_active) return c.json({ error: "user not found" }, 404);
+
+ await issueSession(c, user.id);
+ return c.json({
+ success: true,
+ user: { id: user.id, username: user.username },
+ });
+});
+
+// ─── Logout ──────────────────────────────────────────────────────────────────
+
+authRoutes.post("/logout", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const token = getCookie(c, SESSION_COOKIE);
+ if (token) {
+ const payload = await verifyJWT(token, c.env.SESSION_SECRET);
+ if (payload) await deleteSession(c.env.DB, prefix, payload.sid);
+ }
+ deleteCookie(c, SESSION_COOKIE, { path: "/" });
+ return c.json({ success: true });
+});
+
+// ─── Session probe (also the recovery entry point) ───────────────────────────
+
+authRoutes.get("/session", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const token = getCookie(c, SESSION_COOKIE);
+ if (!token) return unauthorized();
+
+ const payload = await verifyJWT(token, c.env.SESSION_SECRET);
+ if (!payload) return unauthorized();
+
+ const session = await findSession(c.env.DB, prefix, payload.sid);
+ if (!session || session.expires_at < nowIso()) return unauthorized();
+
+ return c.json({ authenticated: true, userId: session.user_id });
+});
diff --git a/worker/src/routes/passkey.ts b/worker/src/routes/passkey.ts
new file mode 100644
index 0000000..66b57a9
--- /dev/null
+++ b/worker/src/routes/passkey.ts
@@ -0,0 +1,382 @@
+import { Hono } from "hono";
+import { getTablePrefix, type HonoEnv } from "../types";
+import { generateId, verifyPassword } from "../core/auth";
+import {
+ deletePasskeys,
+ findPasskey,
+ findUserById,
+ insertPasskey,
+ listPasskeys,
+ updatePasskeyCounter,
+} from "../db/queries/users";
+import {
+ deleteChallenge,
+ getChallenge,
+ putChallenge,
+} from "../core/challenges";
+import {
+ clearFailures,
+ isLockedOut,
+ recordAttempt,
+ recordFailure,
+ LOCKOUT_SECONDS,
+} from "../core/login-attempts";
+import { generateTOTPSecret, verifyTOTP } from "../core/totp";
+import { getSetting, setSetting } from "../db/queries/settings";
+import { authMiddleware } from "../middleware/auth";
+import { issueSession, clientIp } from "../services/session";
+
+export const webauthnRoutes = new Hono();
+
+const CHALLENGE_TTL = 300;
+const CHALLENGE_PREFIX = "webauthn_auth";
+
+function rpId(c: { req: { url: string } }): string {
+ return new URL(c.req.url).hostname;
+}
+
+function origin(c: { req: { url: string } }): string {
+ return new URL(c.req.url).origin;
+}
+
+function toBase64Url(buffer: ArrayBuffer | Uint8Array): string {
+ const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
+ let binary = "";
+ for (let i = 0; i < bytes.length; i++)
+ binary += String.fromCharCode(bytes[i]);
+ return btoa(binary)
+ .replace(/\+/g, "-")
+ .replace(/\//g, "_")
+ .replace(/=+$/, "");
+}
+
+function fromBase64Url(input: string): Uint8Array {
+ const padded = input.replace(/-/g, "+").replace(/_/g, "/");
+ const pad = padded.length % 4;
+ const binary = atob(pad ? padded + "=".repeat(4 - pad) : padded);
+ const bytes = new Uint8Array(binary.length);
+ for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
+ return bytes;
+}
+
+async function ownerUsername(
+ db: D1Database,
+ prefix: string,
+ userId: string,
+): Promise {
+ const row = await db
+ .prepare(`SELECT username FROM ${prefix}users WHERE id = ?`)
+ .bind(userId)
+ .first<{ username: string }>();
+ return row?.username ?? "";
+}
+
+// ─── Registration options (login required) ───────────────────────────────────
+
+webauthnRoutes.post("/register/options", authMiddleware, async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const userId = c.get("userId");
+ const user = await findUserById(c.env.DB, prefix, userId);
+ if (!user) return c.json({ error: "user not found" }, 404);
+
+ const { generateRegistrationOptions } = await import(
+ "@simplewebauthn/server"
+ );
+ const existing = await listPasskeys(c.env.DB, prefix, userId);
+
+ const options = await generateRegistrationOptions({
+ rpName: "nav",
+ rpID: rpId(c),
+ userName: user.username,
+ userDisplayName: user.username,
+ attestationType: "none",
+ excludeCredentials: existing.map((cred) => ({
+ id: cred.id,
+ type: "public-key" as const,
+ })),
+ authenticatorSelection: {
+ residentKey: "preferred",
+ userVerification: "preferred",
+ },
+ });
+
+ await putChallenge(c.env.DB, prefix, {
+ id: `webauthn_reg:${userId}`,
+ kind: "webauthn_reg",
+ user_id: userId,
+ value: options.challenge,
+ ttlSeconds: CHALLENGE_TTL,
+ });
+
+ return c.json(options);
+});
+
+// ─── Registration verify (login required) ────────────────────────────────────
+
+webauthnRoutes.post("/register/verify", authMiddleware, async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const userId = c.get("userId");
+ const body = await c.req.json().catch(() => ({}));
+
+ const challenge = await getChallenge(
+ c.env.DB,
+ prefix,
+ `webauthn_reg:${userId}`,
+ "webauthn_reg",
+ );
+ if (!challenge) return c.json({ error: "no pending challenge" }, 400);
+
+ const { verifyRegistrationResponse } = await import("@simplewebauthn/server");
+ const verification = await verifyRegistrationResponse({
+ response: body as never,
+ expectedChallenge: challenge.value,
+ expectedOrigin: origin(c),
+ expectedRPID: rpId(c),
+ });
+
+ if (!verification.verified || !verification.registrationInfo) {
+ return c.json({ error: "verification failed" }, 400);
+ }
+
+ const { credential } = verification.registrationInfo;
+ await insertPasskey(c.env.DB, prefix, {
+ id: credential.id,
+ user_id: userId,
+ public_key: toBase64Url(credential.publicKey),
+ counter: credential.counter,
+ });
+
+ await deleteChallenge(c.env.DB, prefix, `webauthn_reg:${userId}`);
+ return c.json({ success: true, credentialId: credential.id });
+});
+
+// ─── Authentication options (login, no session required) ─────────────────────
+
+webauthnRoutes.post("/authenticate/options", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req.json().catch(() => ({}));
+ const username =
+ typeof body.username === "string" ? body.username.trim() : "";
+
+ // Single-owner system: resolve the one account, by username when given.
+ let userId: string | null = null;
+ if (username) {
+ const { findUserByUsername } = await import("../db/queries/users");
+ const user = await findUserByUsername(c.env.DB, prefix, username);
+ userId = user?.id ?? null;
+ } else {
+ const row = await c.env.DB.prepare(
+ `SELECT id FROM ${prefix}users LIMIT 1`,
+ ).first<{ id: string }>();
+ userId = row?.id ?? null;
+ }
+ if (!userId) return c.json({ error: "no passkeys registered" }, 400);
+
+ const creds = await listPasskeys(c.env.DB, prefix, userId);
+ if (creds.length === 0)
+ return c.json({ error: "no passkeys registered" }, 400);
+
+ const { generateAuthenticationOptions } = await import(
+ "@simplewebauthn/server"
+ );
+ const options = await generateAuthenticationOptions({
+ rpID: rpId(c),
+ allowCredentials: creds.map((cred) => ({
+ id: cred.id,
+ type: "public-key" as const,
+ })),
+ userVerification: "preferred",
+ });
+
+ await putChallenge(c.env.DB, prefix, {
+ id: `${CHALLENGE_PREFIX}:${userId}`,
+ kind: CHALLENGE_PREFIX,
+ user_id: userId,
+ value: options.challenge,
+ ttlSeconds: CHALLENGE_TTL,
+ });
+
+ return c.json({ ...options, username: username || undefined });
+});
+
+// ─── Authentication verify (login, no session required) ──────────────────────
+
+webauthnRoutes.post("/authenticate/verify", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const ip = clientIp(c);
+ const body = await c.req.json().catch(() => ({}));
+
+ const credentialId = typeof body.id === "string" ? body.id : "";
+ if (!credentialId) return c.json({ error: "credential id required" }, 400);
+
+ const stored = await findPasskey(c.env.DB, prefix, credentialId);
+ if (!stored) return c.json({ error: "unknown credential" }, 401);
+
+ const username = await ownerUsername(c.env.DB, prefix, stored.user_id);
+ if (await isLockedOut(c.env.DB, prefix, username, ip)) {
+ return c.json(
+ {
+ error: "too many failed attempts, try again later",
+ lockedForSeconds: LOCKOUT_SECONDS,
+ },
+ 429,
+ );
+ }
+
+ const challenge = await getChallenge(
+ c.env.DB,
+ prefix,
+ `${CHALLENGE_PREFIX}:${stored.user_id}`,
+ CHALLENGE_PREFIX,
+ );
+ if (!challenge) return c.json({ error: "no pending challenge" }, 400);
+
+ const { verifyAuthenticationResponse } = await import(
+ "@simplewebauthn/server"
+ );
+ const verification = await verifyAuthenticationResponse({
+ response: body as never,
+ expectedChallenge: challenge.value,
+ expectedOrigin: origin(c),
+ expectedRPID: rpId(c),
+ credential: {
+ id: stored.id,
+ publicKey: fromBase64Url(
+ stored.public_key,
+ ) as unknown as Uint8Array,
+ counter: stored.counter,
+ },
+ });
+
+ await deleteChallenge(
+ c.env.DB,
+ prefix,
+ `${CHALLENGE_PREFIX}:${stored.user_id}`,
+ );
+
+ if (!verification.verified) {
+ const result = await recordFailure(c.env.DB, prefix, {
+ id: generateId(),
+ username,
+ ip,
+ });
+ return c.json(
+ {
+ error: "verification failed",
+ remainingAttempts: result.remaining,
+ ...(result.locked ? { lockedForSeconds: LOCKOUT_SECONDS } : {}),
+ },
+ 401,
+ );
+ }
+
+ await updatePasskeyCounter(
+ c.env.DB,
+ prefix,
+ stored.id,
+ verification.authenticationInfo.newCounter,
+ );
+ await recordAttempt(c.env.DB, prefix, {
+ id: generateId(),
+ username,
+ ip,
+ success: true,
+ lockUntil: null,
+ });
+ // Clear stale failure counters so old failures can't contribute to a lockout.
+ await clearFailures(c.env.DB, prefix, username);
+
+ const user = await findUserById(c.env.DB, prefix, stored.user_id);
+ if (!user?.is_active) return c.json({ error: "account disabled" }, 403);
+
+ await issueSession(c, user.id);
+ return c.json({
+ success: true,
+ user: { id: user.id, username: user.username },
+ });
+});
+
+// ─── Passkey management (login required) ─────────────────────────────────────
+
+webauthnRoutes.get("/credentials", authMiddleware, async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const creds = await listPasskeys(c.env.DB, prefix, c.get("userId"));
+ return c.json({
+ credentials: creds.map((cred) => ({
+ id: cred.id,
+ counter: cred.counter,
+ createdAt: cred.created_at,
+ })),
+ });
+});
+
+webauthnRoutes.delete("/credentials", authMiddleware, async (c) => {
+ const prefix = getTablePrefix(c.env);
+ await deletePasskeys(c.env.DB, prefix, c.get("userId"));
+ return c.json({ success: true });
+});
+
+// ─── TOTP management (login required) ────────────────────────────────────────
+
+webauthnRoutes.get("/totp", authMiddleware, async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const enabled = (await getSetting(c.env.DB, prefix, "totp_enabled")) === "1";
+ return c.json({ enabled });
+});
+
+webauthnRoutes.post("/totp/setup", authMiddleware, async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const userId = c.get("userId");
+ const { secret, uri } = generateTOTPSecret();
+
+ await putChallenge(c.env.DB, prefix, {
+ id: `totp_setup:${userId}`,
+ kind: "totp_setup",
+ user_id: userId,
+ value: secret,
+ ttlSeconds: 600,
+ });
+
+ return c.json({ secret, uri });
+});
+
+webauthnRoutes.post("/totp/enable", authMiddleware, async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const userId = c.get("userId");
+ const body = await c.req.json().catch(() => ({}));
+ const code = typeof body.code === "string" ? body.code : "";
+ if (!code) return c.json({ error: "code required" }, 400);
+
+ const setup = await getChallenge(
+ c.env.DB,
+ prefix,
+ `totp_setup:${userId}`,
+ "totp_setup",
+ );
+ if (!setup) return c.json({ error: "no pending totp setup" }, 400);
+
+ const valid = await verifyTOTP(setup.value, code);
+ if (!valid) return c.json({ error: "invalid code" }, 400);
+
+ await setSetting(c.env.DB, prefix, "totp_secret", setup.value);
+ await setSetting(c.env.DB, prefix, "totp_enabled", "1");
+ await deleteChallenge(c.env.DB, prefix, `totp_setup:${userId}`);
+
+ return c.json({ success: true });
+});
+
+webauthnRoutes.post("/totp/disable", authMiddleware, async (c) => {
+ const prefix = getTablePrefix(c.env);
+ const body = await c.req.json().catch(() => ({}));
+ const password = typeof body.password === "string" ? body.password : "";
+ const userId = c.get("userId");
+ const user = await findUserById(c.env.DB, prefix, userId);
+ if (!user) return c.json({ error: "user not found" }, 404);
+
+ const ok = await verifyPassword(password, user.password_hash);
+ if (!ok) return c.json({ error: "password is incorrect" }, 403);
+
+ await setSetting(c.env.DB, prefix, "totp_enabled", "0");
+ await setSetting(c.env.DB, prefix, "totp_secret", "");
+ return c.json({ success: true });
+});
diff --git a/worker/src/routes/private.ts b/worker/src/routes/private.ts
new file mode 100644
index 0000000..08c0de1
--- /dev/null
+++ b/worker/src/routes/private.ts
@@ -0,0 +1,49 @@
+import { Hono } from "hono";
+import { getTablePrefix, type HonoEnv, type SiteDataDto } from "../types";
+import { authMiddleware } from "../middleware/auth";
+import {
+ listCategories,
+ listLinks,
+ listSearchEngines,
+} from "../db/queries/content";
+import { getAllSettings } from "../db/queries/settings";
+import { buildSiteData } from "../services/site-data";
+import { ensureSchema } from "../lib/migrate";
+
+export const privateRoutes = new Hono();
+
+// 401 JSON for any unauthenticated request to /api/private/* (contract ONE-168).
+privateRoutes.use("*", authMiddleware);
+
+/**
+ * GET /api/private — full site data (public + private). Requires a valid
+ * session; responses must never be cached (contract ONE-168).
+ */
+privateRoutes.get("/", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ await ensureSchema(c.env);
+ const [categories, links, engines, settings] = await Promise.all([
+ listCategories(c.env.DB, prefix),
+ listLinks(c.env.DB, prefix),
+ listSearchEngines(c.env.DB, prefix),
+ getAllSettings(c.env.DB, prefix),
+ ]);
+
+ const data: SiteDataDto = buildSiteData(
+ categories,
+ links,
+ engines,
+ settings,
+ {
+ includePrivate: true,
+ },
+ );
+
+ c.header("cache-control", "no-store");
+ return c.json(data);
+});
+
+privateRoutes.all("*", (c) => {
+ c.header("cache-control", "no-store");
+ return c.json({ error: "not found" }, 404);
+});
diff --git a/worker/src/routes/public.ts b/worker/src/routes/public.ts
new file mode 100644
index 0000000..a4f9a6e
--- /dev/null
+++ b/worker/src/routes/public.ts
@@ -0,0 +1,51 @@
+import { Hono } from "hono";
+import { getTablePrefix, type HonoEnv, type SiteDataDto } from "../types";
+import {
+ listCategories,
+ listLinks,
+ listSearchEngines,
+} from "../db/queries/content";
+import { getAllSettings } from "../db/queries/settings";
+import { buildSiteData } from "../services/site-data";
+import { ensureSchema } from "../lib/migrate";
+
+export const publicRoutes = new Hono();
+
+/**
+ * GET /api/public — public categories + public links, search engines, site
+ * settings. Private rows are never fetched into this payload, so a private
+ * category/link cannot leak here (SPEC §2). Publicly cacheable.
+ */
+publicRoutes.get("/", async (c) => {
+ const prefix = getTablePrefix(c.env);
+ await ensureSchema(c.env);
+ const [categories, links, engines, settings] = await Promise.all([
+ listCategories(c.env.DB, prefix),
+ listLinks(c.env.DB, prefix),
+ listSearchEngines(c.env.DB, prefix),
+ getAllSettings(c.env.DB, prefix),
+ ]);
+
+ // Visibility = stricter of category and link: drop public links that live in
+ // a private category before assembling the DTO (SPEC §2).
+ const privateCategoryIds = new Set(
+ categories
+ .filter((cat) => cat.visibility === "private")
+ .map((cat) => cat.id),
+ );
+ const publicLinks = links.filter(
+ (link) =>
+ link.visibility === "public" && !privateCategoryIds.has(link.category_id),
+ );
+
+ const data: SiteDataDto = buildSiteData(
+ categories.filter((cat) => cat.visibility === "public"),
+ publicLinks,
+ engines,
+ settings,
+ { includePrivate: false },
+ );
+
+ c.header("cache-control", "public, max-age=60");
+ return c.json(data);
+});
diff --git a/worker/src/services/session.ts b/worker/src/services/session.ts
new file mode 100644
index 0000000..9ae9db8
--- /dev/null
+++ b/worker/src/services/session.ts
@@ -0,0 +1,56 @@
+import type { HonoEnv, JWTPayload } from "../types";
+import { getTablePrefix } from "../types";
+import { generateId, signJWT } from "../core/auth";
+import { insertSession } from "../db/queries/users";
+import { setCookie } from "hono/cookie";
+import { SESSION_COOKIE, sessionMaxAge } from "../middleware/auth";
+
+export function clientIp(c: {
+ req: { header: (n: string) => string | undefined };
+}): string {
+ return (
+ c.req.header("cf-connecting-ip") ||
+ c.req.header("x-forwarded-for")?.split(",")[0]?.trim() ||
+ "unknown"
+ );
+}
+
+/** Issue a session row + HttpOnly/Secure/SameSite cookie (SPEC §4). */
+export async function issueSession(
+ c: {
+ env: HonoEnv["Bindings"];
+ req: { header: (n: string) => string | undefined };
+ },
+ userId: string,
+): Promise {
+ const prefix = getTablePrefix(c.env);
+ const sid = generateId();
+ const now = Math.floor(Date.now() / 1000);
+ const expiresAt = new Date((now + sessionMaxAge()) * 1000).toISOString();
+
+ await insertSession(c.env.DB, prefix, {
+ id: sid,
+ user_id: userId,
+ expires_at: expiresAt,
+ ip: clientIp(c),
+ user_agent: c.req.header("user-agent") ?? null,
+ });
+
+ const payload: JWTPayload = {
+ typ: "access",
+ sub: userId,
+ jti: generateId(),
+ sid,
+ iat: now,
+ exp: now + sessionMaxAge(),
+ };
+ const token = await signJWT(payload, c.env.SESSION_SECRET);
+
+ setCookie(c as never, SESSION_COOKIE, token, {
+ httpOnly: true,
+ secure: true,
+ sameSite: "Lax",
+ path: "/",
+ maxAge: sessionMaxAge(),
+ });
+}
diff --git a/worker/src/services/site-data.ts b/worker/src/services/site-data.ts
new file mode 100644
index 0000000..b4607ac
--- /dev/null
+++ b/worker/src/services/site-data.ts
@@ -0,0 +1,91 @@
+import type {
+ Category,
+ Link,
+ PublicCategoryDto,
+ PublicLinkDto,
+ SearchEngine,
+ SearchEngineDto,
+ SiteDataDto,
+ SiteSettingsDto,
+} from "../types";
+
+/**
+ * Visibility takes the stricter of the two: a public link inside a private
+ * category is never delivered on the public surface (SPEC §2).
+ */
+export function toPublicLinkDto(link: Link): PublicLinkDto {
+ return {
+ id: link.id,
+ categoryId: link.category_id,
+ title: link.title,
+ url: link.url,
+ iconUrl: link.icon_url,
+ description: link.description,
+ sortOrder: link.sort_order,
+ };
+}
+
+export function toSearchEngineDto(engine: SearchEngine): SearchEngineDto {
+ return {
+ id: engine.id,
+ name: engine.name,
+ urlTemplate: engine.url_template,
+ icon: engine.icon,
+ sortOrder: engine.sort_order,
+ isDefault: engine.is_default === 1,
+ };
+}
+
+export function toSiteSettingsDto(
+ settings: Record,
+): SiteSettingsDto {
+ const columns = Number.parseInt(settings.columns ?? "0", 10);
+ return {
+ siteTitle: settings.site_title ?? "nav",
+ backgroundUrl: settings.background_url ?? "",
+ theme: settings.theme ?? "system",
+ columns: Number.isFinite(columns) && columns > 0 ? columns : 0,
+ };
+}
+
+export function buildSiteData(
+ categories: Category[],
+ links: Link[],
+ engines: SearchEngine[],
+ settings: Record,
+ opts: { includePrivate: boolean },
+): SiteDataDto {
+ const linksByCategory = new Map();
+ for (const link of links) {
+ const bucket = linksByCategory.get(link.category_id) ?? [];
+ bucket.push(link);
+ linksByCategory.set(link.category_id, bucket);
+ }
+
+ const dtoCategories: PublicCategoryDto[] = [];
+ for (const category of categories) {
+ const categoryPrivate = category.visibility === "private";
+ if (categoryPrivate && !opts.includePrivate) continue;
+
+ const visibleLinks = (linksByCategory.get(category.id) ?? []).filter(
+ (link) => {
+ if (!opts.includePrivate) return link.visibility === "public";
+ return true;
+ },
+ );
+
+ dtoCategories.push({
+ id: category.id,
+ name: category.name,
+ icon: category.icon,
+ sortOrder: category.sort_order,
+ links: visibleLinks.map(toPublicLinkDto),
+ });
+ }
+
+ return {
+ categories: dtoCategories,
+ searchEngines: engines.map(toSearchEngineDto),
+ settings: toSiteSettingsDto(settings),
+ };
+}
diff --git a/worker/src/types.ts b/worker/src/types.ts
new file mode 100644
index 0000000..58ac9cd
--- /dev/null
+++ b/worker/src/types.ts
@@ -0,0 +1,172 @@
+/**
+ * Worker bindings. SESSION_SECRET / SETUP_SECRET are wrangler secrets (or local
+ * env vars for `wrangler dev`) and are intentionally not declared in
+ * wrangler.toml so they can never be committed.
+ */
+/**
+ * Wrangler `vars` (non-secret). Declared in wrangler.toml.
+ */
+export interface Vars {
+ TABLE_PREFIX: string;
+}
+
+export interface Env {
+ DB: D1Database;
+ /** Wrangler secret / local env var — never in wrangler.toml. */
+ SESSION_SECRET: string;
+ /** Wrangler secret / local env var — never in wrangler.toml. */
+ SETUP_SECRET: string;
+ ASSETS: Fetcher;
+ /** Legacy-style table prefix kept for parity with eNotify/Zeta deployments. */
+ TABLE_PREFIX: string;
+}
+
+export interface HonoEnv {
+ Bindings: Env;
+ Variables: {
+ userId: string;
+ };
+}
+
+// ─── Row types ────────────────────────────────────────────────────────────────
+
+export interface User {
+ id: string;
+ username: string;
+ password_hash: string;
+ is_active: number;
+ created_at: string;
+ updated_at: string;
+}
+
+export interface PasskeyCredential {
+ id: string;
+ user_id: string;
+ public_key: string;
+ counter: number;
+ created_at: string;
+ updated_at: string;
+}
+
+export interface Session {
+ id: string;
+ user_id: string;
+ created_at: string;
+ expires_at: string;
+ last_seen_at: string;
+ ip: string | null;
+ user_agent: string | null;
+}
+
+export interface Category {
+ id: string;
+ name: string;
+ icon: string | null;
+ sort_order: number;
+ visibility: "public" | "private";
+ created_at: string;
+ updated_at: string;
+}
+
+export interface Link {
+ id: string;
+ category_id: string;
+ title: string;
+ url: string;
+ icon_url: string | null;
+ description: string | null;
+ sort_order: number;
+ visibility: "public" | "private";
+ /** Reserved per SPEC §5, not implemented in v1. */
+ click_count: number;
+ /** Reserved per SPEC §5, not implemented in v1. */
+ status: string | null;
+ /** Reserved per SPEC §5, not implemented in v1. */
+ last_checked_at: string | null;
+ created_at: string;
+ updated_at: string;
+}
+
+export interface SearchEngine {
+ id: string;
+ name: string;
+ url_template: string;
+ icon: string | null;
+ sort_order: number;
+ is_default: number;
+ created_at: string;
+ updated_at: string;
+}
+
+export interface Setting {
+ key: string;
+ value: string;
+ updated_at: string;
+}
+
+// ─── Frozen API DTOs (camelCase, contract ONE-168) ───────────────────────────
+
+export interface PublicCategoryDto {
+ id: string;
+ name: string;
+ icon: string | null;
+ sortOrder: number;
+ links: PublicLinkDto[];
+}
+
+export interface PublicLinkDto {
+ id: string;
+ categoryId: string;
+ title: string;
+ url: string;
+ iconUrl: string | null;
+ description: string | null;
+ sortOrder: number;
+}
+
+export interface SearchEngineDto {
+ id: string;
+ name: string;
+ urlTemplate: string;
+ icon: string | null;
+ sortOrder: number;
+ isDefault: boolean;
+}
+
+export interface SiteSettingsDto {
+ siteTitle: string;
+ backgroundUrl: string;
+ theme: string;
+ columns: number;
+}
+
+export interface SiteDataDto {
+ categories: PublicCategoryDto[];
+ searchEngines: SearchEngineDto[];
+ settings: SiteSettingsDto;
+}
+
+export interface JWTPayload {
+ typ: "access";
+ sub: string;
+ jti: string;
+ sid: string;
+ iat: number;
+ exp: number;
+}
+
+// ─── Helpers ─────────────────────────────────────────────────────────────────
+
+export function getTablePrefix(env: Env): string {
+ return env.TABLE_PREFIX || "";
+}
+
+export const VALID_VISIBILITY = ["public", "private"] as const;
+export type Visibility = (typeof VALID_VISIBILITY)[number];
+
+export function isVisibility(value: unknown): value is Visibility {
+ return (
+ typeof value === "string" &&
+ (VALID_VISIBILITY as readonly string[]).includes(value)
+ );
+}
diff --git a/worker/test/api-contract.test.ts b/worker/test/api-contract.test.ts
new file mode 100644
index 0000000..b26e618
--- /dev/null
+++ b/worker/test/api-contract.test.ts
@@ -0,0 +1,370 @@
+import { beforeEach, describe, expect, it } from "vitest";
+import { Hono } from "hono";
+import { runMigrations } from "../src/lib/migrate";
+import { publicRoutes } from "../src/routes/public";
+import { privateRoutes } from "../src/routes/private";
+import { adminRoutes } from "../src/routes/admin";
+import { authRoutes } from "../src/routes/auth";
+import type { Env } from "../src/types";
+import { makeEnv, type SqliteD1, readJson } from "./helpers";
+
+function setupRequest(app: Hono, env: Env): Promise {
+ return app.request(
+ "/api/auth/setup",
+ {
+ method: "POST",
+ body: JSON.stringify({ username: "owner", password: "password123" }),
+ headers: {
+ "content-type": "application/json",
+ "X-Setup-Secret": "test-setup-secret",
+ },
+ },
+ env,
+ );
+}
+
+function makeApp(): Hono {
+ const app = new Hono();
+ app.route("/api/auth", authRoutes);
+ app.route("/api/public", publicRoutes);
+ app.route("/api/private", privateRoutes);
+ app.route("/api/admin", adminRoutes);
+ return app;
+}
+
+async function seedContent(db: SqliteD1): Promise {
+ const now = new Date().toISOString();
+ const sql = db.db;
+ sql
+ .prepare(
+ "INSERT INTO categories (id, name, icon, sort_order, visibility, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)",
+ )
+ .run("cat-public", "Public Cat", null, 0, "public", now, now);
+ sql
+ .prepare(
+ "INSERT INTO categories (id, name, icon, sort_order, visibility, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)",
+ )
+ .run("cat-private", "Private Cat", null, 1, "private", now, now);
+ sql
+ .prepare(
+ "INSERT INTO links (id, category_id, title, url, icon_url, description, sort_order, visibility, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ )
+ .run(
+ "link-pub",
+ "cat-public",
+ "Public Link",
+ "https://pub.example.com",
+ null,
+ null,
+ 0,
+ "public",
+ now,
+ now,
+ );
+ sql
+ .prepare(
+ "INSERT INTO links (id, category_id, title, url, icon_url, description, sort_order, visibility, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ )
+ .run(
+ "link-priv",
+ "cat-private",
+ "Private Link",
+ "https://priv.example.com",
+ null,
+ null,
+ 0,
+ "private",
+ now,
+ now,
+ );
+ // Public link nested under a private category — stricter visibility wins.
+ sql
+ .prepare(
+ "INSERT INTO links (id, category_id, title, url, icon_url, description, sort_order, visibility, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ )
+ .run(
+ "link-nested",
+ "cat-private",
+ "Nested Public Link",
+ "https://nested.example.com",
+ null,
+ null,
+ 1,
+ "public",
+ now,
+ now,
+ );
+ sql
+ .prepare(
+ "INSERT INTO search_engines (id, name, url_template, icon, sort_order, is_default, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
+ )
+ .run(
+ "se-1",
+ "Google",
+ "https://www.google.com/search?q={q}",
+ null,
+ 0,
+ 1,
+ now,
+ now,
+ );
+ sql
+ .prepare("INSERT INTO settings (key, value, updated_at) VALUES (?, ?, ?)")
+ .run("site_title", "My Nav", now);
+}
+
+describe("public/private surface isolation", () => {
+ let env: Env;
+ let app: Hono;
+
+ beforeEach(async () => {
+ env = makeEnv();
+ app = makeApp();
+ await runMigrations(env);
+ await seedContent(env.DB as unknown as SqliteD1);
+ });
+
+ it("GET /api/public contains no private categories or links", async () => {
+ const res = await app.request("/api/public", {}, env);
+ expect(res.status).toBe(200);
+ expect(res.headers.get("cache-control")).toContain("public");
+
+ const body = await readJson(res);
+ const text = JSON.stringify(body);
+ expect(text).not.toContain("Private Cat");
+ expect(text).not.toContain("priv.example.com");
+ // Public link inside a private category is also withheld.
+ expect(text).not.toContain("Nested Public Link");
+ expect(text).not.toContain("nested.example.com");
+
+ expect(body.categories).toHaveLength(1);
+ expect(body.categories[0].id).toBe("cat-public");
+ expect(body.categories[0].links).toHaveLength(1);
+ expect(body.settings.siteTitle).toBe("My Nav");
+ expect(body.searchEngines).toHaveLength(1);
+ expect(body.searchEngines[0].isDefault).toBe(true);
+ });
+
+ it("GET /api/private without a session returns 401 JSON with no-store", async () => {
+ const res = await app.request("/api/private", {}, env);
+ expect(res.status).toBe(401);
+ expect(res.headers.get("cache-control")).toBe("no-store");
+ const body = await readJson(res);
+ expect(body).toEqual({ error: "unauthorized" });
+ const text = JSON.stringify(body);
+ expect(text).not.toContain("priv.example.com");
+ });
+
+ it("GET /api/admin/* without a session returns 401 JSON", async () => {
+ for (const path of [
+ "/api/admin/categories",
+ "/api/admin/links",
+ "/api/admin/settings",
+ ]) {
+ const res = await app.request(path, {}, env);
+ expect(res.status).toBe(401);
+ expect(await readJson(res)).toEqual({ error: "unauthorized" });
+ }
+ const write = await app.request(
+ "/api/admin/categories",
+ {
+ method: "POST",
+ body: JSON.stringify({ name: "x" }),
+ headers: { "content-type": "application/json" },
+ },
+ env,
+ );
+ expect(write.status).toBe(401);
+ });
+});
+
+describe("setup flow", () => {
+ let env: Env;
+ let app: Hono;
+
+ beforeEach(async () => {
+ env = makeEnv();
+ app = makeApp();
+ await runMigrations(env);
+ });
+
+ it("setup/status reports enabled before the owner exists", async () => {
+ const full = new Hono();
+ full.get("/api/setup/status", async (c) => {
+ const db = (env.DB as unknown as SqliteD1).db;
+ const row = db.prepare("SELECT COUNT(*) AS n FROM users").get() as {
+ n: number;
+ };
+ return c.json({ enabled: row.n === 0 });
+ });
+ void app;
+ const res = await full.request("/api/setup/status", {}, env);
+ expect(await readJson(res)).toEqual({ enabled: true });
+ });
+
+ it("creates the single owner with the setup secret and closes afterwards", async () => {
+ // wrong secret → 403
+ const denied = await app.request(
+ "/api/auth/setup",
+ {
+ method: "POST",
+ body: JSON.stringify({ username: "owner", password: "password123" }),
+ headers: {
+ "content-type": "application/json",
+ "X-Setup-Secret": "nope",
+ },
+ },
+ env,
+ );
+ expect(denied.status).toBe(403);
+
+ const ok = await app.request(
+ "/api/auth/setup",
+ {
+ method: "POST",
+ body: JSON.stringify({ username: "owner", password: "password123" }),
+ headers: {
+ "content-type": "application/json",
+ "X-Setup-Secret": "test-setup-secret",
+ },
+ },
+ env,
+ );
+ expect(ok.status).toBe(201);
+ const body = await readJson(ok);
+ expect(body.user.username).toBe("owner");
+ expect(body.user.passwordHash).toBeUndefined();
+
+ // setup closes
+ const again = await app.request(
+ "/api/auth/setup",
+ {
+ method: "POST",
+ body: JSON.stringify({ username: "owner2", password: "password123" }),
+ headers: {
+ "content-type": "application/json",
+ "X-Setup-Secret": "test-setup-secret",
+ },
+ },
+ env,
+ );
+ expect(again.status).toBe(403);
+
+ const state = await app.request("/api/auth/setup", {}, env);
+ expect(await readJson(state)).toEqual({ enabled: false });
+ });
+
+ it("deleting a category removes its links (no orphans)", async () => {
+ const setupRes = await setupRequest(app, env);
+ const cookie = setupRes.headers.get("set-cookie") ?? "";
+
+ const cat = await app.request(
+ "/api/admin/categories",
+ {
+ method: "POST",
+ body: JSON.stringify({ name: "temp" }),
+ headers: { "content-type": "application/json", cookie },
+ },
+ env,
+ );
+ const { id: catId } = await readJson(cat);
+ await app.request(
+ "/api/admin/links",
+ {
+ method: "POST",
+ body: JSON.stringify({
+ title: "t",
+ url: "https://x.example.com",
+ categoryId: catId,
+ }),
+ headers: { "content-type": "application/json", cookie },
+ },
+ env,
+ );
+
+ const del = await app.request(
+ `/api/admin/categories/${catId}`,
+ { method: "DELETE", headers: { cookie } },
+ env,
+ );
+ expect(del.status).toBe(200);
+
+ const links = await app.request(
+ "/api/admin/links",
+ { headers: { cookie } },
+ env,
+ );
+ const body = await readJson(links);
+ expect(body.links).toHaveLength(0);
+ });
+
+ it("admin link DTO includes visibility and timestamps (frozen contract)", async () => {
+ const setupRes = await setupRequest(app, env);
+ const cookie = setupRes.headers.get("set-cookie") ?? "";
+
+ const cat = await app.request(
+ "/api/admin/categories",
+ {
+ method: "POST",
+ body: JSON.stringify({ name: "c" }),
+ headers: { "content-type": "application/json", cookie },
+ },
+ env,
+ );
+ const { id: catId } = await readJson(cat);
+ const link = await app.request(
+ "/api/admin/links",
+ {
+ method: "POST",
+ body: JSON.stringify({
+ title: "t",
+ url: "https://x.example.com",
+ categoryId: catId,
+ visibility: "private",
+ }),
+ headers: { "content-type": "application/json", cookie },
+ },
+ env,
+ );
+ const { id: linkId } = await readJson(link);
+
+ const updated = await app.request(
+ `/api/admin/links/${linkId}`,
+ {
+ method: "PUT",
+ body: JSON.stringify({ title: "t2" }),
+ headers: { "content-type": "application/json", cookie },
+ },
+ env,
+ );
+ expect(updated.status).toBe(200);
+ const body = await readJson(updated);
+ expect(body.visibility).toBe("private");
+ expect(body.createdAt).toBeTruthy();
+ expect(body.updatedAt).toBeTruthy();
+ });
+
+ it("reserved SPEC §5 columns exist on links", async () => {
+ const db = (env.DB as unknown as SqliteD1).db;
+ const cols = db
+ .prepare("PRAGMA table_info(links)")
+ .all()
+ .map((r: any) => r.name);
+ expect(cols).toContain("click_count");
+ expect(cols).toContain("status");
+ expect(cols).toContain("last_checked_at");
+ });
+
+ it("has no registration endpoint", async () => {
+ const res = await app.request(
+ "/api/auth/register",
+ {
+ method: "POST",
+ body: JSON.stringify({}),
+ headers: { "content-type": "application/json" },
+ },
+ env,
+ );
+ expect(res.status).toBe(404);
+ });
+});
diff --git a/worker/test/auth.test.ts b/worker/test/auth.test.ts
new file mode 100644
index 0000000..bb2b9fe
--- /dev/null
+++ b/worker/test/auth.test.ts
@@ -0,0 +1,211 @@
+import { beforeEach, describe, expect, it } from "vitest";
+import { Hono } from "hono";
+import { runMigrations } from "../src/lib/migrate";
+import { authRoutes } from "../src/routes/auth";
+import { privateRoutes } from "../src/routes/private";
+import { adminRoutes } from "../src/routes/admin";
+import type { Env } from "../src/types";
+import { makeEnv, readJson, type SqliteD1 } from "./helpers";
+import { generateTOTPSecret, generateTOTPCode } from "../src/core/totp";
+
+function makeApp(): Hono {
+ const app = new Hono();
+ app.route("/api/auth", authRoutes);
+ app.route("/api/private", privateRoutes);
+ app.route("/api/admin", adminRoutes);
+ return app;
+}
+
+function setupRequest(app: Hono, env: Env): Promise {
+ return app.request(
+ "/api/auth/setup",
+ {
+ method: "POST",
+ body: JSON.stringify({ username: "owner", password: "password123" }),
+ headers: {
+ "content-type": "application/json",
+ "X-Setup-Secret": "test-setup-secret",
+ },
+ },
+ env,
+ );
+}
+
+function loginRequest(
+ app: Hono,
+ env: Env,
+ username: string,
+ password: string,
+): Promise {
+ return app.request(
+ "/api/auth/login",
+ {
+ method: "POST",
+ body: JSON.stringify({ username, password }),
+ headers: { "content-type": "application/json" },
+ },
+ env,
+ );
+}
+
+function cookieFrom(res: Response): string {
+ return res.headers.get("set-cookie") ?? "";
+}
+
+describe("password login + lockout", () => {
+ let env: Env;
+ let app: Hono;
+
+ beforeEach(async () => {
+ env = makeEnv();
+ app = makeApp();
+ await runMigrations(env);
+ await setupRequest(app, env);
+ });
+
+ it("logs in with the correct password and issues an HttpOnly session cookie", async () => {
+ const res = await loginRequest(app, env, "owner", "password123");
+ expect(res.status).toBe(200);
+ const body = await readJson(res);
+ expect(body.success).toBe(true);
+
+ const cookie = cookieFrom(res);
+ expect(cookie).toContain("nav_session=");
+ expect(cookie.toLowerCase()).toContain("httponly");
+ expect(cookie.toLowerCase()).toContain("secure");
+ expect(cookie.toLowerCase()).toContain("samesite=lax");
+ });
+
+ it("rejects a wrong password with 401 and reveals no data", async () => {
+ const res = await loginRequest(app, env, "owner", "wrong-password");
+ expect(res.status).toBe(401);
+ const body = await readJson(res);
+ expect(body.error).toBe("invalid credentials");
+ expect(body.remainingAttempts).toBeLessThan(5);
+ });
+
+ it("locks the account after 5 consecutive failures", async () => {
+ for (let i = 0; i < 5; i++) {
+ const res = await loginRequest(app, env, "owner", "wrong-password");
+ expect([401, 429]).toContain(res.status);
+ }
+ const locked = await loginRequest(app, env, "owner", "password123");
+ expect(locked.status).toBe(429);
+ const body = await readJson(locked);
+ expect(body.error).toContain("too many failed attempts");
+ });
+});
+
+describe("password + TOTP second factor", () => {
+ let env: Env;
+ let app: Hono;
+
+ beforeEach(async () => {
+ env = makeEnv();
+ app = makeApp();
+ await runMigrations(env);
+ const setupRes = await setupRequest(app, env);
+ const cookie = cookieFrom(setupRes);
+
+ // Enable TOTP via the authenticated management endpoints.
+ const { secret, uri } = generateTOTPSecret();
+ expect(uri).toContain("otpauth://totp/nav");
+
+ const db = (env.DB as unknown as SqliteD1).db;
+ const now = new Date().toISOString();
+ db.prepare(
+ "INSERT OR REPLACE INTO settings (key, value, updated_at) VALUES (?, ?, ?)",
+ ).run("totp_secret", secret, now);
+ db.prepare(
+ "INSERT OR REPLACE INTO settings (key, value, updated_at) VALUES (?, ?, ?)",
+ ).run("totp_enabled", "1", now);
+ void cookie;
+ });
+
+ it("requires the TOTP code and accepts a valid one", async () => {
+ const step1 = await loginRequest(app, env, "owner", "password123");
+ expect(step1.status).toBe(200);
+ const body1 = await readJson(step1);
+ expect(body1.requires2fa).toBe(true);
+ expect(typeof body1.tempToken).toBe("string");
+
+ const secret = (
+ (env.DB as unknown as SqliteD1).db
+ .prepare("SELECT value FROM settings WHERE key = 'totp_secret'")
+ .get() as { value: string }
+ ).value;
+ const code = await generateTOTPCode(
+ secret,
+ Math.floor(Date.now() / 1000 / 30),
+ );
+
+ const step2 = await app.request(
+ "/api/auth/2fa/verify",
+ {
+ method: "POST",
+ body: JSON.stringify({ tempToken: body1.tempToken, code }),
+ headers: { "content-type": "application/json" },
+ },
+ env,
+ );
+ expect(step2.status).toBe(200);
+ expect((await readJson(step2)).success).toBe(true);
+ expect(cookieFrom(step2)).toContain("nav_session=");
+ });
+
+ it("rejects a wrong TOTP code with 401", async () => {
+ const step1 = await loginRequest(app, env, "owner", "password123");
+ const body1 = await readJson(step1);
+
+ const step2 = await app.request(
+ "/api/auth/2fa/verify",
+ {
+ method: "POST",
+ body: JSON.stringify({ tempToken: body1.tempToken, code: "000000" }),
+ headers: { "content-type": "application/json" },
+ },
+ env,
+ );
+ expect(step2.status).toBe(401);
+ });
+});
+
+describe("authenticated access after login", () => {
+ it("GET /api/private with a valid session returns full data with no-store", async () => {
+ const env = makeEnv();
+ const app = makeApp();
+ await runMigrations(env);
+ const setupRes = await setupRequest(app, env);
+ const cookie = cookieFrom(setupRes);
+
+ const res = await app.request("/api/private", { headers: { cookie } }, env);
+ expect(res.status).toBe(200);
+ expect(res.headers.get("cache-control")).toBe("no-store");
+ const body = await readJson(res);
+ expect(body).toHaveProperty("categories");
+ expect(body).toHaveProperty("searchEngines");
+ expect(body).toHaveProperty("settings");
+ });
+
+ it("logout revokes the session", async () => {
+ const env = makeEnv();
+ const app = makeApp();
+ await runMigrations(env);
+ const setupRes = await setupRequest(app, env);
+ const cookie = cookieFrom(setupRes);
+
+ const logout = await app.request(
+ "/api/auth/logout",
+ { method: "POST", headers: { cookie } },
+ env,
+ );
+ expect(logout.status).toBe(200);
+
+ const after = await app.request(
+ "/api/private",
+ { headers: { cookie } },
+ env,
+ );
+ expect(after.status).toBe(401);
+ });
+});
diff --git a/worker/test/helpers.ts b/worker/test/helpers.ts
new file mode 100644
index 0000000..af62a20
--- /dev/null
+++ b/worker/test/helpers.ts
@@ -0,0 +1,82 @@
+import { DatabaseSync } from "node:sqlite";
+import type { Env } from "../src/types";
+
+/**
+ * Minimal D1 stand-in backed by a real in-memory SQLite database (node:sqlite).
+ * Keeps real column defaults/constraints so schema + query behaviour can be
+ * verified against actual SQL semantics.
+ */
+export class SqliteD1 {
+ readonly db = new DatabaseSync(":memory:");
+ queries: string[] = [];
+
+ prepare(sql: string): any {
+ const db = this.db;
+ this.queries.push(sql);
+ const statement = () => db.prepare(sql);
+
+ return {
+ bind: (...args: unknown[]) => ({
+ first: async () =>
+ (statement().get(...(args as any[])) ?? null) as T | null,
+ all: async () => ({
+ results: statement().all(...(args as any[])) as T[],
+ }),
+ run: async () => {
+ statement().run(...(args as any[]));
+ return { success: true };
+ },
+ }),
+ first: async () => (statement().get() ?? null) as T | null,
+ all: async () => ({ results: statement().all() as T[] }),
+ run: async () => {
+ statement().run();
+ return { success: true };
+ },
+ };
+ }
+}
+
+export function makeEnv(overrides: Partial = {}): Env {
+ return {
+ DB: new SqliteD1() as unknown as D1Database,
+ SESSION_SECRET: "test-jwt-secret-0123456789abcdef",
+ SETUP_SECRET: "test-setup-secret",
+ TABLE_PREFIX: "",
+ ASSETS: {
+ fetch: async () => new Response("not found", { status: 404 }),
+ } as unknown as Fetcher,
+ ...overrides,
+ };
+}
+
+export function setTablePrefix(env: Env, prefix: string): Env {
+ return { ...env, TABLE_PREFIX: prefix };
+}
+
+export async function readJson(res: Response): Promise {
+ const text = await res.text();
+ try {
+ return text ? JSON.parse(text) : null;
+ } catch {
+ return text;
+ }
+}
+
+export function jsonRequest(
+ path: string,
+ init: {
+ method?: string;
+ body?: unknown;
+ headers?: Record;
+ } = {},
+): Request {
+ return new Request(`http://localhost${path}`, {
+ method: init.method ?? "GET",
+ headers: {
+ "content-type": "application/json",
+ ...(init.headers ?? {}),
+ },
+ body: init.body === undefined ? undefined : JSON.stringify(init.body),
+ });
+}
diff --git a/worker/test/migrate.test.ts b/worker/test/migrate.test.ts
new file mode 100644
index 0000000..9fd5c28
--- /dev/null
+++ b/worker/test/migrate.test.ts
@@ -0,0 +1,65 @@
+import { describe, expect, it } from "vitest";
+import { runMigrations } from "../src/lib/migrate";
+import { makeEnv, type SqliteD1 } from "./helpers";
+
+describe("D1 migration", () => {
+ it("applies cleanly on an empty database", async () => {
+ const env = makeEnv();
+ const result = await runMigrations(env);
+ expect(result.applied).toBe(true);
+
+ const db = (env.DB as unknown as SqliteD1).db;
+ const tables = db
+ .prepare(
+ "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name",
+ )
+ .all()
+ .map((row: any) => row.name);
+
+ for (const table of [
+ "users",
+ "passkey_credentials",
+ "sessions",
+ "login_attempts",
+ "challenges",
+ "categories",
+ "links",
+ "search_engines",
+ "settings",
+ ]) {
+ expect(tables).toContain(table);
+ }
+ });
+
+ it("is idempotent — can be re-run on an initialized database", async () => {
+ const env = makeEnv();
+ await runMigrations(env);
+ await expect(runMigrations(env)).resolves.toEqual({ applied: true });
+ await expect(runMigrations(env)).resolves.toEqual({ applied: true });
+ });
+
+ it("respects the table prefix", async () => {
+ const env = makeEnv({ TABLE_PREFIX: "nav_" });
+ await runMigrations(env);
+
+ const db = (env.DB as unknown as SqliteD1).db;
+ const tables = db
+ .prepare("SELECT name FROM sqlite_master WHERE type='table'")
+ .all()
+ .map((row: any) => row.name);
+ expect(tables).toContain("nav_users");
+ expect(tables).toContain("nav_links");
+ expect(tables).not.toContain("users");
+ });
+
+ it("seeds setup_completed = 0", async () => {
+ const env = makeEnv();
+ await runMigrations(env);
+
+ const db = (env.DB as unknown as SqliteD1).db;
+ const row = db
+ .prepare("SELECT value FROM settings WHERE key = 'setup_completed'")
+ .get() as { value: string } | undefined;
+ expect(row?.value).toBe("0");
+ });
+});
diff --git a/worker/tsconfig.json b/worker/tsconfig.json
new file mode 100644
index 0000000..3818ac9
--- /dev/null
+++ b/worker/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../tsconfig.base.json",
+ "compilerOptions": {
+ "target": "ES2022",
+ "lib": ["ES2022"],
+ "types": ["@cloudflare/workers-types"]
+ },
+ "include": ["src/**/*.ts"]
+}
diff --git a/worker/vitest.config.ts b/worker/vitest.config.ts
new file mode 100644
index 0000000..ed8bf77
--- /dev/null
+++ b/worker/vitest.config.ts
@@ -0,0 +1,8 @@
+import { defineConfig } from "vitest/config";
+
+export default defineConfig({
+ test: {
+ environment: "node",
+ include: ["test/**/*.test.ts"],
+ },
+});
diff --git a/worker/wrangler.toml b/worker/wrangler.toml
new file mode 100644
index 0000000..f3672d3
--- /dev/null
+++ b/worker/wrangler.toml
@@ -0,0 +1,25 @@
+name = "nav"
+main = "src/index.ts"
+compatibility_date = "2026-05-01"
+compatibility_flags = ["nodejs_compat"]
+account_id = "CLOUDFLARE_ACCOUNT_ID_PLACEHOLDER"
+# SESSION_SECRET / SETUP_SECRET are wrangler secrets (or local env vars for
+# `wrangler dev`) — never committed to this file.
+
+
+[define]
+APP_VERSION = "__APP_VERSION__"
+
+[assets]
+directory = "../web/dist"
+binding = "ASSETS"
+
+[[d1_databases]]
+binding = "DB"
+database_name = "D1_DATABASE_NAME_PLACEHOLDER"
+database_id = "D1_DATABASE_ID_PLACEHOLDER"
+
+[vars]
+TABLE_PREFIX = ""
+# Local dev only: wrangler dev picks these up from the shell environment;
+# production receives SESSION_SECRET / SETUP_SECRET as wrangler secrets.