Reference / @getenginex/sdk/extension / randomId
randomId()
randomId():
string
Random id (UUID v4) for Idempotency-Key: crypto.randomUUID when it exists; otherwise built from crypto.getRandomValues (randomUUID only exists in a secure context, and an app over HTTP on the LAN does not have it). For SDK packages and adapters (via @getenginex/sdk/extension), not for apps.
Returns
string
Example
ts
const order = { ...input, idempotencyKey: input.idempotencyKey ?? randomId() }Throws
CONFIGURATION_ERROR without Web Crypto (neither crypto.randomUUID nor crypto.getRandomValues); never a TypeError.