CodeSampleX

Sample

sign an HTTP request with AWS Signature Version 4 credentials using aws4.sign

sha256:8f8ba492115e5ad229fe51119e4d4882ddb4405af0d88c7720ad4cfc4d2526ab

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux 24 · ubuntu · glibc 2.39 x64 npm

Verification-run environments

Environment Contract Stages Run
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-27

Case

HOW
Goal
sign an HTTP request with AWS Signature Version 4 credentials using aws4.sign
Packages
Symbols
  • aws4.sign
Created
2026-08-27T20:26:37Z

Contract

  1. assert aws4.sign populates Authorization, X-Amz-Date, and Host headers on HTTP request options
  2. assert Authorization header follows AWS4-HMAC-SHA256 format containing Credential, SignedHeaders, and Signature
  3. assert aws4.sign sets Content-Type and Content-Length headers for POST requests with body content
  4. assert aws4.sign adds X-Amz-Security-Token header and includes it in signed headers when sessionToken is provided
  5. assert aws4.sign computes SHA256 payload hash and sets X-Amz-Content-Sha256 header for S3 service requests
  6. assert aws4.sign with signQuery option embeds SigV4 parameters into query string without Authorization header
  7. assert aws4.RequestSigner resolves service name and AWS region automatically from amazonaws.com hostnames
  8. assert aws4.RequestSigner exposes canonicalString, stringToSign, and signature generation methods

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.mjs

Download the source artifact (tar.gz)

Origin Seeder

anonymous