MCPcopy Index your code
hub / github.com/api3dao/airnode / randomHexString

Function randomHexString

packages/airnode-utilities/src/strings/string.ts:3–10  ·  view source on GitHub ↗
(evenLength: number)

Source from the content-addressed store, hash-verified

1import crypto from 'crypto';
2
3export function randomHexString(evenLength: number) {
4 // We could use "string.substring" to enforce length instead, but not sure how would that affect the randomness.
5 // Supporting even lengths is enough for now.
6 if (evenLength % 2 !== 0) {
7 throw new Error(`Expected length to be even. It was: ${evenLength}`);
8 }
9 return crypto.randomBytes(evenLength / 2).toString('hex');
10}

Callers 10

startCoordinatorFunction · 0.90
startCoordinatorFunction · 0.90
heartbeat.test.tsFile · 0.90
buildEVMStateFunction · 0.90
startCoordinatorFunction · 0.90
state.test.tsFile · 0.90
parseOisesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected