Crypto Testing
    Preparing search index...

    Function expectValidHex

    • Assert that value is a valid hex-encoded string.

      Parameters

      • value: string

        The string to validate.

      • Optionallength: number

        Expected byte length (hex chars / 2). If provided, the hex string must encode exactly this many bytes.

      Returns void

      import { expectValidHex } from "@sebastienrousseau/crypto-testing";

      expectValidHex("deadbeef"); // passes
      expectValidHex("deadbeef", 4); // passes (4 bytes = 8 hex chars)

      If the value is not valid hex or the wrong length.