Cryptographic Nonce
A cryptographic nonce is a number used once: an unpredictable value included in a protocol so the same message cannot be replayed or forged by reusing old parameters. Nonces appear in PKCE verifiers, signed API requests, TLS handshakes, and CSP script nonces.
Technical Architecture & Deep-Dive
Generate nonces with a CSPRNG, never reuse them across requests, and store seen values long enough to defeat replay windows. PKCE code verifiers are nonces exchanged for authorization codes. HMAC clients send nonce plus timestamp headers that servers verify before accepting the body.
CSP nonces label inline scripts allowed only for that HTML response. Rotate nonces per request at the edge templating layer.
Key Architectural Benefits
Implement Cryptographic Nonce at the Edge
Deploy lightweight API aggregation, edge caching, and secret injection in minutes without Docker containers or complex servers.
Frequently Asked Questions
Q:How long should I remember API nonces?
At least your maximum accepted clock skew plus the longest client retry window, often a few minutes for REST and longer for batch integrations.
Related Architecture Concepts
Replay attack prevention stops adversaries from capturing a valid request or token and sending it again to gain the same effect. Defenses include short-lived timestamps, unique nonces, one-time codes, signed webhook IDs, and idempotency keys tracked server-side.
PKCE, short for Proof Key for Code Exchange, is an OAuth 2.0 extension that protects the authorization code flow for public clients like mobile apps and single-page applications. The client sends a hashed code challenge, then proves possession of the original verifier when exchanging the code for tokens.
HMAC authentication uses a hash-based message authentication code, computed from a message and a shared secret key, to prove that a request came from a holder of the secret and was not modified. The receiver recomputes the HMAC and compares it to the value sent.
Content Security Policy (CSP) is an HTTP response header that tells browsers which sources of scripts, styles, images, and network connections a page is allowed to use. By blocking unapproved sources, CSP reduces the impact of cross-site scripting and data exfiltration.
Ready-to-Use Edge Recipes
Never place API_BEARER_TOKEN inside Frontend / Web source. RealComposer injects them when calling https://{{secrets.API_HOST}}/status, so browsers see only a client token.
Never place CLERK_SECRET_KEY inside Frontend / Web source. RealComposer injects them when calling https://api.clerk.com/v1/users/{{query.userId}}, so browsers see only a client token.
Block browser extraction of list API keys via edge-only authorization headers. For "hide mailchimp api key in client side javascript", store MAILCHIMP_BASIC_AUTH in Secret Vault, call https://{{secrets.MAILCHIMP_DC}}.api.mailchimp.com/3.0/lists/{{query.listId}}/members?count=10 from a Worker, and let JavaScript / HTML hit only https://realcomposer.com/v1/workspace/hide-mailchimp-api-key-javascript with an rc_live_ client token.