Skip to main content

Function: hexToBytes()

function hexToBytes(value, byteLength?): Uint8Array;

Defined in: packages/overcast-core/src/utils.ts:124

Decode a hex string to its raw bytes. Re-validates rather than trusting the brand — a Hex can always have been minted by a cast — because these bytes feed signed preimages, where a silent truncation produces a digest no chain will match.

Parameters

ParameterTypeDescription
valueHex-
byteLength?numberwhen given, require exactly this many bytes.

Returns

Uint8Array