dbsc-toolkit 2.7.0 → 2.8.1
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 +202 -132
- package/README.md +5 -3
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/installFetchInterceptor.d.ts +41 -0
- package/dist/client/installFetchInterceptor.d.ts.map +1 -0
- package/dist/client/installFetchInterceptor.js +79 -0
- package/dist/client/installFetchInterceptor.js.map +1 -0
- package/dist/client/wrapFetch.d.ts +7 -1
- package/dist/client/wrapFetch.d.ts.map +1 -1
- package/dist/client/wrapFetch.js +1 -1
- package/dist/client/wrapFetch.js.map +1 -1
- package/dist/core/bound/proof.d.ts +8 -1
- package/dist/core/bound/proof.d.ts.map +1 -1
- package/dist/core/bound/proof.js +15 -1
- package/dist/core/bound/proof.js.map +1 -1
- package/dist/core/bound/refresh.js +1 -1
- package/dist/core/bound/refresh.js.map +1 -1
- package/dist/core/errors.d.ts +3 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +7 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/protect-policy.d.ts +7 -1
- package/dist/core/protect-policy.d.ts.map +1 -1
- package/dist/core/protect-policy.js.map +1 -1
- package/dist/core/protocol/refresh.js +1 -1
- package/dist/core/protocol/refresh.js.map +1 -1
- package/dist/core/replay/interface.d.ts +10 -0
- package/dist/core/replay/interface.d.ts.map +1 -0
- package/dist/core/replay/interface.js +11 -0
- package/dist/core/replay/interface.js.map +1 -0
- package/dist/core/telemetry/polyfill-missing.d.ts +21 -0
- package/dist/core/telemetry/polyfill-missing.d.ts.map +1 -0
- package/dist/core/telemetry/polyfill-missing.js +35 -0
- package/dist/core/telemetry/polyfill-missing.js.map +1 -0
- package/dist/core/types.d.ts +47 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/express/index.d.ts +3 -1
- package/dist/express/index.d.ts.map +1 -1
- package/dist/express/index.js +16 -2
- package/dist/express/index.js.map +1 -1
- package/dist/express/proof.d.ts +8 -1
- package/dist/express/proof.d.ts.map +1 -1
- package/dist/express/proof.js +1 -0
- package/dist/express/proof.js.map +1 -1
- package/dist/express/require-proof.d.ts.map +1 -1
- package/dist/express/require-proof.js +1 -0
- package/dist/express/require-proof.js.map +1 -1
- package/dist/fastify/index.d.ts +2 -1
- package/dist/fastify/index.d.ts.map +1 -1
- package/dist/fastify/index.js +13 -2
- package/dist/fastify/index.js.map +1 -1
- package/dist/fastify/proof.d.ts +3 -1
- package/dist/fastify/proof.d.ts.map +1 -1
- package/dist/fastify/proof.js +1 -0
- package/dist/fastify/proof.js.map +1 -1
- package/dist/fastify/require-proof.d.ts.map +1 -1
- package/dist/fastify/require-proof.js +1 -0
- package/dist/fastify/require-proof.js.map +1 -1
- package/dist/hono/index.d.ts +2 -1
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +13 -2
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/proof.d.ts +3 -1
- package/dist/hono/proof.d.ts.map +1 -1
- package/dist/hono/proof.js +1 -0
- package/dist/hono/proof.js.map +1 -1
- package/dist/hono/require-proof.d.ts.map +1 -1
- package/dist/hono/require-proof.js +1 -0
- package/dist/hono/require-proof.js.map +1 -1
- package/dist/nextjs/create-dbsc.d.ts.map +1 -1
- package/dist/nextjs/create-dbsc.js +5 -1
- package/dist/nextjs/create-dbsc.js.map +1 -1
- package/dist/nextjs/index.d.ts +2 -0
- package/dist/nextjs/index.d.ts.map +1 -1
- package/dist/nextjs/index.js +16 -2
- package/dist/nextjs/index.js.map +1 -1
- package/dist/nextjs/proof.d.ts +3 -1
- package/dist/nextjs/proof.d.ts.map +1 -1
- package/dist/nextjs/proof.js +1 -0
- package/dist/nextjs/proof.js.map +1 -1
- package/dist/nextjs/require-proof.d.ts.map +1 -1
- package/dist/nextjs/require-proof.js +1 -0
- package/dist/nextjs/require-proof.js.map +1 -1
- package/dist/storage/memory/index.d.ts +1 -0
- package/dist/storage/memory/index.d.ts.map +1 -1
- package/dist/storage/memory/index.js +1 -0
- package/dist/storage/memory/index.js.map +1 -1
- package/dist/storage/memory/replay-cache.d.ts +15 -0
- package/dist/storage/memory/replay-cache.d.ts.map +1 -0
- package/dist/storage/memory/replay-cache.js +28 -0
- package/dist/storage/memory/replay-cache.js.map +1 -0
- package/dist/storage/redis/index.d.ts +1 -0
- package/dist/storage/redis/index.d.ts.map +1 -1
- package/dist/storage/redis/index.js +1 -0
- package/dist/storage/redis/index.js.map +1 -1
- package/dist/storage/redis/replay-cache.d.ts +17 -0
- package/dist/storage/redis/replay-cache.d.ts.map +1 -0
- package/dist/storage/redis/replay-cache.js +22 -0
- package/dist/storage/redis/replay-cache.js.map +1 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,132 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
the copyright owner
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
not limited to
|
|
29
|
-
and
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
copyright
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
You
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Suliman Abdulrazzaq
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -140,9 +140,11 @@ After `createDbsc().install()`, every request through the middleware has a `tier
|
|
|
140
140
|
| Your route does… | Use this guard | What it stops |
|
|
141
141
|
|---|---|---|
|
|
142
142
|
| Public / read-only (feed, search, public profile) | Nothing | n/a — no auth gate at all |
|
|
143
|
-
| Anything authenticated (post, comment, upvote, settings, payment, admin) | `requireProof()` (server) + `wrapFetch(
|
|
143
|
+
| Anything authenticated (post, comment, upvote, settings, payment, admin) | `requireProof()` (server) + `wrapFetch()` (client) | A stolen cookie cannot be replayed from another device, cannot ride along during the freshness window, and an MITM cannot substitute a POST body |
|
|
144
144
|
|
|
145
|
-
There is deliberately **no tier-level argument**. A `dbsc`-only gate would lock out every Firefox/Safari user; a `bound`-only check (tier without a per-request proof) is not actually secure. `requireProof()` is the one honest answer — it requires a bound device + a per-request proof and works on every browser
|
|
145
|
+
There is deliberately **no tier-level argument**. A `dbsc`-only gate would lock out every Firefox/Safari user; a `bound`-only check (tier without a per-request proof) is not actually secure. `requireProof()` is the one honest answer — it requires a bound device + a per-request proof and works on every browser. As of v2.7 Chromium sessions also register a polyfill key alongside the TPM key, so the per-request signature is enforced on every tier (not just Firefox/Safari). `wrapFetch` signs the request body by default in v2.8+; a POST guarded route mounts `express.raw()` in front. Apps with many guarded routes can use `installFetchInterceptor({ pathPrefixes: ["/api/secure/"] })` to wrap once at boot instead of per-call.
|
|
146
|
+
|
|
147
|
+
For apps with a stricter threat model (active MITM, log-spillage exposure), v2.8 also adds an optional **replay cache** that rejects a second arrival of the same proof bytes — pass `replayCache: new RedisReplayCache(redis)` to `createDbsc`. See [docs/per-request-signing.md](./docs/per-request-signing.md).
|
|
146
148
|
|
|
147
149
|
The full threat boundary, the per-framework wiring (Fastify / Hono / Next.js), and the migration timeline for an existing app are in [docs/integrating-existing-auth.md](./docs/integrating-existing-auth.md) and [docs/per-request-signing.md](./docs/per-request-signing.md).
|
|
148
150
|
|
|
@@ -181,7 +183,7 @@ There is no third option, and **never gate a route on `tier === "dbsc"`** — th
|
|
|
181
183
|
|
|
182
184
|
- **Concepts and protocol:** [HOW-IT-WORKS.md](./HOW-IT-WORKS.md)
|
|
183
185
|
- **Bound polyfill wire protocol:** [docs/bound-polyfill.md](./docs/bound-polyfill.md)
|
|
184
|
-
- **Per-request signing (
|
|
186
|
+
- **Per-request signing (the v2.7 dual-key story + the v2.8 replay cache):** [docs/per-request-signing.md](./docs/per-request-signing.md)
|
|
185
187
|
- **API reference:** [docs/api-reference.md](./docs/api-reference.md)
|
|
186
188
|
- **Adapters (Express / Fastify / Hono / Next.js + write your own):** [docs/adapters.md](./docs/adapters.md)
|
|
187
189
|
- **Storage (memory / Redis / Postgres):** [docs/storage.md](./docs/storage.md)
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { wrapFetch } from "./wrapFetch.js";
|
|
2
2
|
export type { WrapFetchOptions } from "./wrapFetch.js";
|
|
3
|
+
export { installFetchInterceptor } from "./installFetchInterceptor.js";
|
|
4
|
+
export type { InstallFetchInterceptorOptions } from "./installFetchInterceptor.js";
|
|
3
5
|
/**
|
|
4
6
|
* Clears the bound-key record from IndexedDB. Call this on logout so the next
|
|
5
7
|
* login starts from a clean slate instead of letting the SDK detect a session
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAEnF;;;;GAIG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAMnD;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACvE;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC3E;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,GACpB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAgEtC,wBAAsB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuIjG;AAmBD,wBAAgB,aAAa,IAAI,IAAI,CAKpC"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { clearKeyRecord, getKeyRecord, setKeyRecord } from "./keystore.js";
|
|
2
2
|
import { recordServerTime } from "./clockSync.js";
|
|
3
3
|
export { wrapFetch } from "./wrapFetch.js";
|
|
4
|
+
export { installFetchInterceptor } from "./installFetchInterceptor.js";
|
|
4
5
|
/**
|
|
5
6
|
* Clears the bound-key record from IndexedDB. Call this on logout so the next
|
|
6
7
|
* login starts from a clean slate instead of letting the SDK detect a session
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,cAAc,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACvC,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;QAC1B,YAAY,CAAC,YAAY,CAAC,CAAC;QAC3B,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;AACH,CAAC;AAyFD,MAAM,QAAQ,GAAoB;IAChC,SAAS,EAAE,mBAAmB;IAC9B,aAAa,EAAE,uBAAuB;IACtC,gBAAgB,EAAE,0BAA0B;IAC5C,WAAW,EAAE,qBAAqB;IAClC,mBAAmB,EAAE,IAAI;IACzB,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,IAAI,YAAY,GAAyC,IAAI,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAgC,EAAE;IACpE,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QACtE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC;IAC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ch.js";
|
|
2
|
+
export interface InstallFetchInterceptorOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Path prefixes to intercept. A request whose URL's pathname starts with
|
|
5
|
+
* any of these (on the current origin) is routed through `wrapFetch` —
|
|
6
|
+
* every other request goes through the original `fetch` untouched.
|
|
7
|
+
*
|
|
8
|
+
* Must be non-empty. Bare `"/"` is rejected: it would match every same-origin
|
|
9
|
+
* fetch and sign every static asset / health check; in production code that
|
|
10
|
+
* is almost certainly not what you want. Use an explicit prefix like
|
|
11
|
+
* `"/api/secure/"` or `"/dbsc-guarded/"` instead.
|
|
12
|
+
*
|
|
13
|
+
* Prefixes that look like absolute URLs (`http://`, `https://`) are rejected
|
|
14
|
+
* — the interceptor only touches same-origin requests, by design, so it
|
|
15
|
+
* cannot sign requests to third-party hosts (and leak the session key).
|
|
16
|
+
*/
|
|
17
|
+
pathPrefixes: string[];
|
|
18
|
+
/** Forwarded to `wrapFetch` — defaults to true as of v2.8. */
|
|
19
|
+
signBody?: WrapFetchOptions["signBody"];
|
|
20
|
+
/** Override the header name passed to `wrapFetch`. */
|
|
21
|
+
headerName?: WrapFetchOptions["headerName"];
|
|
22
|
+
/** Override the global fetch — useful in tests. Defaults to `globalThis.fetch`. */
|
|
23
|
+
fetch?: typeof fetch;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Replace `globalThis.fetch` (or the provided `fetch`) with a wrapper that
|
|
27
|
+
* routes matching same-origin requests through `wrapFetch`, and everything
|
|
28
|
+
* else through the original fetch. Returns an `uninstall` function that
|
|
29
|
+
* restores the original.
|
|
30
|
+
*
|
|
31
|
+
* **When to use this:** apps with many guarded routes where calling
|
|
32
|
+
* `wrapFetch` at every call site is a footgun. For small apps, the per-call
|
|
33
|
+
* `wrapFetch(...)` shape stays the recommended default.
|
|
34
|
+
*
|
|
35
|
+
* **Safety:** the interceptor only touches requests whose URL is same-origin
|
|
36
|
+
* and whose pathname matches one of `pathPrefixes`. Third-party hosts are
|
|
37
|
+
* always passed through to the original fetch — the session key never leaves
|
|
38
|
+
* your origin.
|
|
39
|
+
*/
|
|
40
|
+
export declare function installFetchInterceptor(opts: InstallFetchInterceptorOptions): () => void;
|
|
41
|
+
//# sourceMappingURL=installFetchInterceptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installFetchInterceptor.d.ts","sourceRoot":"","sources":["../../src/client/installFetchInterceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,WAAW,8BAA8B;IAC7C;;;;;;;;;;;;;OAaG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,sDAAsD;IACtD,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC5C,mFAAmF;IACnF,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,8BAA8B,GAAG,MAAM,IAAI,CAgDxF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { wrapFetch } from "./wrapFetch.js";
|
|
2
|
+
/**
|
|
3
|
+
* Replace `globalThis.fetch` (or the provided `fetch`) with a wrapper that
|
|
4
|
+
* routes matching same-origin requests through `wrapFetch`, and everything
|
|
5
|
+
* else through the original fetch. Returns an `uninstall` function that
|
|
6
|
+
* restores the original.
|
|
7
|
+
*
|
|
8
|
+
* **When to use this:** apps with many guarded routes where calling
|
|
9
|
+
* `wrapFetch` at every call site is a footgun. For small apps, the per-call
|
|
10
|
+
* `wrapFetch(...)` shape stays the recommended default.
|
|
11
|
+
*
|
|
12
|
+
* **Safety:** the interceptor only touches requests whose URL is same-origin
|
|
13
|
+
* and whose pathname matches one of `pathPrefixes`. Third-party hosts are
|
|
14
|
+
* always passed through to the original fetch — the session key never leaves
|
|
15
|
+
* your origin.
|
|
16
|
+
*/
|
|
17
|
+
export function installFetchInterceptor(opts) {
|
|
18
|
+
if (!opts.pathPrefixes || opts.pathPrefixes.length === 0) {
|
|
19
|
+
throw new Error("installFetchInterceptor: pathPrefixes must be a non-empty array");
|
|
20
|
+
}
|
|
21
|
+
for (const prefix of opts.pathPrefixes) {
|
|
22
|
+
if (typeof prefix !== "string" || prefix.length === 0) {
|
|
23
|
+
throw new Error("installFetchInterceptor: each prefix must be a non-empty string");
|
|
24
|
+
}
|
|
25
|
+
if (prefix === "/") {
|
|
26
|
+
throw new Error("installFetchInterceptor: pathPrefixes cannot include '/' — specify explicit route prefixes (e.g. '/api/secure/') to avoid signing static assets, health checks, or third-party requests");
|
|
27
|
+
}
|
|
28
|
+
if (prefix.startsWith("http://") || prefix.startsWith("https://")) {
|
|
29
|
+
throw new Error("installFetchInterceptor: pathPrefixes must be path-only (e.g. '/api/secure/') — absolute URLs are not allowed; the interceptor never signs cross-origin requests");
|
|
30
|
+
}
|
|
31
|
+
if (!prefix.startsWith("/")) {
|
|
32
|
+
throw new Error("installFetchInterceptor: each prefix must start with '/' (e.g. '/api/secure/')");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Two distinct concepts: the upstream fetch the interceptor delegates to
|
|
36
|
+
// (test-friendly override via opts.fetch), and the fetch that was on
|
|
37
|
+
// globalThis at install time (what we restore on uninstall).
|
|
38
|
+
const upstreamFetch = opts.fetch ?? globalThis.fetch.bind(globalThis);
|
|
39
|
+
const priorGlobalFetch = globalThis.fetch;
|
|
40
|
+
const signed = wrapFetch({
|
|
41
|
+
fetch: upstreamFetch,
|
|
42
|
+
...(opts.signBody !== undefined && { signBody: opts.signBody }),
|
|
43
|
+
...(opts.headerName !== undefined && { headerName: opts.headerName }),
|
|
44
|
+
});
|
|
45
|
+
const interceptor = async (input, init) => {
|
|
46
|
+
const url = resolveUrl(input);
|
|
47
|
+
if (url && isSameOrigin(url) && matchesAnyPrefix(url.pathname, opts.pathPrefixes)) {
|
|
48
|
+
return signed(input, init);
|
|
49
|
+
}
|
|
50
|
+
return upstreamFetch(input, init);
|
|
51
|
+
};
|
|
52
|
+
globalThis.fetch = interceptor;
|
|
53
|
+
return () => {
|
|
54
|
+
globalThis.fetch = priorGlobalFetch;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function resolveUrl(input) {
|
|
58
|
+
try {
|
|
59
|
+
const raw = typeof input === "string" || input instanceof URL ? input.toString() : input.url;
|
|
60
|
+
const base = typeof window !== "undefined" ? window.location.href : "http://localhost";
|
|
61
|
+
return new URL(raw, base);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function isSameOrigin(url) {
|
|
68
|
+
if (typeof window === "undefined")
|
|
69
|
+
return true; // no DOM origin to compare against — assume same
|
|
70
|
+
return url.origin === window.location.origin;
|
|
71
|
+
}
|
|
72
|
+
function matchesAnyPrefix(pathname, prefixes) {
|
|
73
|
+
for (const p of prefixes) {
|
|
74
|
+
if (pathname.startsWith(p))
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=installFetchInterceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installFetchInterceptor.js","sourceRoot":"","sources":["../../src/client/installFetchInterceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,gBAAgB,CAAC;AA0BlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAoC;IAC1E,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACrF,CAAC;IACD,KAAK,MAAM,MAAM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O,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
export interface WrapFetchOptions {
|
|
3
3
|
fetch?: typeof fetch;
|
|
4
4
|
headerName?: string;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* SHA-256 the body into the proof header. **Default `true` as of v2.8** —
|
|
7
|
+
* `requireProof()` on the server always wants a body hash, so signing by
|
|
8
|
+
* default is the safe shape. Pass `false` only if you have a bespoke
|
|
9
|
+
* server-side path that disables body checking. ReadableStream bodies not
|
|
10
|
+
* supported.
|
|
11
|
+
*/
|
|
6
12
|
signBody?: boolean;
|
|
7
13
|
}
|
|
8
14
|
export declare function wrapFetch(opts?: WrapFetchOptions): typeof fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapFetch.d.ts","sourceRoot":"","sources":["../../src/client/wrapFetch.ts"],"names":[],"mappings":"AAEA,uGAAuG;AACvG,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB
|
|
1
|
+
{"version":3,"file":"wrapFetch.d.ts","sourceRoot":"","sources":["../../src/client/wrapFetch.ts"],"names":[],"mappings":"AAEA,uGAAuG;AACvG,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,IAAI,GAAE,gBAAqB,GAAG,OAAO,KAAK,CAwDnE"}
|