@dnsid-ai/transport 0.31.0 → 0.33.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 +2 -0
- package/NOTICE.txt +348 -0
- package/README.md +24 -0
- package/dist/index.cjs +92 -18
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +91 -18
- package/package.json +6 -3
package/LICENSE
CHANGED
package/NOTICE.txt
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
THIRD-PARTY SOFTWARE NOTICES
|
|
2
|
+
dnsid-ts
|
|
3
|
+
Copyright 2026 Known Systems AI, Inc.
|
|
4
|
+
|
|
5
|
+
This SDK includes, in the form it is distributed to users, the
|
|
6
|
+
third-party open-source software components listed below. Each
|
|
7
|
+
component's own copyright notice and license terms are reproduced
|
|
8
|
+
in full beneath its entry, as required by the applicable license.
|
|
9
|
+
|
|
10
|
+
This file lists only components that ship as part of the compiled
|
|
11
|
+
or packaged SDK delivered to users. It does not include
|
|
12
|
+
development-only tooling (test frameworks, linters, build tools) or
|
|
13
|
+
sample/example applications, which are not distributed as part of
|
|
14
|
+
the product.
|
|
15
|
+
|
|
16
|
+
Snapshot date: August 5, 2026
|
|
17
|
+
Scope note: covers dependencies shared across the published
|
|
18
|
+
@dnsid-ai/* packages, plus the package-specific
|
|
19
|
+
dependency used only by the key-aws package (for users who
|
|
20
|
+
choose AWS KMS-based key storage). Development tooling and the
|
|
21
|
+
examples/ sample applications are not included, as they are not
|
|
22
|
+
part of the packages published and distributed to users.
|
|
23
|
+
|
|
24
|
+
===============================================================================
|
|
25
|
+
jose (^6.2.3)
|
|
26
|
+
License: MIT License
|
|
27
|
+
===============================================================================
|
|
28
|
+
The MIT License (MIT)
|
|
29
|
+
|
|
30
|
+
Copyright (c) 2018 Filip Skokan
|
|
31
|
+
|
|
32
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
34
|
+
in the Software without restriction, including without limitation the rights
|
|
35
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
37
|
+
furnished to do so, subject to the following conditions:
|
|
38
|
+
|
|
39
|
+
The above copyright notice and this permission notice shall be included in all
|
|
40
|
+
copies or substantial portions of the Software.
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
+
SOFTWARE.
|
|
49
|
+
|
|
50
|
+
===============================================================================
|
|
51
|
+
undici (^8.9.0)
|
|
52
|
+
License: MIT License
|
|
53
|
+
===============================================================================
|
|
54
|
+
MIT License
|
|
55
|
+
|
|
56
|
+
Copyright (c) Matteo Collina and Undici contributors
|
|
57
|
+
|
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
59
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
60
|
+
in the Software without restriction, including without limitation the rights
|
|
61
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
62
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
63
|
+
furnished to do so, subject to the following conditions:
|
|
64
|
+
|
|
65
|
+
The above copyright notice and this permission notice shall be included in all
|
|
66
|
+
copies or substantial portions of the Software.
|
|
67
|
+
|
|
68
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
69
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
70
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
71
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
72
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
73
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
74
|
+
SOFTWARE.
|
|
75
|
+
|
|
76
|
+
===============================================================================
|
|
77
|
+
uuid (^14.0.1)
|
|
78
|
+
License: MIT License
|
|
79
|
+
===============================================================================
|
|
80
|
+
The MIT License (MIT)
|
|
81
|
+
|
|
82
|
+
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
|
83
|
+
|
|
84
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
85
|
+
|
|
86
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
87
|
+
|
|
88
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
89
|
+
|
|
90
|
+
===============================================================================
|
|
91
|
+
@noble/hashes (^2.2.0)
|
|
92
|
+
License: MIT License
|
|
93
|
+
===============================================================================
|
|
94
|
+
The MIT License (MIT)
|
|
95
|
+
|
|
96
|
+
Copyright (c) 2022 Paul Miller (https://paulmillr.com)
|
|
97
|
+
|
|
98
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
99
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
100
|
+
in the Software without restriction, including without limitation the rights
|
|
101
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
102
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
103
|
+
furnished to do so, subject to the following conditions:
|
|
104
|
+
|
|
105
|
+
The above copyright notice and this permission notice shall be included in
|
|
106
|
+
all copies or substantial portions of the Software.
|
|
107
|
+
|
|
108
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
109
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
110
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
111
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
112
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
113
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
114
|
+
THE SOFTWARE.
|
|
115
|
+
|
|
116
|
+
===============================================================================
|
|
117
|
+
structured-headers (^2.0.3)
|
|
118
|
+
License: MIT License
|
|
119
|
+
===============================================================================
|
|
120
|
+
MIT License
|
|
121
|
+
|
|
122
|
+
Copyright (c) 2018-2025 Evert Pot
|
|
123
|
+
|
|
124
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
125
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
126
|
+
in the Software without restriction, including without limitation the rights
|
|
127
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
128
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
129
|
+
furnished to do so, subject to the following conditions:
|
|
130
|
+
|
|
131
|
+
The above copyright notice and this permission notice shall be included in all
|
|
132
|
+
copies or substantial portions of the Software.
|
|
133
|
+
|
|
134
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
135
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
136
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
137
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
138
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
139
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
140
|
+
SOFTWARE.
|
|
141
|
+
|
|
142
|
+
===============================================================================
|
|
143
|
+
@aws-sdk/client-kms (^3.1092.0)
|
|
144
|
+
License: Apache License 2.0
|
|
145
|
+
===============================================================================
|
|
146
|
+
[Note: Used only by users who choose AWS KMS-based key storage (key-aws package).]
|
|
147
|
+
|
|
148
|
+
Apache License
|
|
149
|
+
Version 2.0, January 2004
|
|
150
|
+
http://www.apache.org/licenses/
|
|
151
|
+
|
|
152
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
153
|
+
|
|
154
|
+
1. Definitions.
|
|
155
|
+
|
|
156
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
157
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
158
|
+
|
|
159
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
160
|
+
the copyright owner that is granting the License.
|
|
161
|
+
|
|
162
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
163
|
+
other entities that control, are controlled by, or are under common
|
|
164
|
+
control with that entity. For the purposes of this definition,
|
|
165
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
166
|
+
direction or management of such entity, whether by contract or
|
|
167
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
168
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
169
|
+
|
|
170
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
171
|
+
exercising permissions granted by this License.
|
|
172
|
+
|
|
173
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
174
|
+
including but not limited to software source code, documentation
|
|
175
|
+
source, and configuration files.
|
|
176
|
+
|
|
177
|
+
"Object" form shall mean any form resulting from mechanical
|
|
178
|
+
transformation or translation of a Source form, including but
|
|
179
|
+
not limited to compiled object code, generated documentation,
|
|
180
|
+
and conversions to other media types.
|
|
181
|
+
|
|
182
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
183
|
+
Object form, made available under the License, as indicated by a
|
|
184
|
+
copyright notice that is included in or attached to the work
|
|
185
|
+
(an example is provided in the Appendix below).
|
|
186
|
+
|
|
187
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
188
|
+
form, that is based on (or derived from) the Work and for which the
|
|
189
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
190
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
191
|
+
of this License, Derivative Works shall not include works that remain
|
|
192
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
193
|
+
the Work and Derivative Works thereof.
|
|
194
|
+
|
|
195
|
+
"Contribution" shall mean any work of authorship, including
|
|
196
|
+
the original version of the Work and any modifications or additions
|
|
197
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
198
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
199
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
200
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
201
|
+
means any form of electronic, verbal, or written communication sent
|
|
202
|
+
to the Licensor or its representatives, including but not limited to
|
|
203
|
+
communication on electronic mailing lists, source code control systems,
|
|
204
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
205
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
206
|
+
excluding communication that is conspicuously marked or otherwise
|
|
207
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
208
|
+
|
|
209
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
210
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
211
|
+
subsequently incorporated within the Work.
|
|
212
|
+
|
|
213
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
214
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
215
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
216
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
217
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
218
|
+
Work and such Derivative Works in Source or Object form.
|
|
219
|
+
|
|
220
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
221
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
222
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
223
|
+
(except as stated in this section) patent license to make, have made,
|
|
224
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
225
|
+
where such license applies only to those patent claims licensable
|
|
226
|
+
by such Contributor that are necessarily infringed by their
|
|
227
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
228
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
229
|
+
institute patent litigation against any entity (including a
|
|
230
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
231
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
232
|
+
or contributory patent infringement, then any patent licenses
|
|
233
|
+
granted to You under this License for that Work shall terminate
|
|
234
|
+
as of the date such litigation is filed.
|
|
235
|
+
|
|
236
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
237
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
238
|
+
modifications, and in Source or Object form, provided that You
|
|
239
|
+
meet the following conditions:
|
|
240
|
+
|
|
241
|
+
(a) You must give any other recipients of the Work or
|
|
242
|
+
Derivative Works a copy of this License; and
|
|
243
|
+
|
|
244
|
+
(b) You must cause any modified files to carry prominent notices
|
|
245
|
+
stating that You changed the files; and
|
|
246
|
+
|
|
247
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
248
|
+
that You distribute, all copyright, patent, trademark, and
|
|
249
|
+
attribution notices from the Source form of the Work,
|
|
250
|
+
excluding those notices that do not pertain to any part of
|
|
251
|
+
the Derivative Works; and
|
|
252
|
+
|
|
253
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
254
|
+
distribution, then any Derivative Works that You distribute must
|
|
255
|
+
include a readable copy of the attribution notices contained
|
|
256
|
+
within such NOTICE file, excluding those notices that do not
|
|
257
|
+
pertain to any part of the Derivative Works, in at least one
|
|
258
|
+
of the following places: within a NOTICE text file distributed
|
|
259
|
+
as part of the Derivative Works; within the Source form or
|
|
260
|
+
documentation, if provided along with the Derivative Works; or,
|
|
261
|
+
within a display generated by the Derivative Works, if and
|
|
262
|
+
wherever such third-party notices normally appear. The contents
|
|
263
|
+
of the NOTICE file are for informational purposes only and
|
|
264
|
+
do not modify the License. You may add Your own attribution
|
|
265
|
+
notices within Derivative Works that You distribute, alongside
|
|
266
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
267
|
+
that such additional attribution notices cannot be construed
|
|
268
|
+
as modifying the License.
|
|
269
|
+
|
|
270
|
+
You may add Your own copyright statement to Your modifications and
|
|
271
|
+
may provide additional or different license terms and conditions
|
|
272
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
273
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
274
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
275
|
+
the conditions stated in this License.
|
|
276
|
+
|
|
277
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
278
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
279
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
280
|
+
this License, without any additional terms or conditions.
|
|
281
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
282
|
+
the terms of any separate license agreement you may have executed
|
|
283
|
+
with Licensor regarding such Contributions.
|
|
284
|
+
|
|
285
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
286
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
287
|
+
except as required for reasonable and customary use in describing the
|
|
288
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
289
|
+
|
|
290
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
291
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
292
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
293
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
294
|
+
implied, including, without limitation, any warranties or conditions
|
|
295
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
296
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
297
|
+
appropriateness of using or redistributing the Work and assume any
|
|
298
|
+
risks associated with Your exercise of permissions under this License.
|
|
299
|
+
|
|
300
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
301
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
302
|
+
unless required by applicable law (such as deliberate and grossly
|
|
303
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
304
|
+
liable to You for damages, including any direct, indirect, special,
|
|
305
|
+
incidental, or consequential damages of any character arising as a
|
|
306
|
+
result of this License or out of the use or inability to use the
|
|
307
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
308
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
309
|
+
other commercial damages or losses), even if such Contributor
|
|
310
|
+
has been advised of the possibility of such damages.
|
|
311
|
+
|
|
312
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
313
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
314
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
315
|
+
or other liability obligations and/or rights consistent with this
|
|
316
|
+
License. However, in accepting such obligations, You may act only
|
|
317
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
318
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
319
|
+
defend, and hold each Contributor harmless for any liability
|
|
320
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
321
|
+
of your accepting any such warranty or additional liability.
|
|
322
|
+
|
|
323
|
+
END OF TERMS AND CONDITIONS
|
|
324
|
+
|
|
325
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
326
|
+
|
|
327
|
+
To apply the Apache License to your work, attach the following
|
|
328
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
329
|
+
replaced with your own identifying information. (Don't include
|
|
330
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
331
|
+
comment syntax for the file format. We also recommend that a
|
|
332
|
+
file or class name and description of purpose be included on the
|
|
333
|
+
same "printed page" as the copyright notice for easier
|
|
334
|
+
identification within third-party archives.
|
|
335
|
+
|
|
336
|
+
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
337
|
+
|
|
338
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
339
|
+
you may not use this file except in compliance with the License.
|
|
340
|
+
You may obtain a copy of the License at
|
|
341
|
+
|
|
342
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
343
|
+
|
|
344
|
+
Unless required by applicable law or agreed to in writing, software
|
|
345
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
346
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
347
|
+
See the License for the specific language governing permissions and
|
|
348
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -37,6 +37,30 @@ const result = await fetchJson('https://agent.example/.well-known/dnsid-status.j
|
|
|
37
37
|
const safeFetch = createSsrfSafeFetch({ dnsServer: process.env.DNSID_DNS_SERVER });
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
## Single-send signed-response transport
|
|
41
|
+
|
|
42
|
+
`createResponseSignatureTransport(config?)` returns the `responseTransport`
|
|
43
|
+
function required by `HttpSignaturesProfile.createSignedFetch` when
|
|
44
|
+
`signing.responseSignature` is present. It accepts a prepared `Request` and returns
|
|
45
|
+
`{ response, peerCert }`. It performs one HTTPS request per call, reuses keep-alive
|
|
46
|
+
connections across calls, never follows redirects or retries, never caches, and
|
|
47
|
+
preserves encoded content bytes without transparent decompression. Request bodies
|
|
48
|
+
are sent with `Content-Length`. The certificate comes from the connection that
|
|
49
|
+
carried the response, so it can satisfy
|
|
50
|
+
`fl=mtls`; the profile still validates its SAN against the expected DNSid agent.
|
|
51
|
+
|
|
52
|
+
The transport honors the request abort signal and has a 30-second ceiling.
|
|
53
|
+
The signed client supplies a shared finite send/read/verification budget and
|
|
54
|
+
bounded content reads (8 MiB). Standalone transport consumers must also bound
|
|
55
|
+
body reads, cancel rejected responses, and not expose unverified content.
|
|
56
|
+
Protocol upgrades and tunnel establishment reject. HTTP errors and ordinary
|
|
57
|
+
redirect responses are returned to the profile for signature verification.
|
|
58
|
+
|
|
59
|
+
Custom DNS and CA settings follow `createDnsidFetch`. Like that function, this
|
|
60
|
+
transport does not filter private addresses: callers must select a trusted target
|
|
61
|
+
or inject a transport with their required network-address policy. It is separate
|
|
62
|
+
from WBA's SSRF-safe discovery transport and does not change that profile.
|
|
63
|
+
|
|
40
64
|
Most Node applications should use this through `@dnsid-ai/sdk/node` or profile defaults.
|
|
41
65
|
|
|
42
66
|
The default resolver queries the DNS servers returned by Node's `dns.getServers()` in order, using UDP with TCP fallback to capture the recursive server's remaining TXT TTL (capped at one day). `dnsServer` can override this list. On failures or empty answers it falls back to Node's native TXT lookup with TTL `0`, disabling identity caching for that result. Node's server list may omit macOS scoped/split-DNS routing, so even positive wire answers are not guaranteed to match the platform resolver in those setups. Neither path validates DNSSEC (`UNKNOWN`); SERVFAIL is a resolution error. `validated`/`required` DNSSEC modes still need an injected validating resolver. Cached verification still re-fetches status unless `verification.statusCheckInterval` is set.
|
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
createDnsResolverFromServer: () => createDnsResolverFromServer,
|
|
35
35
|
createDnsidFetch: () => createDnsidFetch,
|
|
36
36
|
createLookup: () => createLookup,
|
|
37
|
+
createResponseSignatureTransport: () => createResponseSignatureTransport,
|
|
37
38
|
createSsrfSafeFetch: () => createSsrfSafeFetch,
|
|
38
39
|
fetchJson: () => fetchJson,
|
|
39
40
|
formatDnsServer: () => formatDnsServer,
|
|
@@ -97,7 +98,7 @@ async function resolveTxtWithTtl(name, host, port, signal) {
|
|
|
97
98
|
}
|
|
98
99
|
async function query(name, host, port, signal) {
|
|
99
100
|
const id = (0, import_node_crypto.randomInt)(65536);
|
|
100
|
-
const
|
|
101
|
+
const request2 = {
|
|
101
102
|
type: "query",
|
|
102
103
|
id,
|
|
103
104
|
flags: import_dns_packet.default.RECURSION_DESIRED,
|
|
@@ -113,9 +114,9 @@ async function query(name, host, port, signal) {
|
|
|
113
114
|
return null;
|
|
114
115
|
}
|
|
115
116
|
};
|
|
116
|
-
const response = await udp(import_dns_packet.default.encode(
|
|
117
|
+
const response = await udp(import_dns_packet.default.encode(request2), host, port, signal, valid);
|
|
117
118
|
if (!response.flag_tc) return response;
|
|
118
|
-
const tcpResponse = valid(await tcp(import_dns_packet.default.streamEncode(
|
|
119
|
+
const tcpResponse = valid(await tcp(import_dns_packet.default.streamEncode(request2), host, port, signal));
|
|
119
120
|
if (!tcpResponse || tcpResponse.flag_tc) throw badResponse();
|
|
120
121
|
return tcpResponse;
|
|
121
122
|
}
|
|
@@ -178,6 +179,15 @@ function tcp(buf, host, port, signal) {
|
|
|
178
179
|
var DEFAULT_REQUEST_TIMEOUT_MS = 1e4;
|
|
179
180
|
var DEFAULT_MAX_RESPONSE_BYTES = 1 * 1024 * 1024;
|
|
180
181
|
var DNSID_USER_AGENT = "dnsid-ts";
|
|
182
|
+
function httpsTransportError(cause) {
|
|
183
|
+
const err = cause;
|
|
184
|
+
const isTls = err.code === "DEPTH_ZERO_SELF_SIGNED_CERT" || err.code === "CERT_HAS_EXPIRED" || err.code === "ERR_TLS_CERT_ALTNAME_INVALID" || err.code === "UNABLE_TO_VERIFY_LEAF_SIGNATURE";
|
|
185
|
+
return new import_protocol2.VerificationError(`HTTPS fetch failed: ${err.message}`, {
|
|
186
|
+
code: import_protocol2.VerificationCode.TLSError,
|
|
187
|
+
transient: !isTls,
|
|
188
|
+
cause
|
|
189
|
+
});
|
|
190
|
+
}
|
|
181
191
|
function createDnsidFetch(config) {
|
|
182
192
|
if (!config.dnsServer && !config.caBundlePath) {
|
|
183
193
|
return globalThis.fetch.bind(globalThis);
|
|
@@ -187,6 +197,76 @@ function createDnsidFetch(config) {
|
|
|
187
197
|
if (config.caBundlePath) connect2.ca = [...tls.rootCertificates, fs.readFileSync(config.caBundlePath, "utf8")];
|
|
188
198
|
return createFetchWithDispatcher(new import_undici.Agent({ connect: connect2 }));
|
|
189
199
|
}
|
|
200
|
+
function createResponseSignatureTransport(config = {}) {
|
|
201
|
+
const lookup2 = config.dnsServer ? createLookup(config.dnsServer) : void 0;
|
|
202
|
+
const ca = config.caBundlePath ? [...tls.rootCertificates, fs.readFileSync(config.caBundlePath, "utf8")] : void 0;
|
|
203
|
+
const agent = new https.Agent({ keepAlive: true, lookup: lookup2, ca, rejectUnauthorized: true });
|
|
204
|
+
return async (request2) => {
|
|
205
|
+
const url = new URL(request2.url);
|
|
206
|
+
if (url.protocol !== "https:") throw new import_protocol2.ArgumentError("response authentication requires HTTPS");
|
|
207
|
+
const signal = AbortSignal.any([request2.signal, AbortSignal.timeout(DEFAULT_REQUEST_TIMEOUT_MS * 3)]);
|
|
208
|
+
const content = request2.body ? Buffer.from(await request2.arrayBuffer()) : null;
|
|
209
|
+
const headers = Object.fromEntries(request2.headers);
|
|
210
|
+
if (content) headers["content-length"] = String(content.length);
|
|
211
|
+
return new Promise((resolve, reject) => {
|
|
212
|
+
const outgoing = https.request(url, {
|
|
213
|
+
agent,
|
|
214
|
+
signal,
|
|
215
|
+
method: request2.method,
|
|
216
|
+
headers
|
|
217
|
+
}, (incoming) => {
|
|
218
|
+
const cert = incoming.socket.getPeerCertificate();
|
|
219
|
+
const peerCert = {
|
|
220
|
+
notAfter: new Date(cert.valid_to),
|
|
221
|
+
san: (cert.subjectaltname ?? "").split(", ").filter((s) => s.startsWith("DNS:")).map((s) => s.slice(4))
|
|
222
|
+
};
|
|
223
|
+
const headers2 = new Headers();
|
|
224
|
+
for (let i = 0; i < incoming.rawHeaders.length; i += 2) headers2.append(incoming.rawHeaders[i], incoming.rawHeaders[i + 1]);
|
|
225
|
+
const status = incoming.statusCode;
|
|
226
|
+
if (status < 200 || status > 599) {
|
|
227
|
+
incoming.destroy();
|
|
228
|
+
reject(new import_protocol2.VerificationError("not a final HTTP response", { code: import_protocol2.VerificationCode.SignatureInvalid }));
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const noBody = request2.method === "HEAD" || [204, 205, 304].includes(status);
|
|
232
|
+
const iterator = incoming[Symbol.asyncIterator]();
|
|
233
|
+
let canceled = false;
|
|
234
|
+
incoming.on("error", () => {
|
|
235
|
+
});
|
|
236
|
+
const body = noBody ? null : new ReadableStream({
|
|
237
|
+
async pull(controller) {
|
|
238
|
+
try {
|
|
239
|
+
const { value, done } = await iterator.next();
|
|
240
|
+
if (canceled) return;
|
|
241
|
+
if (done) controller.close();
|
|
242
|
+
else controller.enqueue(new Uint8Array(value));
|
|
243
|
+
} catch (error) {
|
|
244
|
+
if (!canceled) controller.error(error);
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
cancel() {
|
|
248
|
+
canceled = true;
|
|
249
|
+
incoming.destroy();
|
|
250
|
+
outgoing.destroy();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
if (noBody) incoming.resume();
|
|
254
|
+
resolve({ response: new Response(body, { status, statusText: incoming.statusMessage, headers: headers2 }), peerCert });
|
|
255
|
+
});
|
|
256
|
+
const fail = (cause) => reject(cause instanceof import_protocol2.VerificationError ? cause : httpsTransportError(cause));
|
|
257
|
+
outgoing.on("error", fail);
|
|
258
|
+
outgoing.on("upgrade", (_response, socket) => {
|
|
259
|
+
socket.destroy();
|
|
260
|
+
fail(new import_protocol2.VerificationError("protocol upgrades are unsupported", { code: import_protocol2.VerificationCode.SignatureInvalid }));
|
|
261
|
+
});
|
|
262
|
+
outgoing.on("connect", (_response, socket) => {
|
|
263
|
+
socket.destroy();
|
|
264
|
+
fail(new import_protocol2.VerificationError("tunnels are unsupported", { code: import_protocol2.VerificationCode.SignatureInvalid }));
|
|
265
|
+
});
|
|
266
|
+
outgoing.end(content ?? void 0);
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
}
|
|
190
270
|
function createSsrfSafeFetch(config = {}, options = {}) {
|
|
191
271
|
const privateAddressHosts = (options.privateAddressHosts ?? []).map(import_protocol2.normalizePrivateAddressHost);
|
|
192
272
|
const connect2 = { lookup: createSsrfSafeLookup(config.dnsServer, privateAddressHosts) };
|
|
@@ -202,21 +282,21 @@ function createSsrfSafeFetch(config = {}, options = {}) {
|
|
|
202
282
|
}
|
|
203
283
|
if (options.decompress === false) {
|
|
204
284
|
const { url: target, init: normalized } = normalizeFetchArgs(input, { ...init, redirect: "manual" });
|
|
205
|
-
const
|
|
206
|
-
const targetUrl = new URL(
|
|
285
|
+
const request2 = new Request(target, normalized);
|
|
286
|
+
const targetUrl = new URL(request2.url);
|
|
207
287
|
const response = await dispatcher.request({
|
|
208
288
|
origin: targetUrl.origin,
|
|
209
289
|
path: targetUrl.pathname + targetUrl.search,
|
|
210
|
-
method:
|
|
211
|
-
headers: Object.fromEntries(
|
|
212
|
-
body:
|
|
213
|
-
signal:
|
|
290
|
+
method: request2.method,
|
|
291
|
+
headers: Object.fromEntries(request2.headers),
|
|
292
|
+
body: request2.body ? import_node_stream.Readable.fromWeb(request2.body) : void 0,
|
|
293
|
+
signal: request2.signal
|
|
214
294
|
});
|
|
215
295
|
const headers = new Headers();
|
|
216
296
|
for (const [name, value] of Object.entries(response.headers)) {
|
|
217
297
|
for (const item of Array.isArray(value) ? value : value === void 0 ? [] : [value]) headers.append(name, item);
|
|
218
298
|
}
|
|
219
|
-
const noBody =
|
|
299
|
+
const noBody = request2.method === "HEAD" || [204, 205, 304].includes(response.statusCode);
|
|
220
300
|
let body = null;
|
|
221
301
|
if (noBody) await response.body.dump();
|
|
222
302
|
else {
|
|
@@ -646,14 +726,7 @@ function fetchWithRedirects(url, opts, depth) {
|
|
|
646
726
|
transient: true
|
|
647
727
|
}));
|
|
648
728
|
});
|
|
649
|
-
req.on("error", (err) =>
|
|
650
|
-
const nodeErr = err;
|
|
651
|
-
const isTls = nodeErr.code === "DEPTH_ZERO_SELF_SIGNED_CERT" || nodeErr.code === "CERT_HAS_EXPIRED" || nodeErr.code === "ERR_TLS_CERT_ALTNAME_INVALID" || nodeErr.code === "UNABLE_TO_VERIFY_LEAF_SIGNATURE";
|
|
652
|
-
reject(new import_protocol2.VerificationError(`HTTPS fetch failed: ${err.message}`, {
|
|
653
|
-
code: import_protocol2.VerificationCode.TLSError,
|
|
654
|
-
transient: !isTls
|
|
655
|
-
}));
|
|
656
|
-
});
|
|
729
|
+
req.on("error", (err) => reject(httpsTransportError(err)));
|
|
657
730
|
});
|
|
658
731
|
}
|
|
659
732
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -662,6 +735,7 @@ function fetchWithRedirects(url, opts, depth) {
|
|
|
662
735
|
createDnsResolverFromServer,
|
|
663
736
|
createDnsidFetch,
|
|
664
737
|
createLookup,
|
|
738
|
+
createResponseSignatureTransport,
|
|
665
739
|
createSsrfSafeFetch,
|
|
666
740
|
fetchJson,
|
|
667
741
|
formatDnsServer,
|
package/dist/index.d.cts
CHANGED
|
@@ -70,6 +70,19 @@ interface SsrfSafeFetchOptions {
|
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
72
|
declare function createDnsidFetch(config: TransportConfig): FetchLike;
|
|
73
|
+
/**
|
|
74
|
+
* Creates the single-send transport consumed by HTTP signatures' responseTransport option.
|
|
75
|
+
* Sends HTTPS once per call, without redirects, retries, caches, or content decoding, and
|
|
76
|
+
* reuses keep-alive connections across calls. Returns the certificate of the connection
|
|
77
|
+
* that carried this response. Request bodies are buffered and sent with Content-Length.
|
|
78
|
+
* The signed client bounds body reads to 8 MiB; standalone consumers must also bound reads
|
|
79
|
+
* and cancel rejected responses. DNS and additional CA settings follow createDnsidFetch;
|
|
80
|
+
* private addresses are not filtered and proxy environment variables are not used.
|
|
81
|
+
*/
|
|
82
|
+
declare function createResponseSignatureTransport(config?: TransportConfig): (request: Request) => Promise<{
|
|
83
|
+
response: Response;
|
|
84
|
+
peerCert: TLSCertificate;
|
|
85
|
+
}>;
|
|
73
86
|
/**
|
|
74
87
|
* Creates a fetch function that rejects connections to private, loopback,
|
|
75
88
|
* link-local, and other non-routable addresses (SSRF protection).
|
|
@@ -157,4 +170,4 @@ declare function createLookup(dnsServer: string): NonNullable<https.RequestOptio
|
|
|
157
170
|
*/
|
|
158
171
|
declare function isUnsafeIp(address: string): boolean;
|
|
159
172
|
|
|
160
|
-
export { type FetchLike, type FetchResult, type HTTPSFetchOptions, type SsrfSafeFetchOptions, createDefaultDnsResolver, createDnsResolverFromServer, createDnsidFetch, createLookup, createSsrfSafeFetch, fetchJson, formatDnsServer, isUnsafeIp, parseDnsServer };
|
|
173
|
+
export { type FetchLike, type FetchResult, type HTTPSFetchOptions, type SsrfSafeFetchOptions, createDefaultDnsResolver, createDnsResolverFromServer, createDnsidFetch, createLookup, createResponseSignatureTransport, createSsrfSafeFetch, fetchJson, formatDnsServer, isUnsafeIp, parseDnsServer };
|
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,19 @@ interface SsrfSafeFetchOptions {
|
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
72
|
declare function createDnsidFetch(config: TransportConfig): FetchLike;
|
|
73
|
+
/**
|
|
74
|
+
* Creates the single-send transport consumed by HTTP signatures' responseTransport option.
|
|
75
|
+
* Sends HTTPS once per call, without redirects, retries, caches, or content decoding, and
|
|
76
|
+
* reuses keep-alive connections across calls. Returns the certificate of the connection
|
|
77
|
+
* that carried this response. Request bodies are buffered and sent with Content-Length.
|
|
78
|
+
* The signed client bounds body reads to 8 MiB; standalone consumers must also bound reads
|
|
79
|
+
* and cancel rejected responses. DNS and additional CA settings follow createDnsidFetch;
|
|
80
|
+
* private addresses are not filtered and proxy environment variables are not used.
|
|
81
|
+
*/
|
|
82
|
+
declare function createResponseSignatureTransport(config?: TransportConfig): (request: Request) => Promise<{
|
|
83
|
+
response: Response;
|
|
84
|
+
peerCert: TLSCertificate;
|
|
85
|
+
}>;
|
|
73
86
|
/**
|
|
74
87
|
* Creates a fetch function that rejects connections to private, loopback,
|
|
75
88
|
* link-local, and other non-routable addresses (SSRF protection).
|
|
@@ -157,4 +170,4 @@ declare function createLookup(dnsServer: string): NonNullable<https.RequestOptio
|
|
|
157
170
|
*/
|
|
158
171
|
declare function isUnsafeIp(address: string): boolean;
|
|
159
172
|
|
|
160
|
-
export { type FetchLike, type FetchResult, type HTTPSFetchOptions, type SsrfSafeFetchOptions, createDefaultDnsResolver, createDnsResolverFromServer, createDnsidFetch, createLookup, createSsrfSafeFetch, fetchJson, formatDnsServer, isUnsafeIp, parseDnsServer };
|
|
173
|
+
export { type FetchLike, type FetchResult, type HTTPSFetchOptions, type SsrfSafeFetchOptions, createDefaultDnsResolver, createDnsResolverFromServer, createDnsidFetch, createLookup, createResponseSignatureTransport, createSsrfSafeFetch, fetchJson, formatDnsServer, isUnsafeIp, parseDnsServer };
|
package/dist/index.js
CHANGED
|
@@ -55,7 +55,7 @@ async function resolveTxtWithTtl(name, host, port, signal) {
|
|
|
55
55
|
}
|
|
56
56
|
async function query(name, host, port, signal) {
|
|
57
57
|
const id = randomInt(65536);
|
|
58
|
-
const
|
|
58
|
+
const request2 = {
|
|
59
59
|
type: "query",
|
|
60
60
|
id,
|
|
61
61
|
flags: packet.RECURSION_DESIRED,
|
|
@@ -71,9 +71,9 @@ async function query(name, host, port, signal) {
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
const response = await udp(packet.encode(
|
|
74
|
+
const response = await udp(packet.encode(request2), host, port, signal, valid);
|
|
75
75
|
if (!response.flag_tc) return response;
|
|
76
|
-
const tcpResponse = valid(await tcp(packet.streamEncode(
|
|
76
|
+
const tcpResponse = valid(await tcp(packet.streamEncode(request2), host, port, signal));
|
|
77
77
|
if (!tcpResponse || tcpResponse.flag_tc) throw badResponse();
|
|
78
78
|
return tcpResponse;
|
|
79
79
|
}
|
|
@@ -136,6 +136,15 @@ function tcp(buf, host, port, signal) {
|
|
|
136
136
|
var DEFAULT_REQUEST_TIMEOUT_MS = 1e4;
|
|
137
137
|
var DEFAULT_MAX_RESPONSE_BYTES = 1 * 1024 * 1024;
|
|
138
138
|
var DNSID_USER_AGENT = "dnsid-ts";
|
|
139
|
+
function httpsTransportError(cause) {
|
|
140
|
+
const err = cause;
|
|
141
|
+
const isTls = err.code === "DEPTH_ZERO_SELF_SIGNED_CERT" || err.code === "CERT_HAS_EXPIRED" || err.code === "ERR_TLS_CERT_ALTNAME_INVALID" || err.code === "UNABLE_TO_VERIFY_LEAF_SIGNATURE";
|
|
142
|
+
return new VerificationError(`HTTPS fetch failed: ${err.message}`, {
|
|
143
|
+
code: VerificationCode.TLSError,
|
|
144
|
+
transient: !isTls,
|
|
145
|
+
cause
|
|
146
|
+
});
|
|
147
|
+
}
|
|
139
148
|
function createDnsidFetch(config) {
|
|
140
149
|
if (!config.dnsServer && !config.caBundlePath) {
|
|
141
150
|
return globalThis.fetch.bind(globalThis);
|
|
@@ -145,6 +154,76 @@ function createDnsidFetch(config) {
|
|
|
145
154
|
if (config.caBundlePath) connect2.ca = [...tls.rootCertificates, fs.readFileSync(config.caBundlePath, "utf8")];
|
|
146
155
|
return createFetchWithDispatcher(new Agent2({ connect: connect2 }));
|
|
147
156
|
}
|
|
157
|
+
function createResponseSignatureTransport(config = {}) {
|
|
158
|
+
const lookup2 = config.dnsServer ? createLookup(config.dnsServer) : void 0;
|
|
159
|
+
const ca = config.caBundlePath ? [...tls.rootCertificates, fs.readFileSync(config.caBundlePath, "utf8")] : void 0;
|
|
160
|
+
const agent = new https.Agent({ keepAlive: true, lookup: lookup2, ca, rejectUnauthorized: true });
|
|
161
|
+
return async (request2) => {
|
|
162
|
+
const url = new URL(request2.url);
|
|
163
|
+
if (url.protocol !== "https:") throw new ArgumentError("response authentication requires HTTPS");
|
|
164
|
+
const signal = AbortSignal.any([request2.signal, AbortSignal.timeout(DEFAULT_REQUEST_TIMEOUT_MS * 3)]);
|
|
165
|
+
const content = request2.body ? Buffer.from(await request2.arrayBuffer()) : null;
|
|
166
|
+
const headers = Object.fromEntries(request2.headers);
|
|
167
|
+
if (content) headers["content-length"] = String(content.length);
|
|
168
|
+
return new Promise((resolve, reject) => {
|
|
169
|
+
const outgoing = https.request(url, {
|
|
170
|
+
agent,
|
|
171
|
+
signal,
|
|
172
|
+
method: request2.method,
|
|
173
|
+
headers
|
|
174
|
+
}, (incoming) => {
|
|
175
|
+
const cert = incoming.socket.getPeerCertificate();
|
|
176
|
+
const peerCert = {
|
|
177
|
+
notAfter: new Date(cert.valid_to),
|
|
178
|
+
san: (cert.subjectaltname ?? "").split(", ").filter((s) => s.startsWith("DNS:")).map((s) => s.slice(4))
|
|
179
|
+
};
|
|
180
|
+
const headers2 = new Headers();
|
|
181
|
+
for (let i = 0; i < incoming.rawHeaders.length; i += 2) headers2.append(incoming.rawHeaders[i], incoming.rawHeaders[i + 1]);
|
|
182
|
+
const status = incoming.statusCode;
|
|
183
|
+
if (status < 200 || status > 599) {
|
|
184
|
+
incoming.destroy();
|
|
185
|
+
reject(new VerificationError("not a final HTTP response", { code: VerificationCode.SignatureInvalid }));
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const noBody = request2.method === "HEAD" || [204, 205, 304].includes(status);
|
|
189
|
+
const iterator = incoming[Symbol.asyncIterator]();
|
|
190
|
+
let canceled = false;
|
|
191
|
+
incoming.on("error", () => {
|
|
192
|
+
});
|
|
193
|
+
const body = noBody ? null : new ReadableStream({
|
|
194
|
+
async pull(controller) {
|
|
195
|
+
try {
|
|
196
|
+
const { value, done } = await iterator.next();
|
|
197
|
+
if (canceled) return;
|
|
198
|
+
if (done) controller.close();
|
|
199
|
+
else controller.enqueue(new Uint8Array(value));
|
|
200
|
+
} catch (error) {
|
|
201
|
+
if (!canceled) controller.error(error);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
cancel() {
|
|
205
|
+
canceled = true;
|
|
206
|
+
incoming.destroy();
|
|
207
|
+
outgoing.destroy();
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
if (noBody) incoming.resume();
|
|
211
|
+
resolve({ response: new Response(body, { status, statusText: incoming.statusMessage, headers: headers2 }), peerCert });
|
|
212
|
+
});
|
|
213
|
+
const fail = (cause) => reject(cause instanceof VerificationError ? cause : httpsTransportError(cause));
|
|
214
|
+
outgoing.on("error", fail);
|
|
215
|
+
outgoing.on("upgrade", (_response, socket) => {
|
|
216
|
+
socket.destroy();
|
|
217
|
+
fail(new VerificationError("protocol upgrades are unsupported", { code: VerificationCode.SignatureInvalid }));
|
|
218
|
+
});
|
|
219
|
+
outgoing.on("connect", (_response, socket) => {
|
|
220
|
+
socket.destroy();
|
|
221
|
+
fail(new VerificationError("tunnels are unsupported", { code: VerificationCode.SignatureInvalid }));
|
|
222
|
+
});
|
|
223
|
+
outgoing.end(content ?? void 0);
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
}
|
|
148
227
|
function createSsrfSafeFetch(config = {}, options = {}) {
|
|
149
228
|
const privateAddressHosts = (options.privateAddressHosts ?? []).map(normalizePrivateAddressHost);
|
|
150
229
|
const connect2 = { lookup: createSsrfSafeLookup(config.dnsServer, privateAddressHosts) };
|
|
@@ -160,21 +239,21 @@ function createSsrfSafeFetch(config = {}, options = {}) {
|
|
|
160
239
|
}
|
|
161
240
|
if (options.decompress === false) {
|
|
162
241
|
const { url: target, init: normalized } = normalizeFetchArgs(input, { ...init, redirect: "manual" });
|
|
163
|
-
const
|
|
164
|
-
const targetUrl = new URL(
|
|
242
|
+
const request2 = new Request(target, normalized);
|
|
243
|
+
const targetUrl = new URL(request2.url);
|
|
165
244
|
const response = await dispatcher.request({
|
|
166
245
|
origin: targetUrl.origin,
|
|
167
246
|
path: targetUrl.pathname + targetUrl.search,
|
|
168
|
-
method:
|
|
169
|
-
headers: Object.fromEntries(
|
|
170
|
-
body:
|
|
171
|
-
signal:
|
|
247
|
+
method: request2.method,
|
|
248
|
+
headers: Object.fromEntries(request2.headers),
|
|
249
|
+
body: request2.body ? Readable.fromWeb(request2.body) : void 0,
|
|
250
|
+
signal: request2.signal
|
|
172
251
|
});
|
|
173
252
|
const headers = new Headers();
|
|
174
253
|
for (const [name, value] of Object.entries(response.headers)) {
|
|
175
254
|
for (const item of Array.isArray(value) ? value : value === void 0 ? [] : [value]) headers.append(name, item);
|
|
176
255
|
}
|
|
177
|
-
const noBody =
|
|
256
|
+
const noBody = request2.method === "HEAD" || [204, 205, 304].includes(response.statusCode);
|
|
178
257
|
let body = null;
|
|
179
258
|
if (noBody) await response.body.dump();
|
|
180
259
|
else {
|
|
@@ -604,14 +683,7 @@ function fetchWithRedirects(url, opts, depth) {
|
|
|
604
683
|
transient: true
|
|
605
684
|
}));
|
|
606
685
|
});
|
|
607
|
-
req.on("error", (err) =>
|
|
608
|
-
const nodeErr = err;
|
|
609
|
-
const isTls = nodeErr.code === "DEPTH_ZERO_SELF_SIGNED_CERT" || nodeErr.code === "CERT_HAS_EXPIRED" || nodeErr.code === "ERR_TLS_CERT_ALTNAME_INVALID" || nodeErr.code === "UNABLE_TO_VERIFY_LEAF_SIGNATURE";
|
|
610
|
-
reject(new VerificationError(`HTTPS fetch failed: ${err.message}`, {
|
|
611
|
-
code: VerificationCode.TLSError,
|
|
612
|
-
transient: !isTls
|
|
613
|
-
}));
|
|
614
|
-
});
|
|
686
|
+
req.on("error", (err) => reject(httpsTransportError(err)));
|
|
615
687
|
});
|
|
616
688
|
}
|
|
617
689
|
export {
|
|
@@ -619,6 +691,7 @@ export {
|
|
|
619
691
|
createDnsResolverFromServer,
|
|
620
692
|
createDnsidFetch,
|
|
621
693
|
createLookup,
|
|
694
|
+
createResponseSignatureTransport,
|
|
622
695
|
createSsrfSafeFetch,
|
|
623
696
|
fetchJson,
|
|
624
697
|
formatDnsServer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnsid-ai/transport",
|
|
3
|
-
"
|
|
3
|
+
"author": "Known Systems AI, Inc.",
|
|
4
|
+
"version": "0.33.0",
|
|
4
5
|
"description": "Node.js DNS and HTTPS transport implementations for DNSid.",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"types": "./dist/index.d.ts",
|
|
@@ -12,7 +13,8 @@
|
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"NOTICE.txt"
|
|
16
18
|
],
|
|
17
19
|
"engines": {
|
|
18
20
|
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
@@ -34,11 +36,12 @@
|
|
|
34
36
|
"node"
|
|
35
37
|
],
|
|
36
38
|
"scripts": {
|
|
39
|
+
"prepack": "node ../../scripts/copy-notice.mjs",
|
|
37
40
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
38
41
|
"typecheck": "tsc --noEmit"
|
|
39
42
|
},
|
|
40
43
|
"dependencies": {
|
|
41
|
-
"@dnsid-ai/protocol": "^0.
|
|
44
|
+
"@dnsid-ai/protocol": "^0.33.0",
|
|
42
45
|
"dns-packet": "5.6.1",
|
|
43
46
|
"undici": "^8.12.3"
|
|
44
47
|
},
|