sigflint 1.0.0 → 1.0.2
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 +15 -0
- package/README.md +26 -8
- package/dist/bun.js +267 -142
- package/dist/node.js +281 -151
- package/index.d.ts +8 -2
- package/package.json +47 -38
- package/src/base.js +264 -60
- package/src/bun.js +11 -0
- package/src/chunks.js +66 -17
- package/src/ecdsa-node.js +16 -1
- package/src/events.js +44 -6
- package/src/node.js +30 -4
- package/src/presign.js +80 -13
- package/src/v4a.js +89 -19
- package/src/web.js +195 -30
- package/types/base.d.ts +82 -35
- package/types/chunks.d.ts +37 -11
- package/types/ecdsa-node.d.ts +7 -2
- package/types/events.d.ts +26 -6
- package/types/presign.d.ts +20 -10
- package/types/v4a.d.ts +42 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 1.0.2 - 2026-10-29
|
|
6
|
+
|
|
7
|
+
- Node and Bun load unminified files bundled with Bun instead of esbuild. The files are 24,690 and 23,518 bytes, compared with 24,374 and 23,200 bytes in the published 1.0.1 package. Builds, checks and publishing use Bun 1.4.4.
|
|
8
|
+
- Speed, memory, import and size measurements were repeated on the shipped build with Node 26.12.1 and Bun 1.4.4. The five-round comparison against published 1.0.1 found no clear S3 signing-speed change. Charts and tables in `docs/benchmarks.md` show the new figures and limits. Header signing alone is 5,677 bytes minified and 2,769 bytes gzipped for the Node entry.
|
|
9
|
+
- Formatting, lint and strict type checks now cover the library, tests, conformance generators and benchmark tools. Bun formats and checks types; TypeScript emits declarations. Public signing APIs and types are unchanged. Generated declarations for internal helpers now have parameter types instead of `any`.
|
|
10
|
+
|
|
11
|
+
## 1.0.1 - 2026-10-18
|
|
12
|
+
|
|
13
|
+
- A lowercase `method` (`get`) is signed as upper case (`GET`), as botocore does. `fetch` sends `get`, `put`, `post`, `delete`, `head` and `options` in upper case, so before this the signature did not match and the service answered `SignatureDoesNotMatch`. Node's `fetch` sends `patch` as written, so pass `PATCH` in upper case to both sigflint and `fetch`.
|
|
14
|
+
- `end(trailers)` on a chunk signer throws a `TypeError` when a trailer name or value holds a line break. Before, the break was signed as another trailer line.
|
|
15
|
+
- Correction to the 1.0.0 entry: a raw `+` in an S3 path is signed as a space, but "as S3 reads it" was not verified. Nothing has been tried against AWS S3, and a local `s3s-fs` 0.17.0 server reads a raw `+` as a plus sign and rejected the signature. Write `%2B` in the URL to mean a plus: that server accepted it from sigflint and from botocore. The signing is unchanged (`docs/guide.md`).
|
|
16
|
+
- Correction to the 1.0.0 entry: a bundler that picks the `node` or `bun` condition gets the built file (`dist/`) and drops unused signers just as well; the per-signer modules (`src/`) go to the `workerd`, `worker` and `browser` conditions and to bundlers that match none of them.
|
|
17
|
+
|
|
3
18
|
## 1.0.0 - 2026-10-16
|
|
4
19
|
|
|
5
20
|
First version: AWS Signature Version 4 signing for every AWS service.
|
package/README.md
CHANGED
|
@@ -5,8 +5,24 @@
|
|
|
5
5
|
</picture>
|
|
6
6
|
</h1>
|
|
7
7
|
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://github.com/bompus/sigflint/actions/workflows/ci.yml"><img src="https://github.com/bompus/sigflint/actions/workflows/ci.yml/badge.svg" alt="CI status"></a>
|
|
10
|
+
<a href="https://github.com/bompus/sigflint/releases/latest"><img src="https://badgen.net/github/release/bompus/sigflint" alt="Latest GitHub release"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/sigflint"><img src="https://badgen.net/npm/v/sigflint" alt="Latest sigflint version on npm"></a>
|
|
12
|
+
<a href="LICENSE"><img src="https://badgen.net/badge/license/MIT/blue" alt="MIT license"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="docs/guide.md#usage">Headers and presigned URLs</a> ·
|
|
17
|
+
<a href="docs/guide.md#sigv4a-multi-region">SigV4a</a> ·
|
|
18
|
+
<a href="docs/guide.md#chunked-uploads">Chunked uploads and event streams</a> ·
|
|
19
|
+
<a href="package.json">No dependencies</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
8
22
|
Fast AWS Signature Version 4 request signing for every AWS service, with no dependencies. It runs on Node.js, Bun, Deno, Cloudflare Workers and browsers.
|
|
9
23
|
|
|
24
|
+
Signs an S3 GET in 0.97 µs on Node, 5.3 times as fast as `aws4`, with the same signatures as botocore on 6,582 test requests.
|
|
25
|
+
|
|
10
26
|
```js
|
|
11
27
|
import { getAuthHeaders } from 'sigflint';
|
|
12
28
|
|
|
@@ -20,11 +36,18 @@ const response = await fetch(url, { headers });
|
|
|
20
36
|
|
|
21
37
|
It signs requests with the `Authorization` header or as a presigned URL, for S3 and for any other service (`service: 'dynamodb'`, `'sqs'`, `'execute-api'`, ...), and it also does multi-region signatures (SigV4a), chunked uploads and event streams.
|
|
22
38
|
|
|
23
|
-
- **Correct.** It returns the same signature as botocore for all 3,360 S3 requests in its test corpus, and for 1,622 requests to other services and 1,600 presigned URLs. For S3, botocore signs the request after this repository's own path and query normalization (`conformance/oracle.py`), so that step is not checked independently by the corpus; the four S3 examples published by AWS, which are in it, are. SigV4a signatures verify against the AWS CRT's, and chunk and event
|
|
24
|
-
- **Fast.** 1.
|
|
39
|
+
- **Correct.** It returns the same signature as botocore for all 3,360 S3 requests in its test corpus, and for 1,622 requests to other services and 1,600 presigned URLs. For S3, botocore signs the request after this repository's own path and query normalization (`conformance/oracle.py`), so that step is not checked independently by the corpus; the four S3 examples published by AWS, which are in it, are. SigV4a signatures verify against the AWS CRT's, and every chunk and event signature in the test corpus matches the AWS SDK's. See [how it is tested](docs/benchmarks.md#how-it-is-tested).
|
|
40
|
+
- **Fast.** 1.0 to 3.2 µs per header or presigned-URL signature on Node and 0.7 to 3.0 µs on Bun. The other libraries take 2.0 to 75 times as long on the requests they sign correctly. Measured on Node 26.12.1 and Bun 1.4.4; see [speed](docs/benchmarks.md#speed).
|
|
25
41
|
- **Small, and you pay only for what you import.** Signing headers is 5.7 kB minified, 2.8 kB gzipped; presigned URLs, SigV4a, chunked uploads and event streams each add to a bundle only when imported. Nothing to install with it. See [size](docs/benchmarks.md#size).
|
|
26
42
|
- **Everywhere.** One import on Node, Bun, Deno and Cloudflare Workers, with or without `nodejs_compat`. See [runtimes](#runtimes).
|
|
27
43
|
|
|
44
|
+
<picture>
|
|
45
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/speed-dark.svg">
|
|
46
|
+
<img alt="Bar chart: time in microseconds to sign one S3 request on Node.js and Bun, for sigflint and six other libraries" src="docs/speed-light.svg">
|
|
47
|
+
</picture>
|
|
48
|
+
|
|
49
|
+
Microseconds per signature; lower is better. On Node 26.12.1, signing a plain S3 GET takes 0.97 µs with sigflint and 5.11 µs with `aws4`, the fastest of the other libraries.
|
|
50
|
+
|
|
28
51
|
## Install
|
|
29
52
|
|
|
30
53
|
```sh
|
|
@@ -58,7 +81,7 @@ For a large or binary body, skip hashing and send `unsignedPayload: true`. S3 ac
|
|
|
58
81
|
const headers = await getAuthHeaders({ method: 'PUT', url, region, unsignedPayload: true }, credentials);
|
|
59
82
|
```
|
|
60
83
|
|
|
61
|
-
For another S3-compatible service, pass its region name and URL (`https://us-sea-1.linodeobjects.com/bucket/key`, `http://127.0.0.1:9000/bucket/key`). These are examples of the form, not endpoints that were tried
|
|
84
|
+
For another S3-compatible service, pass its region name and URL (`https://us-sea-1.linodeobjects.com/bucket/key`, `http://127.0.0.1:9000/bucket/key`). These are examples of the form, not endpoints that were tried. Signatures are checked against botocore, the AWS CRT, the AWS SDK's signer and the AWS documentation examples. Nothing has been sent to AWS S3, so a service that canonicalizes requests differently from S3 may reject them. The only server tried is a local `s3s-fs` 0.17.0 test server on loopback, once, with header-signed requests (create a bucket, `PUT`, `GET`, list): it accepted them, except that it rejected sigflint's signature for a raw `+` in the path, so write `%2B` ([how the path is read](docs/guide.md#how-it-reads-the-url)).
|
|
62
85
|
|
|
63
86
|
More in the [guide](docs/guide.md): [other services](docs/guide.md#other-services), [presigned URLs](docs/guide.md#presigned-urls), [SigV4a](docs/guide.md#sigv4a-multi-region), [chunked uploads](docs/guide.md#chunked-uploads), [event streams](docs/guide.md#event-streams), why to always `await`, and the [full API](docs/guide.md#api).
|
|
64
87
|
|
|
@@ -68,11 +91,6 @@ Node.js 22.12 and later, Bun, Deno, and Cloudflare Workers with or without `node
|
|
|
68
91
|
|
|
69
92
|
## Benchmarks
|
|
70
93
|
|
|
71
|
-
<picture>
|
|
72
|
-
<source media="(prefers-color-scheme: dark)" srcset="docs/speed-dark.svg">
|
|
73
|
-
<img alt="Bar chart: time in microseconds to sign one S3 request on Node.js and Bun, for sigflint and six other libraries" src="docs/speed-light.svg">
|
|
74
|
-
</picture>
|
|
75
|
-
|
|
76
94
|
Correctness, [speed](docs/benchmarks.md#speed), [memory](docs/benchmarks.md#memory) and [size](docs/benchmarks.md#size), the [test corpora](docs/benchmarks.md#how-it-is-tested) and the [methodology and limits](docs/benchmarks.md#methodology-and-limits) are in [docs/benchmarks.md](docs/benchmarks.md). Every figure there comes from raw results committed in `bench/results/`. The speed, memory and import figures were measured on the code in this release and are re-run before each release.
|
|
77
95
|
|
|
78
96
|
## Scope
|