Problem
RFC 9530 (Feb 2024, replaces RFC 3230) defines Repr-Digest and Content-Digest for verifying body integrity. Storage backends (S3-style) and bot-auth (Cloudflare) ecosystems are adopting it. Without a helper, users hand-roll WebCrypto + base64 + SF formatting.
Proposal
New subpath misina/digest:
import { withDigest, verifyDigest } from 'misina/digest'
// Auto-add Content-Digest on outgoing requests with body
const api = withDigest(misina, { algorithm: 'sha-256' })
// Verify response Content-Digest
await verifyDigest(response) // throws DigestMismatchError on failure
Implementation:
crypto.subtle.digest (cross-runtime)
- Base64 encode (RFC 9530 SF byte-sequence)
- TransformStream for streaming bodies (don't buffer huge requests)
Depends on RFC 9651 SF parser (#20) for output formatting.
Acceptance criteria
Refs
Problem
RFC 9530 (Feb 2024, replaces RFC 3230) defines
Repr-DigestandContent-Digestfor verifying body integrity. Storage backends (S3-style) and bot-auth (Cloudflare) ecosystems are adopting it. Without a helper, users hand-roll WebCrypto + base64 + SF formatting.Proposal
New subpath
misina/digest:Implementation:
crypto.subtle.digest(cross-runtime)Depends on RFC 9651 SF parser (#20) for output formatting.
Acceptance criteria
withDigest(misina, opts)addsContent-Digest: sha-256=:...:headerverifyDigest(response)validates and throws on mismatchRefs