UNPKG

inngest

Version:

Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.

1 lines 953 B
{"version":3,"file":"crypto.cjs","names":[],"sources":["../../src/helpers/crypto.ts"],"sourcesContent":["/**\n * Create a cryptographically secure random value.\n *\n * @throws {Error} If the crypto module is not available.\n */\nexport function createEntropy(byteLength: number): Uint8Array {\n const bytes = new Uint8Array(byteLength);\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Crypto#browser_compatibility\n const { crypto } = globalThis;\n if (!crypto) {\n // This should only happen in Node <19.\n throw new Error(\"missing crypto module\");\n }\n if (!crypto.getRandomValues) {\n throw new Error(\"missing crypto.getRandomValues\");\n }\n\n crypto.getRandomValues(bytes);\n return bytes;\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,cAAc,YAAgC;CAC5D,MAAM,QAAQ,IAAI,WAAW,WAAW;CAGxC,MAAM,EAAE,WAAW;AACnB,KAAI,CAAC,OAEH,OAAM,IAAI,MAAM,wBAAwB;AAE1C,KAAI,CAAC,OAAO,gBACV,OAAM,IAAI,MAAM,iCAAiC;AAGnD,QAAO,gBAAgB,MAAM;AAC7B,QAAO"}