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
  1. 1Create and rotate API keys in Settings → Developer Settings & API Keys.
  2. 2Keep your raw shdw_live_* key in server-side environment variables (never expose service keys in client-side code).

Related guides