kinetex - v1.4.0
    Preparing search index...

    Function generateIdempotencyKey

    • Generate a random Idempotency-Key value.

      Uses crypto.getRandomValues, available in every runtime kinetex targets (Node 18+, Deno, Bun, browsers, Workers) — no dependency, and not Math.random.

      Format is a RFC 9562 v4 UUID: 122 random bits, hyphenated, with the version and variant bits set. Servers that require an opaque string are equally satisfied; UUID is the form Stripe and most others document.

      Returns string

      A fresh key, e.g. "3f2a9c1e-7b4d-4a8f-9c2e-1d5b6f7a8c90".

      If the runtime exposes no CSPRNG.

      client.post("/charges", body, { headers: { "idempotency-key": generateIdempotencyKey() } });