Repository navigation
v1.0.0
First version: AWS Signature Version 4 signing for every AWS service.
getAuthHeaders(request, credentials)returns the headers to send, for S3 and, withrequest.service, any other service. It never modifies the request or its URL.presign(request, credentials)returns a presigned URL.getAuthHeadersV4aandpresignV4asign with SigV4a (ECDSA P-256) for the regions inrequest.regionSet.chunkSigner(authHeaders, credentials)signs aws-chunked uploads, with signed trailing headers;eventSigner(authHeaders, credentials)signs event-stream messages.- Session tokens (
credentials.sessionToken) and unsigned payloads (request.unsignedPayload). - Path and query encoding, query sorting and header trimming follow the specification; a raw
+in an S3 path is a space, as S3 reads it. Other services normalise the path and encode it twice. - Input that cannot be signed correctly throws:
signHeadersthat namex-amz-date,authorizationor__proto__or hold a line break, a presigned URL that is not http or https or is already presigned, anexpiresoutside 1 to 604800 seconds, and the headers of a SigV4a signature given tochunkSigneroreventSigner. An empty chunk is not signed, because it would end the upload. - No dependencies. Node.js 22.12 and later, Bun, Deno and Cloudflare Workers; the signing-key cache is shared by an entry's signers.
- Each signer is its own module and export, so a bundle holds only what it imports. Node and Bun load one built file (
dist/) instead of six modules (thenodecondition resolves todist/node.js); theworkerd,workerandbrowserconditions resolve tosrc/web.jsanddefaulttosrc/node.js, which keep the per-signer modules. - Cloudflare Workers and browsers get a WebCrypto implementation through the
workerd,workerandbrowserexport conditions, with or withoutnodejs_compat. There every signer returns a promise (the chunk and event signers' methods do); the types arex | Promise<x>, so alwaysawait.sigflint/webimports that implementation directly. - Speed, memory and size are measured against six other libraries (
docs/benchmarks.md,bench/).