Comparing version 2.1.0 to 2.2.0
# lucia | ||
## 2.2.0 | ||
### Minor changes | ||
- [#944](https://github.com/pilcrowOnPaper/lucia/pull/944) by [@pilcrowOnPaper](https://github.com/pilcrowOnPaper) : Add `hono()` middleware | ||
## 2.1.0 | ||
@@ -4,0 +10,0 @@ |
@@ -69,2 +69,11 @@ /// <reference types="node" /> | ||
export declare const h3: () => Middleware<[H3Event]>; | ||
type HonoContext = { | ||
req: { | ||
url: string; | ||
method: string; | ||
headers: Headers; | ||
}; | ||
header: (name: string, value: string) => void; | ||
}; | ||
export declare const hono: () => Middleware<[HonoContext]>; | ||
export {}; |
@@ -228,1 +228,21 @@ const getIncomingMessageUrl = (incomingMessage, env) => { | ||
}; | ||
export const hono = () => { | ||
return ({ args }) => { | ||
const [context] = args; | ||
const requestContext = { | ||
request: { | ||
url: context.req.url, | ||
method: context.req.method, | ||
headers: { | ||
origin: context.req.headers.get("Origin"), | ||
cookie: context.req.headers.get("Cookie"), | ||
authorization: context.req.headers.get("Authorization") | ||
} | ||
}, | ||
setCookie: (cookie) => { | ||
context.header("Set-Cookie", cookie.serialize()); | ||
} | ||
}; | ||
return requestContext; | ||
}; | ||
}; |
{ | ||
"name": "lucia", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "A simple and flexible authentication library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
84874
1863