code: function tryParseHexToBytes(hexStr) {
      if ((hexStr.length % 2) !== 0) {
        return null;
      }
  
      const result = [];
      for (let i = 0; i < hexStr.length; i += 2) {
        const value = parseInt(hexStr.substr(i, 2), 16);
        if (isNaN(value)) {
          return null;
        }
        result.push(value);
      }
  
      return result;
    }
docs: Parses |hexStr| to an array of bytes, or returns null if the input is not a
  valid hex string.