Assert that value is a valid hex-encoded string.
value
The string to validate.
Optional
Expected byte length (hex chars / 2). If provided, the hex string must encode exactly this many bytes.
import { expectValidHex } from "@sebastienrousseau/crypto-testing";expectValidHex("deadbeef"); // passesexpectValidHex("deadbeef", 4); // passes (4 bytes = 8 hex chars) Copy
import { expectValidHex } from "@sebastienrousseau/crypto-testing";expectValidHex("deadbeef"); // passesexpectValidHex("deadbeef", 4); // passes (4 bytes = 8 hex chars)
If the value is not valid hex or the wrong length.
Assert that
valueis a valid hex-encoded string.