@atproto/aws 0.0.0-spaces-alpha-20260818163953

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/CHANGELOG.md ADDED
@@ -0,0 +1,503 @@
1
+ # @atproto/aws
2
+
3
+ ## 0.0.0-spaces-alpha-20260818163953
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`2f77206`](https://github.com/bluesky-social/atproto/commit/2f77206ff8010710db5733c454abff9eb5ebb96b), [`5db8f3d`](https://github.com/bluesky-social/atproto/commit/5db8f3db807b1a37793b86521e833a843ada0b15)]:
8
+ - @atproto/common@0.0.0-spaces-alpha-20260818163953
9
+ - @atproto/crypto@0.0.0-spaces-alpha-20260818163953
10
+ - @atproto/repo@0.0.0-spaces-alpha-20260818163953
11
+ - @atproto/common-web@0.0.0-spaces-alpha-20260818163953
12
+
13
+ ## 0.3.12
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`b66870d`](https://github.com/bluesky-social/atproto/commit/b66870d5a1efbcfa0cc07498c7cfcf3f0f243e86), [`b66870d`](https://github.com/bluesky-social/atproto/commit/b66870d5a1efbcfa0cc07498c7cfcf3f0f243e86)]:
18
+ - @atproto/common@0.7.6
19
+ - @atproto/repo@0.10.10
20
+
21
+ ## 0.3.11
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies []:
26
+ - @atproto/common-web@0.5.9
27
+ - @atproto/repo@0.10.9
28
+ - @atproto/common@0.7.5
29
+
30
+ ## 0.3.10
31
+
32
+ ### Patch Changes
33
+
34
+ - [#5295](https://github.com/bluesky-social/atproto/pull/5295) [`6a3d607`](https://github.com/bluesky-social/atproto/commit/6a3d6073cb66c527b5b109242049c85c36b9658c) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update vitest dependencies
35
+
36
+ - [#5294](https://github.com/bluesky-social/atproto/pull/5294) [`5782f19`](https://github.com/bluesky-social/atproto/commit/5782f195e834b5af80e5bcc163c4247893b95e0a) Thanks [@devinivy](https://github.com/devinivy)! - Revert aws sdk upgrade to 3.1073 and @smithy/core pin, restoring the 3.879 sdk with prior request timeout behavior
37
+
38
+ - Updated dependencies []:
39
+ - @atproto/common@0.7.4
40
+ - @atproto/repo@0.10.8
41
+ - @atproto/common-web@0.5.8
42
+
43
+ ## 0.3.9
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies []:
48
+ - @atproto/common@0.7.3
49
+ - @atproto/repo@0.10.7
50
+ - @atproto/common-web@0.5.7
51
+
52
+ ## 0.3.8
53
+
54
+ ### Patch Changes
55
+
56
+ - [#5247](https://github.com/bluesky-social/atproto/pull/5247) [`0af78cf`](https://github.com/bluesky-social/atproto/commit/0af78cf2b15a2b541f0f1889178ae64086d982f3) Thanks [@jcalabro](https://github.com/jcalabro)! - Pin `@smithy/core` to `>=3.29.5` to fix an outbound S3/R2 socket leak. Earlier versions did not destroy the underlying stream's socket when a `getObject` download was aborted mid-transfer (`ChecksumStream` swallowed the premature close), so `S3BlobStore` blob downloads that clients cancelled leaked sockets and file descriptors until the host exhausted TCP memory. `@smithy/core` 3.29.5 (smithy-typescript#2152) destroys the source and removes its listeners on premature closure.
57
+
58
+ ## 0.3.7
59
+
60
+ ### Patch Changes
61
+
62
+ - [#5233](https://github.com/bluesky-social/atproto/pull/5233) [`692ec0b`](https://github.com/bluesky-social/atproto/commit/692ec0bf7202227f26298ebe98ff25e46b1bd4bc) Thanks [@devinivy](https://github.com/devinivy)! - Upgrade `@aws-sdk/*` dependencies (^3.879.0 to ^3.1073.0). `S3BlobStore` now passes its stall detection timeout (`requestTimeoutMs`) to the request handler's `socketTimeout` option: the upgraded SDK redefined `requestTimeout` from a socket idle timeout to a warn-only total request timer, so stalled S3 connections continue to be reaped and retried as intended.
63
+
64
+ ## 0.3.6
65
+
66
+ ### Patch Changes
67
+
68
+ - Updated dependencies []:
69
+ - @atproto/common-web@0.5.6
70
+ - @atproto/repo@0.10.6
71
+ - @atproto/common@0.7.2
72
+
73
+ ## 0.3.5
74
+
75
+ ### Patch Changes
76
+
77
+ - [#5181](https://github.com/bluesky-social/atproto/pull/5181) [`bd0d2ce`](https://github.com/bluesky-social/atproto/commit/bd0d2cea00e6739cb9efc0f80a808ee76bd7b112) Thanks [@blackmichael](https://github.com/blackmichael)! - `S3BlobStore`: decouple the per-request stall detection timeout (`requestTimeoutMs`, a socket idle timeout) from the total upload budget (`uploadTimeoutMs`). `requestTimeoutMs` now defaults to `min(uploadTimeoutMs, 15s)` (clamped to a minimum of 6s) instead of `uploadTimeoutMs`, so that stalled S3 connections are reaped and retried quickly even when a large upload timeout is configured. The 6s floor keeps the socket idle timeout from applying to blob downloads streamed to slow (client-paced) consumers. Also adds a `connectionTimeoutMs` option (default 5s), and translates stalled-connection `TimeoutError`s into the same "Blob upload timed out" error as upload timeouts.
78
+
79
+ - [#5197](https://github.com/bluesky-social/atproto/pull/5197) [`a0c49d9`](https://github.com/bluesky-social/atproto/commit/a0c49d9e8bc685c5a747a8d3b2775c73c63fdb6f) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Rewrite import statements to be compatible with TypeScript's `verbatimModuleSyntax` config.
80
+
81
+ - Updated dependencies [[`a0c49d9`](https://github.com/bluesky-social/atproto/commit/a0c49d9e8bc685c5a747a8d3b2775c73c63fdb6f)]:
82
+ - @atproto/common-web@0.5.5
83
+ - @atproto/common@0.7.1
84
+ - @atproto/crypto@0.5.4
85
+ - @atproto/repo@0.10.5
86
+
87
+ ## 0.3.4
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [[`d1be0ce`](https://github.com/bluesky-social/atproto/commit/d1be0cead444ef95e64cac5ea5318edbec9d8112)]:
92
+ - @atproto/common@0.7.0
93
+ - @atproto/common-web@0.5.4
94
+ - @atproto/repo@0.10.4
95
+
96
+ ## 0.3.3
97
+
98
+ ### Patch Changes
99
+
100
+ - [#5099](https://github.com/bluesky-social/atproto/pull/5099) [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update TypeScript build to rely on references to composite internal projects
101
+
102
+ - [#5099](https://github.com/bluesky-social/atproto/pull/5099) [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Bundle only necessary files in the NPM tarball, including the `CHANGELOG.md` and `README.md` files (if present).
103
+
104
+ - [#5099](https://github.com/bluesky-social/atproto/pull/5099) [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Build with `noImplicitAny` enabled
105
+
106
+ - Updated dependencies [[`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07), [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07), [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07)]:
107
+ - @atproto/common-web@0.5.3
108
+ - @atproto/common@0.6.5
109
+ - @atproto/crypto@0.5.3
110
+ - @atproto/repo@0.10.3
111
+
112
+ ## 0.3.2
113
+
114
+ ### Patch Changes
115
+
116
+ - [#5151](https://github.com/bluesky-social/atproto/pull/5151) [`a51c45d`](https://github.com/bluesky-social/atproto/commit/a51c45d38f6bd7b8765f640e564cf921d52162e7) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update dependencies
117
+
118
+ - Updated dependencies [[`f2cf8f7`](https://github.com/bluesky-social/atproto/commit/f2cf8f7fc5f3a10847f2e6d785e5fa2244ee8cfb), [`a51c45d`](https://github.com/bluesky-social/atproto/commit/a51c45d38f6bd7b8765f640e564cf921d52162e7), [`f2cf8f7`](https://github.com/bluesky-social/atproto/commit/f2cf8f7fc5f3a10847f2e6d785e5fa2244ee8cfb)]:
119
+ - @atproto/common@0.6.4
120
+ - @atproto/common-web@0.5.2
121
+ - @atproto/crypto@0.5.2
122
+ - @atproto/repo@0.10.2
123
+
124
+ ## 0.3.1
125
+
126
+ ### Patch Changes
127
+
128
+ - [#4967](https://github.com/bluesky-social/atproto/pull/4967) [`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use TypeScript 7 to build package
129
+
130
+ - Updated dependencies [[`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5)]:
131
+ - @atproto/common-web@0.5.1
132
+ - @atproto/common@0.6.3
133
+ - @atproto/crypto@0.5.1
134
+ - @atproto/repo@0.10.1
135
+
136
+ ## 0.3.0
137
+
138
+ ### Minor Changes
139
+
140
+ - [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Drop support for Node.js 18 and 20. Node.js 22 is now the minimum supported version. Docker images now use Node.js 24.
141
+
142
+ - [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Convert to pure ESM. All packages now ship `"type": "module"` with ES module output and Node16 module resolution.
143
+
144
+ Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
145
+
146
+ - [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0.
147
+
148
+ ### Patch Changes
149
+
150
+ - Updated dependencies [[`affb50c`](https://github.com/bluesky-social/atproto/commit/affb50c040b497a12631df99a6310f8e78cab557), [`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c), [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9), [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705)]:
151
+ - @atproto/common@0.6.0
152
+ - @atproto/common-web@0.5.0
153
+ - @atproto/crypto@0.5.0
154
+ - @atproto/repo@0.10.0
155
+
156
+ ## 0.2.32
157
+
158
+ ### Patch Changes
159
+
160
+ - Updated dependencies [[`d0c136c`](https://github.com/bluesky-social/atproto/commit/d0c136cba2ec8fa97017849b1023d5af5d2cc60c), [`d0c136c`](https://github.com/bluesky-social/atproto/commit/d0c136cba2ec8fa97017849b1023d5af5d2cc60c), [`d0c136c`](https://github.com/bluesky-social/atproto/commit/d0c136cba2ec8fa97017849b1023d5af5d2cc60c), [`d0c136c`](https://github.com/bluesky-social/atproto/commit/d0c136cba2ec8fa97017849b1023d5af5d2cc60c)]:
161
+ - @atproto/repo@0.9.0
162
+
163
+ ## 0.2.31
164
+
165
+ ### Patch Changes
166
+
167
+ - Updated dependencies [[`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7)]:
168
+ - @atproto/common-web@0.4.4
169
+ - @atproto/common@0.5.0
170
+ - @atproto/repo@0.8.11
171
+ - @atproto/crypto@0.4.4
172
+
173
+ ## 0.2.30
174
+
175
+ ### Patch Changes
176
+
177
+ - Updated dependencies [[`8dd77bad2`](https://github.com/bluesky-social/atproto/commit/8dd77bad2fdee20e39d3787198d960c19d8df3d0)]:
178
+ - @atproto/repo@0.8.10
179
+
180
+ ## 0.2.29
181
+
182
+ ### Patch Changes
183
+
184
+ - [#4169](https://github.com/bluesky-social/atproto/pull/4169) [`055a413fb`](https://github.com/bluesky-social/atproto/commit/055a413fba4fab510ec899377154f1204ab12099) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Optimistically attempt to move files before checking for their existence, resulting in faster `makePermanent` calls
185
+
186
+ - [#4169](https://github.com/bluesky-social/atproto/pull/4169) [`055a413fb`](https://github.com/bluesky-social/atproto/commit/055a413fba4fab510ec899377154f1204ab12099) Thanks [@matthieusieben](https://github.com/matthieusieben)! - `S3BlobStore`'s `deleteMany` now supports any number of input (and will process deletes by chunks internally)
187
+
188
+ - [#4169](https://github.com/bluesky-social/atproto/pull/4169) [`055a413fb`](https://github.com/bluesky-social/atproto/commit/055a413fba4fab510ec899377154f1204ab12099) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update `@aws-sdk` dependencies
189
+
190
+ - [#4169](https://github.com/bluesky-social/atproto/pull/4169) [`055a413fb`](https://github.com/bluesky-social/atproto/commit/055a413fba4fab510ec899377154f1204ab12099) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Set a timeout (of 10 seconds by default) on every `S3BlobStore` requests
191
+
192
+ - Updated dependencies [[`055a413fb`](https://github.com/bluesky-social/atproto/commit/055a413fba4fab510ec899377154f1204ab12099), [`055a413fb`](https://github.com/bluesky-social/atproto/commit/055a413fba4fab510ec899377154f1204ab12099), [`055a413fb`](https://github.com/bluesky-social/atproto/commit/055a413fba4fab510ec899377154f1204ab12099)]:
193
+ - @atproto/repo@0.8.9
194
+ - @atproto/common-web@0.4.3
195
+ - @atproto/common@0.4.12
196
+ - @atproto/crypto@0.4.4
197
+
198
+ ## 0.2.28
199
+
200
+ ### Patch Changes
201
+
202
+ - Updated dependencies []:
203
+ - @atproto/repo@0.8.8
204
+
205
+ ## 0.2.27
206
+
207
+ ### Patch Changes
208
+
209
+ - Updated dependencies []:
210
+ - @atproto/repo@0.8.7
211
+
212
+ ## 0.2.26
213
+
214
+ ### Patch Changes
215
+
216
+ - Updated dependencies [[`331a356ce`](https://github.com/bluesky-social/atproto/commit/331a356ce27ff1d0b24747b0c16f3b54b07a0a12)]:
217
+ - @atproto/repo@0.8.6
218
+
219
+ ## 0.2.25
220
+
221
+ ### Patch Changes
222
+
223
+ - Updated dependencies []:
224
+ - @atproto/repo@0.8.5
225
+
226
+ ## 0.2.24
227
+
228
+ ### Patch Changes
229
+
230
+ - Updated dependencies [[`a8dee6af3`](https://github.com/bluesky-social/atproto/commit/a8dee6af33618d3072ebae7f23843242a32c926c)]:
231
+ - @atproto/repo@0.8.4
232
+
233
+ ## 0.2.23
234
+
235
+ ### Patch Changes
236
+
237
+ - Updated dependencies [[`5fccbd2a1`](https://github.com/bluesky-social/atproto/commit/5fccbd2a14420e4a7c6f56ad9af4ecfe15a971e3)]:
238
+ - @atproto/repo@0.8.3
239
+
240
+ ## 0.2.22
241
+
242
+ ### Patch Changes
243
+
244
+ - Updated dependencies [[`8bd45e2f8`](https://github.com/bluesky-social/atproto/commit/8bd45e2f898a87b3550c7f4a0c8312fad9cb4736)]:
245
+ - @atproto/repo@0.8.2
246
+
247
+ ## 0.2.21
248
+
249
+ ### Patch Changes
250
+
251
+ - Updated dependencies []:
252
+ - @atproto/common@0.4.11
253
+ - @atproto/repo@0.8.1
254
+ - @atproto/crypto@0.4.4
255
+
256
+ ## 0.2.20
257
+
258
+ ### Patch Changes
259
+
260
+ - Updated dependencies [[`4db923ca1`](https://github.com/bluesky-social/atproto/commit/4db923ca1c4fadd31d41c851933659e5186ee144), [`4db923ca1`](https://github.com/bluesky-social/atproto/commit/4db923ca1c4fadd31d41c851933659e5186ee144)]:
261
+ - @atproto/repo@0.8.0
262
+ - @atproto/common@0.4.10
263
+ - @atproto/crypto@0.4.4
264
+
265
+ ## 0.2.19
266
+
267
+ ### Patch Changes
268
+
269
+ - Updated dependencies [[`bdbd3c3e3`](https://github.com/bluesky-social/atproto/commit/bdbd3c3e3f8fe8476a3fecac73810554846c938f), [`bdbd3c3e3`](https://github.com/bluesky-social/atproto/commit/bdbd3c3e3f8fe8476a3fecac73810554846c938f)]:
270
+ - @atproto/repo@0.7.3
271
+ - @atproto/common@0.4.9
272
+ - @atproto/crypto@0.4.4
273
+
274
+ ## 0.2.18
275
+
276
+ ### Patch Changes
277
+
278
+ - Updated dependencies []:
279
+ - @atproto/repo@0.7.2
280
+
281
+ ## 0.2.17
282
+
283
+ ### Patch Changes
284
+
285
+ - Updated dependencies []:
286
+ - @atproto/repo@0.7.1
287
+
288
+ ## 0.2.16
289
+
290
+ ### Patch Changes
291
+
292
+ - Updated dependencies [[`7e3678c08`](https://github.com/bluesky-social/atproto/commit/7e3678c089d2faa1a884a52a4fb80b8116c9854f)]:
293
+ - @atproto/repo@0.7.0
294
+
295
+ ## 0.2.15
296
+
297
+ ### Patch Changes
298
+
299
+ - Updated dependencies []:
300
+ - @atproto/repo@0.6.5
301
+
302
+ ## 0.2.14
303
+
304
+ ### Patch Changes
305
+
306
+ - [#3220](https://github.com/bluesky-social/atproto/pull/3220) [`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Apply new linting rules regarding import order
307
+
308
+ - [#3220](https://github.com/bluesky-social/atproto/pull/3220) [`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update NodeJS engine requirement to >=18.7.0
309
+
310
+ - Updated dependencies [[`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd), [`61dc0d60e`](https://github.com/bluesky-social/atproto/commit/61dc0d60e19b88c6427a54c6d95a391b5f4da7bd)]:
311
+ - @atproto/common@0.4.8
312
+ - @atproto/crypto@0.4.4
313
+ - @atproto/repo@0.6.4
314
+
315
+ ## 0.2.13
316
+
317
+ ### Patch Changes
318
+
319
+ - Updated dependencies [[`52c687a05`](https://github.com/bluesky-social/atproto/commit/52c687a05c70d5660fae1de9e1bbc6297f37f1f4)]:
320
+ - @atproto/common@0.4.7
321
+ - @atproto/crypto@0.4.3
322
+ - @atproto/repo@0.6.3
323
+
324
+ ## 0.2.12
325
+
326
+ ### Patch Changes
327
+
328
+ - Updated dependencies [[`1abfd74ec`](https://github.com/bluesky-social/atproto/commit/1abfd74ec7114e5d8e2411f7a4fa10bdce97e277)]:
329
+ - @atproto/crypto@0.4.3
330
+ - @atproto/repo@0.6.2
331
+
332
+ ## 0.2.11
333
+
334
+ ### Patch Changes
335
+
336
+ - Updated dependencies []:
337
+ - @atproto/common@0.4.6
338
+ - @atproto/repo@0.6.1
339
+ - @atproto/crypto@0.4.2
340
+
341
+ ## 0.2.10
342
+
343
+ ### Patch Changes
344
+
345
+ - Updated dependencies [[`588baae12`](https://github.com/bluesky-social/atproto/commit/588baae1212a3cba3bf0d95d2f268e80513fd9c4), [`c9848edaf`](https://github.com/bluesky-social/atproto/commit/c9848edaf0947727aa5a60e3c67eecda3f48d46a)]:
346
+ - @atproto/common@0.4.5
347
+ - @atproto/repo@0.6.0
348
+ - @atproto/crypto@0.4.2
349
+
350
+ ## 0.2.9
351
+
352
+ ### Patch Changes
353
+
354
+ - Updated dependencies []:
355
+ - @atproto/repo@0.5.5
356
+
357
+ ## 0.2.8
358
+
359
+ ### Patch Changes
360
+
361
+ - Updated dependencies [[`1982693e3`](https://github.com/bluesky-social/atproto/commit/1982693e3ea1fef4db76ac9aca3db8dc5ebf3fe0)]:
362
+ - @atproto/crypto@0.4.2
363
+ - @atproto/repo@0.5.4
364
+
365
+ ## 0.2.7
366
+
367
+ ### Patch Changes
368
+
369
+ - Updated dependencies [[`4098d9890`](https://github.com/bluesky-social/atproto/commit/4098d9890173f4d6c6512f2d8994eebbf12b5e13)]:
370
+ - @atproto/common@0.4.4
371
+ - @atproto/crypto@0.4.1
372
+ - @atproto/repo@0.5.3
373
+
374
+ ## 0.2.6
375
+
376
+ ### Patch Changes
377
+
378
+ - Updated dependencies [[`a07b21151`](https://github.com/bluesky-social/atproto/commit/a07b21151f1850340c4b7797ebb11521b1a6cdf3)]:
379
+ - @atproto/common@0.4.3
380
+ - @atproto/repo@0.5.2
381
+ - @atproto/crypto@0.4.1
382
+
383
+ ## 0.2.5
384
+
385
+ ### Patch Changes
386
+
387
+ - Updated dependencies [[`98711a147`](https://github.com/bluesky-social/atproto/commit/98711a147a8674337f605c6368f39fc10c2fae93)]:
388
+ - @atproto/common@0.4.2
389
+ - @atproto/crypto@0.4.1
390
+ - @atproto/repo@0.5.1
391
+
392
+ ## 0.2.4
393
+
394
+ ### Patch Changes
395
+
396
+ - Updated dependencies [[`b15dec2f4`](https://github.com/bluesky-social/atproto/commit/b15dec2f4feb25ac91b169c83ccff1adbb5a9442)]:
397
+ - @atproto/repo@0.5.0
398
+
399
+ ## 0.2.3
400
+
401
+ ### Patch Changes
402
+
403
+ - Updated dependencies [[`ebb318325`](https://github.com/bluesky-social/atproto/commit/ebb318325b6e80c4ea1a93a617569da2698afe31)]:
404
+ - @atproto/crypto@0.4.1
405
+ - @atproto/repo@0.4.3
406
+
407
+ ## 0.2.2
408
+
409
+ ### Patch Changes
410
+
411
+ - Updated dependencies []:
412
+ - @atproto/repo@0.4.2
413
+
414
+ ## 0.2.1
415
+
416
+ ### Patch Changes
417
+
418
+ - Updated dependencies [[`acc9093d2`](https://github.com/bluesky-social/atproto/commit/acc9093d2845eba02b68fb2f9db33e4f1b59bb10)]:
419
+ - @atproto/common@0.4.1
420
+ - @atproto/crypto@0.4.0
421
+ - @atproto/repo@0.4.1
422
+
423
+ ## 0.2.0
424
+
425
+ ### Minor Changes
426
+
427
+ - [#2169](https://github.com/bluesky-social/atproto/pull/2169) [`f689bd51a`](https://github.com/bluesky-social/atproto/commit/f689bd51a2f4e02d4eca40eb2568a1fcb95494e9) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Build system rework, stop bundling dependencies.
428
+
429
+ ### Patch Changes
430
+
431
+ - Updated dependencies [[`f689bd51a`](https://github.com/bluesky-social/atproto/commit/f689bd51a2f4e02d4eca40eb2568a1fcb95494e9)]:
432
+ - @atproto/common@0.4.0
433
+ - @atproto/crypto@0.4.0
434
+ - @atproto/repo@0.4.0
435
+
436
+ ## 0.1.9
437
+
438
+ ### Patch Changes
439
+
440
+ - Updated dependencies []:
441
+ - @atproto/common@0.3.4
442
+ - @atproto/repo@0.3.9
443
+ - @atproto/crypto@0.3.0
444
+
445
+ ## 0.1.8
446
+
447
+ ### Patch Changes
448
+
449
+ - Updated dependencies []:
450
+ - @atproto/repo@0.3.8
451
+
452
+ ## 0.1.7
453
+
454
+ ### Patch Changes
455
+
456
+ - Updated dependencies [[`fcf8e3faf`](https://github.com/bluesky-social/atproto/commit/fcf8e3faf311559162c3aa0d9af36f84951914bc)]:
457
+ - @atproto/repo@0.3.7
458
+
459
+ ## 0.1.6
460
+
461
+ ### Patch Changes
462
+
463
+ - Updated dependencies []:
464
+ - @atproto/repo@0.3.6
465
+
466
+ ## 0.1.5
467
+
468
+ ### Patch Changes
469
+
470
+ - Updated dependencies [[`e1b5f253`](https://github.com/bluesky-social/atproto/commit/e1b5f2537a5ba4d8b951a741269b604856028ae5)]:
471
+ - @atproto/crypto@0.3.0
472
+ - @atproto/repo@0.3.5
473
+
474
+ ## 0.1.4
475
+
476
+ ### Patch Changes
477
+
478
+ - Updated dependencies [[`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]:
479
+ - @atproto/common@0.3.3
480
+ - @atproto/crypto@0.2.3
481
+ - @atproto/repo@0.3.4
482
+
483
+ ## 0.1.3
484
+
485
+ ### Patch Changes
486
+
487
+ - Updated dependencies []:
488
+ - @atproto/repo@0.3.3
489
+ - @atproto/common@0.3.2
490
+
491
+ ## 0.1.2
492
+
493
+ ### Patch Changes
494
+
495
+ - Updated dependencies []:
496
+ - @atproto/repo@0.3.2
497
+
498
+ ## 0.1.1
499
+
500
+ ### Patch Changes
501
+
502
+ - Updated dependencies []:
503
+ - @atproto/repo@0.3.1
package/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Dual MIT/Apache-2.0 License
2
+
3
+ Copyright (c) 2022-2026 Bluesky Social PBC, and Contributors
4
+
5
+ Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
6
+
7
+ Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # AWS KMS
2
+
3
+ A Keypair-compatible wrapper for AWS KMS.
@@ -0,0 +1,12 @@
1
+ import type { ImageInvalidator } from './types.js';
2
+ export type BunnyConfig = {
3
+ accessKey: string;
4
+ urlPrefix: string;
5
+ };
6
+ export declare class BunnyInvalidator implements ImageInvalidator {
7
+ cfg: BunnyConfig;
8
+ constructor(cfg: BunnyConfig);
9
+ invalidate(_subject: string, paths: string[]): Promise<void>;
10
+ }
11
+ export default BunnyInvalidator;
12
+ //# sourceMappingURL=bunny.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bunny.d.ts","sourceRoot":"","sources":["../src/bunny.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAID,qBAAa,gBAAiB,YAAW,gBAAgB;IACpC,GAAG,EAAE,WAAW;IAAnC,YAAmB,GAAG,EAAE,WAAW,EAAI;IACjC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,iBASjD;CACF;eAEc,gBAAgB"}
package/dist/bunny.js ADDED
@@ -0,0 +1,24 @@
1
+ import { allFulfilled } from '@atproto/common';
2
+ const API_PURGE_URL = 'https://api.bunny.net/purge';
3
+ export class BunnyInvalidator {
4
+ constructor(cfg) {
5
+ this.cfg = cfg;
6
+ }
7
+ async invalidate(_subject, paths) {
8
+ await allFulfilled(paths.map(async (path) => purgeUrl({
9
+ url: this.cfg.urlPrefix + path,
10
+ accessKey: this.cfg.accessKey,
11
+ })));
12
+ }
13
+ }
14
+ export default BunnyInvalidator;
15
+ async function purgeUrl(opts) {
16
+ const search = new URLSearchParams();
17
+ search.set('async', 'true');
18
+ search.set('url', opts.url);
19
+ await fetch(API_PURGE_URL + '?' + search.toString(), {
20
+ method: 'post',
21
+ headers: { AccessKey: opts.accessKey },
22
+ });
23
+ }
24
+ //# sourceMappingURL=bunny.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bunny.js","sourceRoot":"","sources":["../src/bunny.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAQ9C,MAAM,aAAa,GAAG,6BAA6B,CAAA;AAEnD,MAAM,OAAO,gBAAgB;IAC3B,YAAmB,GAAgB;mBAAhB,GAAG;IAAgB,CAAC;IACvC,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,KAAe;QAChD,MAAM,YAAY,CAChB,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CACvB,QAAQ,CAAC;YACP,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI;YAC9B,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS;SAC9B,CAAC,CACH,CACF,CAAA;IACH,CAAC;CACF;AAED,eAAe,gBAAgB,CAAA;AAE/B,KAAK,UAAU,QAAQ,CAAC,IAAwC;IAC9D,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAA;IACpC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC3B,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IAC3B,MAAM,KAAK,CAAC,aAAa,GAAG,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE;QACnD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE;KACvC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { allFulfilled } from '@atproto/common'\nimport type { ImageInvalidator } from './types.js'\n\nexport type BunnyConfig = {\n accessKey: string\n urlPrefix: string\n}\n\nconst API_PURGE_URL = 'https://api.bunny.net/purge'\n\nexport class BunnyInvalidator implements ImageInvalidator {\n constructor(public cfg: BunnyConfig) {}\n async invalidate(_subject: string, paths: string[]) {\n await allFulfilled(\n paths.map(async (path) =>\n purgeUrl({\n url: this.cfg.urlPrefix + path,\n accessKey: this.cfg.accessKey,\n }),\n ),\n )\n }\n}\n\nexport default BunnyInvalidator\n\nasync function purgeUrl(opts: { accessKey: string; url: string }) {\n const search = new URLSearchParams()\n search.set('async', 'true')\n search.set('url', opts.url)\n await fetch(API_PURGE_URL + '?' + search.toString(), {\n method: 'post',\n headers: { AccessKey: opts.accessKey },\n })\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import * as aws from '@aws-sdk/client-cloudfront';
2
+ import type { ImageInvalidator } from './types.js';
3
+ export type CloudfrontConfig = {
4
+ distributionId: string;
5
+ pathPrefix?: string;
6
+ } & Omit<aws.CloudFrontClientConfig, 'apiVersion'>;
7
+ export declare class CloudfrontInvalidator implements ImageInvalidator {
8
+ distributionId: string;
9
+ pathPrefix: string;
10
+ client: aws.CloudFront;
11
+ constructor(cfg: CloudfrontConfig);
12
+ invalidate(subject: string, paths: string[]): Promise<void>;
13
+ }
14
+ export default CloudfrontInvalidator;
15
+ //# sourceMappingURL=cloudfront.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudfront.d.ts","sourceRoot":"","sources":["../src/cloudfront.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAA;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GAAG,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAA;AAElD,qBAAa,qBAAsB,YAAW,gBAAgB;IAC5D,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,GAAG,CAAC,UAAU,CAAA;IACtB,YAAY,GAAG,EAAE,gBAAgB,EAQhC;IACK,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,iBAWhD;CACF;eAEc,qBAAqB"}
@@ -0,0 +1,26 @@
1
+ import * as aws from '@aws-sdk/client-cloudfront';
2
+ export class CloudfrontInvalidator {
3
+ constructor(cfg) {
4
+ const { distributionId, pathPrefix, ...rest } = cfg;
5
+ this.distributionId = distributionId;
6
+ this.pathPrefix = pathPrefix ?? '';
7
+ this.client = new aws.CloudFront({
8
+ ...rest,
9
+ apiVersion: '2020-05-31',
10
+ });
11
+ }
12
+ async invalidate(subject, paths) {
13
+ await this.client.createInvalidation({
14
+ DistributionId: this.distributionId,
15
+ InvalidationBatch: {
16
+ CallerReference: `cf-invalidator-${subject}-${Date.now()}`,
17
+ Paths: {
18
+ Quantity: paths.length,
19
+ Items: paths.map((path) => this.pathPrefix + path),
20
+ },
21
+ },
22
+ });
23
+ }
24
+ }
25
+ export default CloudfrontInvalidator;
26
+ //# sourceMappingURL=cloudfront.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudfront.js","sourceRoot":"","sources":["../src/cloudfront.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAA;AAQjD,MAAM,OAAO,qBAAqB;IAIhC,YAAY,GAAqB;QAC/B,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAA;QACnD,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,EAAE,CAAA;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC;YAC/B,GAAG,IAAI;YACP,UAAU,EAAE,YAAY;SACzB,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,KAAe;QAC/C,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;YACnC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,iBAAiB,EAAE;gBACjB,eAAe,EAAE,kBAAkB,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE;gBAC1D,KAAK,EAAE;oBACL,QAAQ,EAAE,KAAK,CAAC,MAAM;oBACtB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;iBACnD;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAED,eAAe,qBAAqB,CAAA","sourcesContent":["import * as aws from '@aws-sdk/client-cloudfront'\nimport type { ImageInvalidator } from './types.js'\n\nexport type CloudfrontConfig = {\n distributionId: string\n pathPrefix?: string\n} & Omit<aws.CloudFrontClientConfig, 'apiVersion'>\n\nexport class CloudfrontInvalidator implements ImageInvalidator {\n distributionId: string\n pathPrefix: string\n client: aws.CloudFront\n constructor(cfg: CloudfrontConfig) {\n const { distributionId, pathPrefix, ...rest } = cfg\n this.distributionId = distributionId\n this.pathPrefix = pathPrefix ?? ''\n this.client = new aws.CloudFront({\n ...rest,\n apiVersion: '2020-05-31',\n })\n }\n async invalidate(subject: string, paths: string[]) {\n await this.client.createInvalidation({\n DistributionId: this.distributionId,\n InvalidationBatch: {\n CallerReference: `cf-invalidator-${subject}-${Date.now()}`,\n Paths: {\n Quantity: paths.length,\n Items: paths.map((path) => this.pathPrefix + path),\n },\n },\n })\n }\n}\n\nexport default CloudfrontInvalidator\n"]}
@@ -0,0 +1,7 @@
1
+ export * from './kms.js';
2
+ export * from './s3.js';
3
+ export * from './cloudfront.js';
4
+ export * from './bunny.js';
5
+ export * from './util.js';
6
+ export * from './types.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from './kms.js';
2
+ export * from './s3.js';
3
+ export * from './cloudfront.js';
4
+ export * from './bunny.js';
5
+ export * from './util.js';
6
+ export * from './types.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA","sourcesContent":["export * from './kms.js'\nexport * from './s3.js'\nexport * from './cloudfront.js'\nexport * from './bunny.js'\nexport * from './util.js'\nexport * from './types.js'\n"]}
package/dist/kms.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import * as aws from '@aws-sdk/client-kms';
2
+ import * as crypto from '@atproto/crypto';
3
+ export type KmsConfig = {
4
+ keyId: string;
5
+ } & Omit<aws.KMSClientConfig, 'apiVersion'>;
6
+ export declare class KmsKeypair implements crypto.Keypair {
7
+ private client;
8
+ private keyId;
9
+ private publicKey;
10
+ jwtAlg: string;
11
+ constructor(client: aws.KMS, keyId: string, publicKey: Uint8Array);
12
+ static load(cfg: KmsConfig): Promise<KmsKeypair>;
13
+ did(): string;
14
+ sign(msg: Uint8Array): Promise<Uint8Array>;
15
+ }
16
+ export default KmsKeypair;
17
+ //# sourceMappingURL=kms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kms.d.ts","sourceRoot":"","sources":["../src/kms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAI1C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAOzC,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAC9C,GAAG,CAAC,eAAe,EACnB,YAAY,CACb,CAAA;AAED,qBAAa,UAAW,YAAW,MAAM,CAAC,OAAO;IAI7C,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,SAAS;IALnB,MAAM,SAA2B;IAEjC,YACU,MAAM,EAAE,GAAG,CAAC,GAAG,EACf,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,UAAU,EAC3B;IAEJ,OAAa,IAAI,CAAC,GAAG,EAAE,SAAS,uBAkB/B;IAED,GAAG,IAAI,MAAM,CAEZ;IAEK,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAiB/C;CACF;eAEc,UAAU"}
package/dist/kms.js ADDED
@@ -0,0 +1,54 @@
1
+ import * as aws from '@aws-sdk/client-kms';
2
+ import { secp256k1 as noble } from '@noble/curves/secp256k1';
3
+ import KeyEncoderModule from 'key-encoder';
4
+ import * as ui8 from 'uint8arrays';
5
+ import * as crypto from '@atproto/crypto';
6
+ // key-encoder is CJS with exports.default; Node ESM interop wraps it as { default: Class }
7
+ const KeyEncoder = ((m) => m.default ?? m)(KeyEncoderModule);
8
+ const keyEncoder = new KeyEncoder('secp256k1');
9
+ export class KmsKeypair {
10
+ constructor(client, keyId, publicKey) {
11
+ this.client = client;
12
+ this.keyId = keyId;
13
+ this.publicKey = publicKey;
14
+ this.jwtAlg = crypto.SECP256K1_JWT_ALG;
15
+ }
16
+ static async load(cfg) {
17
+ const { keyId, ...rest } = cfg;
18
+ const client = new aws.KMS({
19
+ ...rest,
20
+ apiVersion: '2014-11-01',
21
+ });
22
+ const res = await client.getPublicKey({ KeyId: keyId });
23
+ if (!res.PublicKey) {
24
+ throw new Error('Could not find public key');
25
+ }
26
+ // public key comes back DER-encoded, so we translate it to raw 65 byte encoding
27
+ const rawPublicKeyHex = keyEncoder.encodePublic(Buffer.from(res.PublicKey), 'der', 'raw');
28
+ const publicKey = ui8.fromString(rawPublicKeyHex, 'hex');
29
+ return new KmsKeypair(client, keyId, publicKey);
30
+ }
31
+ did() {
32
+ return crypto.formatDidKey(this.jwtAlg, this.publicKey);
33
+ }
34
+ async sign(msg) {
35
+ const res = await this.client.sign({
36
+ KeyId: this.keyId,
37
+ Message: msg,
38
+ SigningAlgorithm: 'ECDSA_SHA_256',
39
+ });
40
+ if (!res.Signature) {
41
+ throw new Error('Could not get signature');
42
+ }
43
+ // signature comes back DER encoded & not-normalized
44
+ // we translate to raw 64 byte encoding
45
+ // we also normalize s as no more than 1/2 prime order to pass strict verification
46
+ // (prevents duplicating a signature)
47
+ // more: https://github.com/bitcoin-core/secp256k1/blob/a1102b12196ea27f44d6201de4d25926a2ae9640/include/secp256k1.h#L530-L534
48
+ const sig = noble.Signature.fromDER(res.Signature);
49
+ const normalized = sig.normalizeS();
50
+ return normalized.toCompactRawBytes();
51
+ }
52
+ }
53
+ export default KmsKeypair;
54
+ //# sourceMappingURL=kms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kms.js","sourceRoot":"","sources":["../src/kms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAC1C,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AAe,EAAE,KAAK,CAAC,CAAA;QACxD,OAAO,IAAI,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;IACjD,CAAC;IAED,GAAG;QACD,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IACzD,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAe;QACxB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACjC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,GAAG;YACZ,gBAAgB,EAAE,eAAe;SAClC,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAC5C,CAAC;QACD,oDAAoD;QACpD,uCAAuC;QACvC,kFAAkF;QAClF,qCAAqC;QACrC,8HAA8H;QAC9H,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAClD,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAA;QACnC,OAAO,UAAU,CAAC,iBAAiB,EAAE,CAAA;IACvC,CAAC;CACF;AAED,eAAe,UAAU,CAAA","sourcesContent":["import * as aws from '@aws-sdk/client-kms'\nimport { secp256k1 as noble } from '@noble/curves/secp256k1'\nimport KeyEncoderModule from 'key-encoder'\nimport * as ui8 from 'uint8arrays'\nimport * as crypto from '@atproto/crypto'\n\n// key-encoder is CJS with exports.default; Node ESM interop wraps it as { default: Class }\nconst KeyEncoder = ((m) => m.default ?? m)(KeyEncoderModule)\n\nconst keyEncoder = new KeyEncoder('secp256k1')\n\nexport type KmsConfig = { keyId: string } & Omit<\n aws.KMSClientConfig,\n 'apiVersion'\n>\n\nexport class KmsKeypair implements crypto.Keypair {\n jwtAlg = crypto.SECP256K1_JWT_ALG\n\n constructor(\n private client: aws.KMS,\n private keyId: string,\n private publicKey: Uint8Array,\n ) {}\n\n static async load(cfg: KmsConfig) {\n const { keyId, ...rest } = cfg\n const client = new aws.KMS({\n ...rest,\n apiVersion: '2014-11-01',\n })\n const res = await client.getPublicKey({ KeyId: keyId })\n if (!res.PublicKey) {\n throw new Error('Could not find public key')\n }\n // public key comes back DER-encoded, so we translate it to raw 65 byte encoding\n const rawPublicKeyHex = keyEncoder.encodePublic(\n Buffer.from(res.PublicKey),\n 'der',\n 'raw',\n )\n const publicKey = ui8.fromString(rawPublicKeyHex, 'hex')\n return new KmsKeypair(client, keyId, publicKey)\n }\n\n did(): string {\n return crypto.formatDidKey(this.jwtAlg, this.publicKey)\n }\n\n async sign(msg: Uint8Array): Promise<Uint8Array> {\n const res = await this.client.sign({\n KeyId: this.keyId,\n Message: msg,\n SigningAlgorithm: 'ECDSA_SHA_256',\n })\n if (!res.Signature) {\n throw new Error('Could not get signature')\n }\n // signature comes back DER encoded & not-normalized\n // we translate to raw 64 byte encoding\n // we also normalize s as no more than 1/2 prime order to pass strict verification\n // (prevents duplicating a signature)\n // more: https://github.com/bitcoin-core/secp256k1/blob/a1102b12196ea27f44d6201de4d25926a2ae9640/include/secp256k1.h#L530-L534\n const sig = noble.Signature.fromDER(res.Signature)\n const normalized = sig.normalizeS()\n return normalized.toCompactRawBytes()\n }\n}\n\nexport default KmsKeypair\n"]}
package/dist/s3.d.ts ADDED
@@ -0,0 +1,81 @@
1
+ import type stream from 'node:stream';
2
+ import { type S3ClientConfig } from '@aws-sdk/client-s3';
3
+ import type { CID } from 'multiformats/cid';
4
+ import { type BlobStore } from '@atproto/repo';
5
+ export type S3Config = {
6
+ bucket: string;
7
+ /**
8
+ * The maximum time any single HTTP request to S3 can remain idle (socket
9
+ * idle timeout), in milliseconds. This acts as a stall detector: a stalled
10
+ * or dead connection is reaped after this delay and the request is retried
11
+ * by the SDK. It should be kept short, independently of
12
+ * {@link S3Config.uploadTimeoutMs}, because blob bytes are buffered in
13
+ * memory before each S3 request is dispatched (uploads to S3 are never
14
+ * client-paced).
15
+ *
16
+ * @note Do not set this below 6 seconds. For values >= 6s, the SDK's socket
17
+ * idle timeout is only armed if the response headers take more than 3s to
18
+ * arrive, so blob *downloads* streamed to slow (client-paced) consumers are
19
+ * unaffected. Below 6s, the timeout is armed immediately and stays armed
20
+ * while the response body is streamed, causing slow-but-legitimate
21
+ * downloads to be reaped mid-transfer (see "downloads" tests in
22
+ * s3.test.ts).
23
+ *
24
+ * @note Maintenance context: the 6s threshold and 3s deferral are
25
+ * *undocumented internals* of `@smithy/node-http-handler` (the AWS SDK's
26
+ * node request handler; see `setSocketTimeout` in its `set-socket-timeout`
27
+ * module, `DEFER_EVENT_LISTENER_TIME`). They are not part of any public API
28
+ * contract and could change in a future SDK release. The "downloads" tests
29
+ * in s3.test.ts characterize this behavior and will fail if it drifts — if
30
+ * they break after a dependency bump, re-read the handler source and
31
+ * re-evaluate the 6s floor below.
32
+ *
33
+ * Defaults to `min(uploadTimeoutMs, 15_000)`, clamped to a minimum of
34
+ * `6_000`.
35
+ */
36
+ requestTimeoutMs?: number;
37
+ /**
38
+ * The maximum time establishing a connection to S3 can take, in
39
+ * milliseconds.
40
+ *
41
+ * Defaults to 5_000.
42
+ */
43
+ connectionTimeoutMs?: number;
44
+ /**
45
+ * The maximum total time a blob upload can take, in milliseconds. Since
46
+ * uploaded bytes are streamed from the client, this timeout should be large
47
+ * enough to accommodate slow clients uploading large blobs.
48
+ */
49
+ uploadTimeoutMs?: number;
50
+ } & Omit<S3ClientConfig, 'apiVersion' | 'requestHandler'>;
51
+ export declare class S3BlobStore implements BlobStore {
52
+ did: string;
53
+ private client;
54
+ private bucket;
55
+ private uploadTimeoutMs;
56
+ constructor(did: string, cfg: S3Config);
57
+ static creator(cfg: S3Config): (did: string) => S3BlobStore;
58
+ private genKey;
59
+ private getTmpPath;
60
+ private getStoredPath;
61
+ private getQuarantinedPath;
62
+ private uploadBytes;
63
+ putTemp(bytes: Uint8Array | stream.Readable): Promise<string>;
64
+ makePermanent(key: string, cid: CID): Promise<void>;
65
+ putPermanent(cid: CID, bytes: Uint8Array | stream.Readable): Promise<void>;
66
+ quarantine(cid: CID): Promise<void>;
67
+ unquarantine(cid: CID): Promise<void>;
68
+ private getObject;
69
+ getBytes(cid: CID): Promise<Uint8Array>;
70
+ getStream(cid: CID): Promise<stream.Readable>;
71
+ delete(cid: CID): Promise<void>;
72
+ deleteMany(cids: CID[]): Promise<void>;
73
+ hasStored(cid: CID): Promise<boolean>;
74
+ hasTemp(key: string): Promise<boolean>;
75
+ private hasKey;
76
+ private deleteKey;
77
+ private deleteManyKeys;
78
+ private move;
79
+ }
80
+ export default S3BlobStore;
81
+ //# sourceMappingURL=s3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../src/s3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEvE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAG3C,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAA;AAEjE,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,MAAM,CAAA;IACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,GAAG,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,gBAAgB,CAAC,CAAA;AAEzD,qBAAa,WAAY,YAAW,SAAS;IAMlC,GAAG,EAAE,MAAM;IALpB,OAAO,CAAC,MAAM,CAAI;IAClB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,C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AAc;YASd,IAAI;CA8BnB;eAEc,WAAW"}
package/dist/s3.js ADDED
@@ -0,0 +1,229 @@
1
+ import { NoSuchKey, S3 } from '@aws-sdk/client-s3';
2
+ import { Upload } from '@aws-sdk/lib-storage';
3
+ import { SECOND, aggregateErrors, chunkArray } from '@atproto/common-web';
4
+ import { randomStr } from '@atproto/crypto';
5
+ import { BlobNotFoundError } from '@atproto/repo';
6
+ export class S3BlobStore {
7
+ constructor(did, cfg) {
8
+ this.did = did;
9
+ const { bucket, uploadTimeoutMs = 10 * SECOND,
10
+ // @NOTE The request timeout acts as a stall detector (socket idle
11
+ // timeout) and should stay short even when uploadTimeoutMs is large,
12
+ // so that stalled S3 connections are reaped and retried quickly. The 6s
13
+ // floor keeps the idle timeout from applying to streamed (client-paced)
14
+ // blob downloads (see S3Config.requestTimeoutMs).
15
+ requestTimeoutMs = Math.max(Math.min(uploadTimeoutMs, 15 * SECOND), 6 * SECOND), connectionTimeoutMs = 5 * SECOND, ...rest } = cfg;
16
+ this.bucket = bucket;
17
+ this.uploadTimeoutMs = uploadTimeoutMs;
18
+ this.client = new S3({
19
+ ...rest,
20
+ apiVersion: '2006-03-01',
21
+ // Ensures that all requests timeout under "requestTimeoutMs".
22
+ //
23
+ // @NOTE This will also apply to the upload of each individual blob
24
+ // chunk when using Upload from @aws-sdk/lib-storage. This is fine
25
+ // because chunks are buffered in memory before being sent, meaning that
26
+ // requests to S3 are not client-paced.
27
+ requestHandler: {
28
+ requestTimeout: requestTimeoutMs,
29
+ connectionTimeout: connectionTimeoutMs,
30
+ },
31
+ });
32
+ }
33
+ static creator(cfg) {
34
+ return (did) => {
35
+ return new S3BlobStore(did, cfg);
36
+ };
37
+ }
38
+ genKey() {
39
+ return randomStr(32, 'base32');
40
+ }
41
+ getTmpPath(key) {
42
+ return `tmp/${this.did}/${key}`;
43
+ }
44
+ getStoredPath(cid) {
45
+ return `blocks/${this.did}/${cid.toString()}`;
46
+ }
47
+ getQuarantinedPath(cid) {
48
+ return `quarantine/${this.did}/${cid.toString()}`;
49
+ }
50
+ async uploadBytes(path, bytes) {
51
+ // @NOTE we use Upload rather than client.putObject because stream length is
52
+ // not known in advance. See also aws/aws-sdk-js-v3#2348.
53
+ //
54
+ // See also https://github.com/aws/aws-sdk-js-v3/issues/6426, wherein Upload
55
+ // may hang the s3 connection under certain circumstances. We don't have a
56
+ // good way to avoid this, so we use timeouts defensively on all s3
57
+ // requests.
58
+ const abortSignal = AbortSignal.timeout(this.uploadTimeoutMs);
59
+ const abortController = new AbortController();
60
+ abortSignal.addEventListener('abort', () => abortController.abort());
61
+ const upload = new Upload({
62
+ client: this.client,
63
+ params: {
64
+ Bucket: this.bucket,
65
+ Body: bytes,
66
+ Key: path,
67
+ },
68
+ abortController,
69
+ });
70
+ try {
71
+ await upload.done();
72
+ }
73
+ catch (err) {
74
+ // Translate aws-sdk's abort error (total upload timeout) and timeout
75
+ // errors (stalled connections, after the SDK exhausted its retries) to
76
+ // something more specific
77
+ if (err instanceof Error &&
78
+ (err.name === 'AbortError' || err.name === 'TimeoutError')) {
79
+ throw new Error('Blob upload timed out', { cause: err });
80
+ }
81
+ throw err;
82
+ }
83
+ }
84
+ async putTemp(bytes) {
85
+ const key = this.genKey();
86
+ await this.uploadBytes(this.getTmpPath(key), bytes);
87
+ return key;
88
+ }
89
+ async makePermanent(key, cid) {
90
+ try {
91
+ // @NOTE we normally call this method when we know the file is temporary.
92
+ // Because of this, we optimistically move the file, allowing to make
93
+ // fewer network requests in the happy path.
94
+ await this.move({
95
+ from: this.getTmpPath(key),
96
+ to: this.getStoredPath(cid),
97
+ });
98
+ }
99
+ catch (err) {
100
+ // If the optimistic move failed because the temp file was not found,
101
+ // check if the permanent file already exists. If it does, we can assume
102
+ // that another process made the file permanent concurrently, and we can
103
+ // no-op.
104
+ if (err instanceof BlobNotFoundError) {
105
+ // Blob was not found from temp storage...
106
+ const alreadyHas = await this.hasStored(cid);
107
+ // already saved, so we no-op
108
+ if (alreadyHas)
109
+ return;
110
+ }
111
+ throw err;
112
+ }
113
+ }
114
+ async putPermanent(cid, bytes) {
115
+ await this.uploadBytes(this.getStoredPath(cid), bytes);
116
+ }
117
+ async quarantine(cid) {
118
+ await this.move({
119
+ from: this.getStoredPath(cid),
120
+ to: this.getQuarantinedPath(cid),
121
+ });
122
+ }
123
+ async unquarantine(cid) {
124
+ await this.move({
125
+ from: this.getQuarantinedPath(cid),
126
+ to: this.getStoredPath(cid),
127
+ });
128
+ }
129
+ async getObject(cid) {
130
+ const res = await this.client.getObject({
131
+ Bucket: this.bucket,
132
+ Key: this.getStoredPath(cid),
133
+ });
134
+ if (res.Body) {
135
+ return res.Body;
136
+ }
137
+ else {
138
+ throw new BlobNotFoundError();
139
+ }
140
+ }
141
+ async getBytes(cid) {
142
+ const res = await this.getObject(cid);
143
+ return res.transformToByteArray();
144
+ }
145
+ async getStream(cid) {
146
+ const res = await this.getObject(cid);
147
+ return res;
148
+ }
149
+ async delete(cid) {
150
+ await this.deleteKey(this.getStoredPath(cid));
151
+ }
152
+ async deleteMany(cids) {
153
+ const errors = [];
154
+ for (const chunk of chunkArray(cids, 500)) {
155
+ try {
156
+ const keys = chunk.map((cid) => this.getStoredPath(cid));
157
+ await this.deleteManyKeys(keys);
158
+ }
159
+ catch (err) {
160
+ errors.push(err);
161
+ }
162
+ }
163
+ if (errors.length)
164
+ throw aggregateErrors(errors);
165
+ }
166
+ async hasStored(cid) {
167
+ return this.hasKey(this.getStoredPath(cid));
168
+ }
169
+ async hasTemp(key) {
170
+ return this.hasKey(this.getTmpPath(key));
171
+ }
172
+ async hasKey(key) {
173
+ try {
174
+ const res = await this.client.headObject({
175
+ Bucket: this.bucket,
176
+ Key: key,
177
+ });
178
+ return res.$metadata.httpStatusCode === 200;
179
+ }
180
+ catch (err) {
181
+ return false;
182
+ }
183
+ }
184
+ async deleteKey(key) {
185
+ await this.client.deleteObject({
186
+ Bucket: this.bucket,
187
+ Key: key,
188
+ });
189
+ }
190
+ async deleteManyKeys(keys) {
191
+ await this.client.deleteObjects({
192
+ Bucket: this.bucket,
193
+ Delete: {
194
+ Objects: keys.map((k) => ({ Key: k })),
195
+ },
196
+ });
197
+ }
198
+ async move(keys) {
199
+ try {
200
+ await this.client.copyObject({
201
+ Bucket: this.bucket,
202
+ CopySource: `${this.bucket}/${keys.from}`,
203
+ Key: keys.to,
204
+ });
205
+ }
206
+ catch (cause) {
207
+ if (cause instanceof NoSuchKey) {
208
+ // Already deleted, possibly by a concurrently running process
209
+ throw new BlobNotFoundError(undefined, { cause });
210
+ }
211
+ throw cause;
212
+ }
213
+ try {
214
+ await this.client.deleteObject({
215
+ Bucket: this.bucket,
216
+ Key: keys.from,
217
+ });
218
+ }
219
+ catch (err) {
220
+ if (err instanceof NoSuchKey) {
221
+ // Already deleted, possibly by a concurrently running process
222
+ return;
223
+ }
224
+ throw err;
225
+ }
226
+ }
227
+ }
228
+ export default S3BlobStore;
229
+ //# sourceMappingURL=s3.js.map
package/dist/s3.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.js","sourceRoot":"","sources":["../src/s3.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,EAAE,EAAuB,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAkB,MAAM,eAAe,CAAA;AAiDjE,MAAM,OAAO,WAAW;IAKtB,YACS,GAAW,EAClB,GAAa;mBADN,GAAG;QAGV,MAAM,EACJ,MAAM,EACN,eAAe,GAAG,EAAE,GAAG,MAAM;QAC7B,kEAAkE;QAClE,qEAAqE;QACrE,wEAAwE;QACxE,wEAAwE;QACxE,kDAAkD;QAClD,gBAAgB,GAAG,IAAI,CAAC,GAAG,CACzB,IAA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AAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE;gBACzC,GAAG,EAAE,IAAI,CAAC,EAAE;aACb,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;gBAC/B,8DAA8D;gBAC9D,MAAM,IAAI,iBAAiB,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;YACnD,CAAC;YAED,MAAM,KAAK,CAAA;QACb,CAAC;QAED,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;gBAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,GAAG,EAAE,IAAI,CAAC,IAAI;aACf,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,SAAS,EAAE,CAAC;gBAC7B,8DAA8D;gBAC9D,OAAM;YACR,CAAC;YAED,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;CACF;AAED,eAAe,WAAW,CAAA","sourcesContent":["import type stream from 'node:stream'\nimport { NoSuchKey, S3, type S3ClientConfig } from '@aws-sdk/client-s3'\nimport { Upload } from '@aws-sdk/lib-storage'\nimport type { CID } from 'multiformats/cid'\nimport { SECOND, aggregateErrors, chunkArray } from '@atproto/common-web'\nimport { randomStr } from '@atproto/crypto'\nimport { BlobNotFoundError, type BlobStore } from '@atproto/repo'\n\nexport type S3Config = {\n bucket: string\n /**\n * The maximum time any single HTTP request to S3 can remain idle (socket\n * idle timeout), in milliseconds. This acts as a stall detector: a stalled\n * or dead connection is reaped after this delay and the request is retried\n * by the SDK. It should be kept short, independently of\n * {@link S3Config.uploadTimeoutMs}, because blob bytes are buffered in\n * memory before each S3 request is dispatched (uploads to S3 are never\n * client-paced).\n *\n * @note Do not set this below 6 seconds. For values >= 6s, the SDK's socket\n * idle timeout is only armed if the response headers take more than 3s to\n * arrive, so blob *downloads* streamed to slow (client-paced) consumers are\n * unaffected. Below 6s, the timeout is armed immediately and stays armed\n * while the response body is streamed, causing slow-but-legitimate\n * downloads to be reaped mid-transfer (see \"downloads\" tests in\n * s3.test.ts).\n *\n * @note Maintenance context: the 6s threshold and 3s deferral are\n * *undocumented internals* of `@smithy/node-http-handler` (the AWS SDK's\n * node request handler; see `setSocketTimeout` in its `set-socket-timeout`\n * module, `DEFER_EVENT_LISTENER_TIME`). They are not part of any public API\n * contract and could change in a future SDK release. The \"downloads\" tests\n * in s3.test.ts characterize this behavior and will fail if it drifts — if\n * they break after a dependency bump, re-read the handler source and\n * re-evaluate the 6s floor below.\n *\n * Defaults to `min(uploadTimeoutMs, 15_000)`, clamped to a minimum of\n * `6_000`.\n */\n requestTimeoutMs?: number\n /**\n * The maximum time establishing a connection to S3 can take, in\n * milliseconds.\n *\n * Defaults to 5_000.\n */\n connectionTimeoutMs?: number\n /**\n * The maximum total time a blob upload can take, in milliseconds. Since\n * uploaded bytes are streamed from the client, this timeout should be large\n * enough to accommodate slow clients uploading large blobs.\n */\n uploadTimeoutMs?: number\n} & Omit<S3ClientConfig, 'apiVersion' | 'requestHandler'>\n\nexport class S3BlobStore implements BlobStore {\n private client: S3\n private bucket: string\n private uploadTimeoutMs: number\n\n constructor(\n public did: string,\n cfg: S3Config,\n ) {\n const {\n bucket,\n uploadTimeoutMs = 10 * SECOND,\n // @NOTE The request timeout acts as a stall detector (socket idle\n // timeout) and should stay short even when uploadTimeoutMs is large,\n // so that stalled S3 connections are reaped and retried quickly. The 6s\n // floor keeps the idle timeout from applying to streamed (client-paced)\n // blob downloads (see S3Config.requestTimeoutMs).\n requestTimeoutMs = Math.max(\n Math.min(uploadTimeoutMs, 15 * SECOND),\n 6 * SECOND,\n ),\n connectionTimeoutMs = 5 * SECOND,\n ...rest\n } = cfg\n this.bucket = bucket\n this.uploadTimeoutMs = uploadTimeoutMs\n this.client = new S3({\n ...rest,\n apiVersion: '2006-03-01',\n // Ensures that all requests timeout under \"requestTimeoutMs\".\n //\n // @NOTE This will also apply to the upload of each individual blob\n // chunk when using Upload from @aws-sdk/lib-storage. This is fine\n // because chunks are buffered in memory before being sent, meaning that\n // requests to S3 are not client-paced.\n requestHandler: {\n requestTimeout: requestTimeoutMs,\n connectionTimeout: connectionTimeoutMs,\n },\n })\n }\n\n static creator(cfg: S3Config) {\n return (did: string) => {\n return new S3BlobStore(did, cfg)\n }\n }\n\n private genKey() {\n return randomStr(32, 'base32')\n }\n\n private getTmpPath(key: string): string {\n return `tmp/${this.did}/${key}`\n }\n\n private getStoredPath(cid: CID): string {\n return `blocks/${this.did}/${cid.toString()}`\n }\n\n private getQuarantinedPath(cid: CID): string {\n return `quarantine/${this.did}/${cid.toString()}`\n }\n\n private async uploadBytes(path: string, bytes: Uint8Array | stream.Readable) {\n // @NOTE we use Upload rather than client.putObject because stream length is\n // not known in advance. See also aws/aws-sdk-js-v3#2348.\n //\n // See also https://github.com/aws/aws-sdk-js-v3/issues/6426, wherein Upload\n // may hang the s3 connection under certain circumstances. We don't have a\n // good way to avoid this, so we use timeouts defensively on all s3\n // requests.\n\n const abortSignal = AbortSignal.timeout(this.uploadTimeoutMs)\n const abortController = new AbortController()\n abortSignal.addEventListener('abort', () => abortController.abort())\n\n const upload = new Upload({\n client: this.client,\n params: {\n Bucket: this.bucket,\n Body: bytes,\n Key: path,\n },\n abortController,\n })\n\n try {\n await upload.done()\n } catch (err) {\n // Translate aws-sdk's abort error (total upload timeout) and timeout\n // errors (stalled connections, after the SDK exhausted its retries) to\n // something more specific\n if (\n err instanceof Error &&\n (err.name === 'AbortError' || err.name === 'TimeoutError')\n ) {\n throw new Error('Blob upload timed out', { cause: err })\n }\n\n throw err\n }\n }\n\n async putTemp(bytes: Uint8Array | stream.Readable): Promise<string> {\n const key = this.genKey()\n await this.uploadBytes(this.getTmpPath(key), bytes)\n return key\n }\n\n async makePermanent(key: string, cid: CID): Promise<void> {\n try {\n // @NOTE we normally call this method when we know the file is temporary.\n // Because of this, we optimistically move the file, allowing to make\n // fewer network requests in the happy path.\n await this.move({\n from: this.getTmpPath(key),\n to: this.getStoredPath(cid),\n })\n } catch (err) {\n // If the optimistic move failed because the temp file was not found,\n // check if the permanent file already exists. If it does, we can assume\n // that another process made the file permanent concurrently, and we can\n // no-op.\n if (err instanceof BlobNotFoundError) {\n // Blob was not found from temp storage...\n const alreadyHas = await this.hasStored(cid)\n // already saved, so we no-op\n if (alreadyHas) return\n }\n\n throw err\n }\n }\n\n async putPermanent(\n cid: CID,\n bytes: Uint8Array | stream.Readable,\n ): Promise<void> {\n await this.uploadBytes(this.getStoredPath(cid), bytes)\n }\n\n async quarantine(cid: CID): Promise<void> {\n await this.move({\n from: this.getStoredPath(cid),\n to: this.getQuarantinedPath(cid),\n })\n }\n\n async unquarantine(cid: CID): Promise<void> {\n await this.move({\n from: this.getQuarantinedPath(cid),\n to: this.getStoredPath(cid),\n })\n }\n\n private async getObject(cid: CID) {\n const res = await this.client.getObject({\n Bucket: this.bucket,\n Key: this.getStoredPath(cid),\n })\n if (res.Body) {\n return res.Body\n } else {\n throw new BlobNotFoundError()\n }\n }\n\n async getBytes(cid: CID): Promise<Uint8Array> {\n const res = await this.getObject(cid)\n return res.transformToByteArray()\n }\n\n async getStream(cid: CID): Promise<stream.Readable> {\n const res = await this.getObject(cid)\n return res as stream.Readable\n }\n\n async delete(cid: CID): Promise<void> {\n await this.deleteKey(this.getStoredPath(cid))\n }\n\n async deleteMany(cids: CID[]): Promise<void> {\n const errors: unknown[] = []\n for (const chunk of chunkArray(cids, 500)) {\n try {\n const keys = chunk.map((cid) => this.getStoredPath(cid))\n await this.deleteManyKeys(keys)\n } catch (err) {\n errors.push(err)\n }\n }\n if (errors.length) throw aggregateErrors(errors)\n }\n\n async hasStored(cid: CID): Promise<boolean> {\n return this.hasKey(this.getStoredPath(cid))\n }\n\n async hasTemp(key: string): Promise<boolean> {\n return this.hasKey(this.getTmpPath(key))\n }\n\n private async hasKey(key: string) {\n try {\n const res = await this.client.headObject({\n Bucket: this.bucket,\n Key: key,\n })\n return res.$metadata.httpStatusCode === 200\n } catch (err) {\n return false\n }\n }\n\n private async deleteKey(key: string) {\n await this.client.deleteObject({\n Bucket: this.bucket,\n Key: key,\n })\n }\n\n private async deleteManyKeys(keys: string[]) {\n await this.client.deleteObjects({\n Bucket: this.bucket,\n Delete: {\n Objects: keys.map((k) => ({ Key: k })),\n },\n })\n }\n\n private async move(keys: { from: string; to: string }) {\n try {\n await this.client.copyObject({\n Bucket: this.bucket,\n CopySource: `${this.bucket}/${keys.from}`,\n Key: keys.to,\n })\n } catch (cause) {\n if (cause instanceof NoSuchKey) {\n // Already deleted, possibly by a concurrently running process\n throw new BlobNotFoundError(undefined, { cause })\n }\n\n throw cause\n }\n\n try {\n await this.client.deleteObject({\n Bucket: this.bucket,\n Key: keys.from,\n })\n } catch (err) {\n if (err instanceof NoSuchKey) {\n // Already deleted, possibly by a concurrently running process\n return\n }\n\n throw err\n }\n }\n}\n\nexport default S3BlobStore\n"]}
@@ -0,0 +1,4 @@
1
+ export interface ImageInvalidator {
2
+ invalidate(subject: string, paths: string[]): Promise<void>;
3
+ }
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5D"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// @NOTE keep in sync with same interface in bsky/src/image/invalidator.ts\n// this is separate to avoid the dependency on @atproto/bsky.\nexport interface ImageInvalidator {\n invalidate(subject: string, paths: string[]): Promise<void>\n}\n"]}
package/dist/util.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { ImageInvalidator } from './types.js';
2
+ export declare class MultiImageInvalidator implements ImageInvalidator {
3
+ invalidators: ImageInvalidator[];
4
+ constructor(invalidators: ImageInvalidator[]);
5
+ invalidate(subject: string, paths: string[]): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,qBAAa,qBAAsB,YAAW,gBAAgB;IACzC,YAAY,EAAE,gBAAgB,EAAE;IAAnD,YAAmB,YAAY,EAAE,gBAAgB,EAAE,EAAI;IACjD,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,iBAMhD;CACF"}
package/dist/util.js ADDED
@@ -0,0 +1,10 @@
1
+ import { allFulfilled } from '@atproto/common';
2
+ export class MultiImageInvalidator {
3
+ constructor(invalidators) {
4
+ this.invalidators = invalidators;
5
+ }
6
+ async invalidate(subject, paths) {
7
+ await allFulfilled(this.invalidators.map((invalidator) => invalidator.invalidate(subject, paths)));
8
+ }
9
+ }
10
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG9C,MAAM,OAAO,qBAAqB;IAChC,YAAmB,YAAgC;4BAAhC,YAAY;IAAuB,CAAC;IACvD,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,KAAe;QAC/C,MAAM,YAAY,CAChB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACpC,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CACvC,CACF,CAAA;IACH,CAAC;CACF","sourcesContent":["import { allFulfilled } from '@atproto/common'\nimport type { ImageInvalidator } from './types.js'\n\nexport class MultiImageInvalidator implements ImageInvalidator {\n constructor(public invalidators: ImageInvalidator[]) {}\n async invalidate(subject: string, paths: string[]) {\n await allFulfilled(\n this.invalidators.map((invalidator) =>\n invalidator.invalidate(subject, paths),\n ),\n )\n }\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@atproto/aws",
3
+ "version": "0.0.0-spaces-alpha-20260818163953",
4
+ "license": "MIT",
5
+ "description": "Shared AWS cloud API helpers for atproto services",
6
+ "keywords": [
7
+ "atproto",
8
+ "aws"
9
+ ],
10
+ "homepage": "https://atproto.com",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/bluesky-social/atproto",
14
+ "directory": "packages/aws"
15
+ },
16
+ "files": [
17
+ "./dist",
18
+ "./README.md",
19
+ "./CHANGELOG.md"
20
+ ],
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ }
27
+ },
28
+ "engines": {
29
+ "node": ">=22"
30
+ },
31
+ "dependencies": {
32
+ "@aws-sdk/client-cloudfront": "^3.879.0",
33
+ "@aws-sdk/client-kms": "^3.879.0",
34
+ "@aws-sdk/client-s3": "^3.879.0",
35
+ "@aws-sdk/lib-storage": "3.879.0",
36
+ "@noble/curves": "^1.7.0",
37
+ "key-encoder": "^2.0.3",
38
+ "multiformats": "^13.0.0",
39
+ "uint8arrays": "^5.0.0",
40
+ "@atproto/common": "^0.0.0-spaces-alpha-20260818163953",
41
+ "@atproto/common-web": "^0.0.0-spaces-alpha-20260818163953",
42
+ "@atproto/crypto": "^0.0.0-spaces-alpha-20260818163953",
43
+ "@atproto/repo": "^0.0.0-spaces-alpha-20260818163953"
44
+ },
45
+ "devDependencies": {
46
+ "vitest": "^4.1.10"
47
+ },
48
+ "scripts": {
49
+ "build": "tsc --build tsconfig.build.json",
50
+ "test": "vitest run"
51
+ }
52
+ }