idnumbers
    Preparing search index...

    Class Cedula

    Ecuador Cédula de Identidad (national identity number) https://en.wikipedia.org/wiki/National_identification_number#Ecuador

    Structure: PPTSSSSSSC PP - province code (01-24, or 30 for citizens registered abroad) T - person type, 0-5 for a natural-person cédula (4-5 when PP is 30) SSSSSS - sequential registration number C - Luhn (mod 10) check digit

    Deliberately stricter than python-stdnum in two respects (both verified against official Registro Civil guidance, not just "the reference impl"):

    • Third digit is restricted to 0-5. python-stdnum accepts up to 6, but that traces to an uncited, untested one-line upstream change; digit 6 (public-sector entity) and 9 (private company) are RUC (13-digit) markers, not cédula markers.
    • Province 50 is rejected. python-stdnum accepts it via another uncited, untested one-line upstream change; no Ecuadorian source documents a province 50.

    Implements

    Index
    METADATA: IdMetadata = ...
    • Calculate the Luhn (mod 10) check digit over the first 9 digits. Weights are [2,1,2,1,2,1,2,1,2] with products >9 having 9 subtracted; luhnDigit (multipliersStartByTwo=true) implements this exactly.

      Returns null unless the input matches the cédula layout, as the Python library does (#299): nine digits, an optional hyphen or whitespace separator, a final digit, and a province code (digits 1-2) of 01-24 or 30. The input's own last digit and the person-type (third digit) rule are not applied here; validate() does that.

      Parameters

      • idNumber: string

      Returns CheckDigit

    • Parse Ecuador cédula number

      Parameters

      • idNumber: string

      Returns CedulaParseResult | null

    • Validate the ECU cédula number

      Parameters

      • idNumber: string

      Returns boolean