• Check if install code (little-endian) is valid, and if not, and requested, fix it.

    WARNING: Due to conflicting sizes between 8-length code with invalid CRC, and 10-length code missing CRC, given 8-length codes are always assumed to be 8-length code with invalid CRC (most probable scenario).

    Parameters

    • code: Buffer

      The code to check. Reference is not modified by this procedure but is returned when code was valid, as outCode.

    • Optional adjust: boolean

      If false, throws if the install code is invalid, otherwise try to fix it (CRC)

    Returns [outCode: Buffer, adjusted: string | undefined]

    • The adjusted code, or code if not adjusted.
      • If adjust is false, undefined, otherwise, the reason why the code needed adjusting or undefined if not.
      • Throws when adjust=false and invalid, or cannot fix.