API Key Encryption, Sliding-Window Rate Limiting & Constant-Time Webhooks
Security & Rate Limiting
#security#api-keys#rate-limiting#sliding-window#stripe-webhook#timingSafeEqual#rls
How SHDWsdk protects your telemetry pipeline against key compromise, flood attacks, and timing side-channels.
How It Works Under the Hood
- •Raw API keys (shdw_live_*) are shown only once at creation; only their SHA-256 digest (key_hash) is stored in PostgreSQL.
- •The ingest-telemetry Edge Function enforces a dual-layer sliding-window rate limit (120 requests / 60s per organization, 600 for partner keys) combining isolate-local burst rejection with the atomic PostgreSQL RPC check_and_increment_ingest_rate_limit, returning HTTP 429 with Retry-After headers on flood attempts.
- •Stripe billing webhooks verify HMAC-SHA256 signatures using a constant-time byte comparison helper (timingSafeEqual) and a 300-second replay window guard.
How to Use It Step-by-Step
- 1Create and rotate API keys in Settings → Developer Settings & API Keys.
- 2Keep your raw shdw_live_* key in server-side environment variables (never expose service keys in client-side code).
Related guides
- Security and data handling: sign-in, regions, subprocessors, retention
- Data retention, legal hold, export and deletion
- Interactive CLI Setup Wizard (npx @shdwsdk/sdk init / npx shdw-init)
- Non-Blocking Client Wrapper (shdw.wrapClient) & Fail-Silent Guarantee
- Layer 1: Zero-Touch Runtime AI-BOM Auto-Discovery & Zero-Knowledge Prompt Hashing
- Layer 2: RAG & Vector Database Auto-Instrumentation (shdw.wrapVectorStore)
- Layer 3: Static Manifest & CI/CD Auto-Scanner (@shdwsdk/sdk/scanner)
- Layer 4: Model Integrity & CycloneDX / SPDX Exporters
