Registry / http-networking / http-message-sig

http-message-sig

JSON →
library0.2.0jsnpmunverified

HTTP Message Signatures implementation conforming to RFC 9421, currently at version 0.2.0 (pre-1.0). Provides synchronous and asynchronous signing and verification of HTTP messages. Forked from ltonetwork/http-message-signatures to address incomplete RFC compliance. Ships TypeScript types. Not audited for security; use with caution.

npm install http-message-sig
INSTALL
IMPORT
SIG · HTTP-MESSAGE-SIG
H
http-message-sig
http-networkingjavascriptv0.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sign
import { sign } from 'http-message-sig'
import sign from 'http-message-sig'
ESM only; named export. No default export.
verify
import { verify } from 'http-message-sig'
const { verify } = require('http-message-sig')
ESM-only package; CommonJS require() will not work.
SignOptions
import type { SignOptions } from 'http-message-sig'
import { SignOptions } from 'http-message-sig'
TypeScript users: import types with `import type` to avoid runtime overhead.

Demonstrates signing and verifying an HTTP message with HMAC-SHA256 using async operations.

import { sign, verify } from 'http-message-sig'; const key = await crypto.subtle.generateKey( { name: 'HMAC', hash: 'SHA-256' }, true, ['sign', 'verify'] ); const message = { method: 'POST', url: '/api/data', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ foo: 'bar' }) }; const signature = await sign(message, { key: key, keyId: 'my-key', algorithm: 'hmac-sha256', created: Math.floor(Date.now() / 1000), expires: Math.floor(Date.now() / 1000) + 3600 }); console.log(signature); const isValid = await verify(message, signature, { key: key, algorithm: 'hmac-sha256' }); console.log('Signature valid:', isValid);
Debug
Known issues
breakingPackage is pre-1.0 (version 0.2.0); API may change without major version bump.
fix
Pin to exact version and test upgrades thoroughly.
affects: >=0.1.0
gotchaESM-only package; cannot be used with CommonJS require().
fix
Use dynamic import() in CJS or switch to ESM.
affects: >=0.1.0
gotchaForked from ltonetwork/http-message-signatures; not fully compliant with RFC 9421 yet.
fix
Review RFC 9421 requirements and verify behavior matches your use case.
affects: 0.2.0
deprecatedPackage has not been audited for security.
fix
Use only in non-critical environments or perform a security audit before production use.
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'http-message-sig' or its corresponding type declarations.
TypeScript may not resolve types for ESM packages if moduleResolution is not set to 'node16' or 'bundler'.
fix
Set 'moduleResolution' to 'node16' or 'bundler' in tsconfig.json.
ERR_REQUIRE_ESM: require() of ES Module http-message-sig from not supported.
Trying to use require() on an ESM-only package.
fix
Use import() syntax or switch to ES modules.
TypeError: crypto.subtle.generateKey is not a function
crypto.subtle is only available in secure contexts (HTTPS/localhost) and Node.js 15+.
fix
Run in a secure context or use Node.js 15+. For Node.js 14 and below, use a polyfill.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
http-message-sig — npm install http-message-sig · libregistry