@dbsc-toolkit/server-hono 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,132 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity.
18
+
19
+ "You" (or "Your") shall mean an individual or Legal Entity
20
+ exercising permissions granted by this License.
21
+
22
+ "Source" form shall mean the preferred form for making modifications,
23
+ including but not limited to software source code, documentation
24
+ source, and configuration files.
25
+
26
+ "Object" form shall mean any form resulting from mechanical
27
+ transformation or translation of a Source form, including but
28
+ not limited to compiled object code, generated documentation,
29
+ and conversions to other media types.
30
+
31
+ "Work" shall mean the work of authorship made available under
32
+ the License, as indicated by a copyright notice that is included in
33
+ or attached to the work.
34
+
35
+ "Derivative Works" shall mean any work, whether in Source or Object
36
+ form, that is based on (or derived from) the Work and for which the
37
+ editorial revisions, annotations, elaborations, or other transformations
38
+ represent, as a whole, an original work of authorship.
39
+
40
+ "Contribution" shall mean any work of authorship, including
41
+ the original version of the Work and any modifications or additions
42
+ to that Work or Derivative Works of the Work, that is intentionally
43
+ submitted to the Licensor for inclusion in the Work by the copyright owner
44
+ or by an individual or Legal Entity authorized to submit on behalf of
45
+ the copyright owner.
46
+
47
+ "Contributor" shall mean Licensor and any Legal Entity
48
+ on behalf of whom a Contribution has been received by the Licensor and
49
+ subsequently incorporated within the Work.
50
+
51
+ 2. Grant of Copyright License. Subject to the terms and conditions of
52
+ this License, each Contributor hereby grants to You a perpetual,
53
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
54
+ copyright license to reproduce, prepare Derivative Works of,
55
+ publicly display, publicly perform, sublicense, and distribute the
56
+ Work and such Derivative Works in Source or Object form.
57
+
58
+ 3. Grant of Patent License. Subject to the terms and conditions of
59
+ this License, each Contributor hereby grants to You a perpetual,
60
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
61
+ (except as stated in this section) patent license to make, have made,
62
+ use, offer to sell, sell, import, and otherwise transfer the Work,
63
+ where such license applies only to those patent claims licensable
64
+ by such Contributor that are necessarily infringed by their
65
+ Contribution(s) alone or by the combined work of their Contribution(s)
66
+ with the Work to which such Contribution(s) was submitted.
67
+
68
+ 4. Redistribution. You may reproduce and distribute copies of the
69
+ Work or Derivative Works thereof in any medium, with or without
70
+ modifications, and in Source or Object form, provided that You
71
+ meet the following conditions:
72
+
73
+ (a) You must give any other recipients of the Work or Derivative Works
74
+ a copy of this License; and
75
+
76
+ (b) You must cause any modified files to carry prominent notices
77
+ stating that You changed the files; and
78
+
79
+ (c) You must retain, in the Source form of any Derivative Works
80
+ that You distribute, all copyright, patent, trademark, and
81
+ attribution notices from the Source form of the Work; and
82
+
83
+ (d) If the Work includes a "NOTICE" text file, you must include a
84
+ readable copy of the attribution notices contained within such NOTICE
85
+ file, in at least one of the following places: within a NOTICE text
86
+ file distributed as part of the Derivative Works; or, within the
87
+ Source form or documentation, if provided along with the Derivative
88
+ Works; or, on a display generated by the Derivative Works.
89
+
90
+ The "NOTICE" file referenced above refers to a text file that may
91
+ accompany the source form of the Work.
92
+
93
+ You may add Your own attribution notices within Derivative Works
94
+ that You distribute, alongside or as an addendum to the NOTICE text
95
+ from the Work, provided that such additional attribution notices
96
+ cannot be construed as modifying the License.
97
+
98
+ You may add Your own license statement for Your modifications and
99
+ may provide additional grant of rights to use, reproduce, or
100
+ distribute Derivative Works, subject to the terms and conditions
101
+ for the Work itself.
102
+
103
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
104
+ any Contribution intentionally submitted for inclusion in the Work
105
+ by You to the Licensor shall be under the terms and conditions of
106
+ this License, without any additional terms or conditions.
107
+
108
+ 6. Trademarks. This License does not grant permission to use the trade
109
+ names, trademarks, service marks, or product names of the Licensor.
110
+
111
+ 7. Disclaimer of Warranty. Unless required by applicable law or
112
+ agreed to in writing, Licensor provides the Work (and each Contributor
113
+ provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
114
+ OR CONDITIONS OF ANY KIND, either express or implied, including,
115
+ without limitation, any warranties or conditions of TITLE,
116
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
117
+
118
+ 8. Limitation of Liability. In no event and under no legal theory,
119
+ whether in tort (including negligence), contract, or otherwise,
120
+ unless required by applicable law (such as deliberate and grossly
121
+ negligent acts) or agreed to in writing, shall any Contributor be
122
+ liable to You for damages, including any direct, indirect, special,
123
+ incidental, or exemplary damages of any character arising as a
124
+ result of this License or out of the use or inability to use the
125
+ Work.
126
+
127
+ 9. Accepting Warranty or Additional Liability. While redistributing
128
+ the Work or Derivative Works thereof, You may choose to offer, and
129
+ charge a fee for, acceptance of support, warranty, indemnity,
130
+ or other liability obligations and/or rights consistent with this License.
131
+
132
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @dbsc-toolkit/server-hono
2
+
3
+ Hono middleware for the DBSC Toolkit. Works on Node.js, Bun, Deno, and Cloudflare Workers — wherever Hono runs.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ pnpm add @dbsc-toolkit/server-hono @dbsc-toolkit/storage-memory hono
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { Hono } from "hono";
15
+ import { setCookie } from "hono/cookie";
16
+ import { dbsc } from "@dbsc-toolkit/server-hono";
17
+ import { MemoryStorage } from "@dbsc-toolkit/storage-memory";
18
+ import { buildRegistrationHeader, issueChallenge } from "@dbsc-toolkit/core";
19
+
20
+ const app = new Hono();
21
+ const storage = new MemoryStorage();
22
+
23
+ app.use("*", dbsc({ storage }));
24
+
25
+ app.post("/login", async (c) => {
26
+ const { username } = await c.req.json();
27
+ const sessionId = crypto.randomUUID();
28
+
29
+ await storage.setSession({
30
+ id: sessionId, userId: username, tier: "none",
31
+ createdAt: Date.now(), expiresAt: Date.now() + 24 * 60 * 60 * 1000,
32
+ });
33
+
34
+ const challenge = await issueChallenge(sessionId, storage);
35
+ const header = buildRegistrationHeader({
36
+ refreshPath: "/dbsc/registration",
37
+ challenge: challenge.jti,
38
+ });
39
+ c.header("Secure-Session-Registration", header);
40
+ c.header("Sec-Session-Registration", header);
41
+
42
+ setCookie(c, "__Host-dbsc-reg", sessionId, {
43
+ httpOnly: true, secure: true, sameSite: "Lax", path: "/",
44
+ maxAge: 24 * 60 * 60,
45
+ });
46
+ setCookie(c, "__Host-dbsc-challenge", challenge.jti, {
47
+ httpOnly: true, secure: true, sameSite: "Lax", path: "/",
48
+ maxAge: 5 * 60,
49
+ });
50
+
51
+ return c.json({ ok: true });
52
+ });
53
+
54
+ app.get("/me", (c) => {
55
+ const sessionId = c.get("dbscSessionId");
56
+ const tier = c.get("dbscTier");
57
+ if (!sessionId) return c.json({ error: "not authenticated" }, 401);
58
+ return c.json({ sessionId, tier });
59
+ });
60
+ ```
61
+
62
+ Session info is on the Hono context: `c.get("dbscSessionId")`, `c.get("dbscTier")`.
63
+
64
+ See the [main README](https://github.com/SulimanAbdulrazzaq/DBSC#readme) for the full picture.
65
+
66
+ ## License
67
+
68
+ Apache-2.0
@@ -0,0 +1,13 @@
1
+ import type { MiddlewareHandler } from "hono";
2
+ import { type DbscOptions, type ProtectionTier } from "@dbsc-toolkit/core";
3
+ export interface DbscHonoOptions extends DbscOptions {
4
+ secure?: boolean;
5
+ }
6
+ declare module "hono" {
7
+ interface ContextVariableMap {
8
+ dbscSessionId: string | null;
9
+ dbscTier: ProtectionTier;
10
+ }
11
+ }
12
+ export declare function dbsc(opts: DbscHonoOptions): MiddlewareHandler;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAEvD,OAAO,EAYL,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAQ5B,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAU,kBAAkB;QAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,QAAQ,EAAE,cAAc,CAAC;KAC1B;CACF;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,eAAe,GAAG,iBAAiB,CA2H7D"}
package/dist/index.js ADDED
@@ -0,0 +1,107 @@
1
+ import { getCookie, setCookie, deleteCookie } from "hono/cookie";
2
+ import { handleRegistration, handleRefresh, issueChallenge, buildChallengeHeader, CHALLENGE_HEADER, LEGACY_CHALLENGE_HEADER, NoopRateLimiter, emit, DbscProtocolError, DbscVerificationError, } from "@dbsc-toolkit/core";
3
+ const BOUND_COOKIE = "__Host-dbsc-session";
4
+ const REGISTRATION_COOKIE = "__Host-dbsc-reg";
5
+ const CHALLENGE_COOKIE = "__Host-dbsc-challenge";
6
+ const DEFAULT_BOUND_TTL = 10 * 60;
7
+ export function dbsc(opts) {
8
+ const { storage, registrationPath = "/dbsc/registration", refreshPath = "/dbsc/refresh", boundCookieTtl = DEFAULT_BOUND_TTL * 1000, rateLimiter = new NoopRateLimiter(), onEvent, secure = true, } = opts;
9
+ const cookieOpts = {
10
+ httpOnly: true,
11
+ secure,
12
+ sameSite: "lax",
13
+ path: "/",
14
+ };
15
+ return async (c, next) => {
16
+ const url = new URL(c.req.url);
17
+ const ip = c.req.header("x-forwarded-for") ?? "unknown";
18
+ if (c.req.method === "POST" && url.pathname === registrationPath) {
19
+ const sessionId = getCookie(c, REGISTRATION_COOKIE);
20
+ const expectedJti = getCookie(c, CHALLENGE_COOKIE);
21
+ if (!sessionId || !expectedJti) {
22
+ return c.json({ error: "missing session or challenge cookie" }, 400);
23
+ }
24
+ const allowed = await rateLimiter.checkRegistration(ip);
25
+ if (!allowed)
26
+ return c.json({ error: "rate limited" }, 429);
27
+ try {
28
+ const respHdr = c.req.header("secure-session-response") ?? c.req.header("sec-session-response");
29
+ await handleRegistration({
30
+ sessionId,
31
+ secSessionResponseHeader: respHdr,
32
+ expectedJti,
33
+ }, storage);
34
+ emit(onEvent, {
35
+ type: "registration",
36
+ sessionId,
37
+ tier: "dbsc",
38
+ timestamp: Date.now(),
39
+ algorithm: "ES256",
40
+ ip,
41
+ });
42
+ setCookie(c, BOUND_COOKIE, sessionId, {
43
+ ...cookieOpts,
44
+ maxAge: boundCookieTtl / 1000,
45
+ });
46
+ deleteCookie(c, CHALLENGE_COOKIE);
47
+ return c.body(null, 204);
48
+ }
49
+ catch (err) {
50
+ await rateLimiter.recordFailure(ip, sessionId);
51
+ if (err instanceof DbscVerificationError || err instanceof DbscProtocolError) {
52
+ return c.json({ error: err.message }, 400);
53
+ }
54
+ throw err;
55
+ }
56
+ }
57
+ if (c.req.method === "POST" && url.pathname === refreshPath) {
58
+ const sessionId = getCookie(c, BOUND_COOKIE);
59
+ if (!sessionId)
60
+ return c.json({ error: "no session" }, 401);
61
+ const allowed = await rateLimiter.checkRefresh(ip, sessionId);
62
+ if (!allowed)
63
+ return c.json({ error: "rate limited" }, 429);
64
+ const responseHeader = c.req.header("secure-session-response") ?? c.req.header("sec-session-response");
65
+ if (!responseHeader) {
66
+ const challenge = await issueChallenge(sessionId, storage);
67
+ c.header(CHALLENGE_HEADER, buildChallengeHeader(challenge.jti));
68
+ c.header(LEGACY_CHALLENGE_HEADER, buildChallengeHeader(challenge.jti));
69
+ setCookie(c, CHALLENGE_COOKIE, challenge.jti, { ...cookieOpts, maxAge: 5 * 60 });
70
+ return c.body(null, 403);
71
+ }
72
+ const expectedJti = getCookie(c, CHALLENGE_COOKIE);
73
+ if (!expectedJti)
74
+ return c.json({ error: "missing challenge cookie" }, 400);
75
+ try {
76
+ await handleRefresh({ sessionId, secSessionResponseHeader: responseHeader, expectedJti }, storage);
77
+ emit(onEvent, {
78
+ type: "refresh",
79
+ sessionId,
80
+ tier: "dbsc",
81
+ timestamp: Date.now(),
82
+ ip,
83
+ });
84
+ setCookie(c, BOUND_COOKIE, sessionId, { ...cookieOpts, maxAge: boundCookieTtl / 1000 });
85
+ deleteCookie(c, CHALLENGE_COOKIE);
86
+ return c.body(null, 204);
87
+ }
88
+ catch (err) {
89
+ await rateLimiter.recordFailure(ip, sessionId);
90
+ if (err instanceof DbscVerificationError || err instanceof DbscProtocolError) {
91
+ return c.json({ error: err.message }, 401);
92
+ }
93
+ throw err;
94
+ }
95
+ }
96
+ const sessionId = getCookie(c, BOUND_COOKIE) ?? null;
97
+ c.set("dbscSessionId", sessionId);
98
+ c.set("dbscTier", "none");
99
+ if (sessionId) {
100
+ const session = await storage.getSession(sessionId);
101
+ if (session)
102
+ c.set("dbscTier", session.tier);
103
+ }
104
+ await next();
105
+ };
106
+ }
107
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,oBAAoB,EAEpB,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,IAAI,EACJ,iBAAiB,EACjB,qBAAqB,GAGtB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAC3C,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAC9C,MAAM,gBAAgB,GAAG,uBAAuB,CAAC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AC;QAED,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@dbsc-toolkit/server-hono",
3
+ "version": "0.1.0",
4
+ "description": "Hono middleware for DBSC Toolkit",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "@dbsc-toolkit/core": "0.1.0"
16
+ },
17
+ "peerDependencies": {
18
+ "hono": ">=4.0.0"
19
+ },
20
+ "devDependencies": {
21
+ "@types/node": "^20.0.0",
22
+ "hono": "^4.4.0",
23
+ "typescript": "^5.4.0",
24
+ "vitest": "^1.6.0"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md"
29
+ ],
30
+ "license": "Apache-2.0",
31
+ "homepage": "https://github.com/SulimanAbdulrazzaq/dbsc-toolkit#readme",
32
+ "bugs": {
33
+ "url": "https://github.com/SulimanAbdulrazzaq/dbsc-toolkit/issues"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/SulimanAbdulrazzaq/dbsc-toolkit.git",
38
+ "directory": "packages/server-hono"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "keywords": [
44
+ "dbsc",
45
+ "hono",
46
+ "middleware",
47
+ "session",
48
+ "security",
49
+ "auth",
50
+ "bun",
51
+ "deno",
52
+ "workers"
53
+ ],
54
+ "scripts": {
55
+ "build": "tsc -p tsconfig.json",
56
+ "test": "vitest run --passWithNoTests",
57
+ "clean": "rm -rf dist"
58
+ }
59
+ }