activescott / activescott/auth

[FEATURE] @activescott/auth-adapter-hono — Hono framework adapter

オープン
#27 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
0
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

説明

## Summary

Add `@activescott/auth-adapter-hono` — a Hono adapter for `@activescott/auth`. Works on Node, Cloudflare Workers, Bun, and Deno.

## Motivation

Hono is a fast, lightweight framework that runs everywhere Web standards are available. Because Hono uses standard `Request/Response`, the adapter is extremely thin — no framework-specific quirks. It's the simplest possible adapter and covers a large target audience (especially Cloudflare Workers users).

## API

Same `createAuthHandlers` surface as the React Router adapter, plus three Hono-specific exports:

```ts
import { createAuthHandlers, sendMagicLink } from '@activescott/auth-adapter-hono'
import { requireAuthMiddleware, optionalAuthMiddleware, createAuthHandler } from '@activescott/auth-adapter-hono'
```

**Catch-all auth route:**
```ts
app.all('/auth/:provider/:action', createAuthHandler(handlers))
```

**Protected route middleware:**
```ts
app.use('/dashboard/*', requireAuthMiddleware(handlers))
app.get('/dashboard', (c) => {
const user = c.get('user') as AppUser
return c.json({ user })
})
```

**Optional auth:**
```ts
app.use('/', optionalAuthMiddleware(handlers))
```

## Acceptance Criteria

- [ ] Package `@activescott/auth-adapter-hono` published
- [ ] `createAuthHandlers` — same API as React Router adapter
- [ ] `requireAuthMiddleware` — sets `c.set('user', user)` or returns 302
- [ ] `optionalAuthMiddleware` — sets `c.set('user', user | null)`, never redirects
- [ ] `createAuthHandler` — route handler factory for the catch-all auth route
- [ ] 30 tests passing (21 handler tests + 9 middleware tests)
- [ ] Zero Hono-version-specific dependencies (peer dep `hono ^4.0.0`)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。