stdnum.in_.vid

VID (Indian personal virtual identity number).

VID is a temporary, revocable 16-digit random number mapped with the Aadhaar number. VID is used in lieu of Aadhaar number whenever authentication or e-KYC services are performed.

VID is made up of 16 digits where the last digits is a check digit calculated using the Verhoeff algorithm. The numbers are generated in a random, non-repeating sequence and do not begin with 0 or 1.

More information:

>>> validate('2341234123412341')
'2341234123412341'
>>> validate('2341234123412342')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('1341234123412341')  # number should not start with 0 or 1
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('13412341234123')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('2222222222222222')  # number cannot be a palindrome
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('2341234123412342')
'2341 2341 2341 2342'
>>> mask('2341234123412342')
'XXXX XXXX  XXXX 2342'
stdnum.in_.vid.compact(number)

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.in_.vid.format(number)

Reformat the number to the standard presentation format.

stdnum.in_.vid.is_valid(number)

Check if the number provided is a valid VID number. This checks the length, formatting and check digit.

stdnum.in_.vid.mask(number)

Masks the first 8 digits as per Ministry of Electronics and Information Technology (MeitY) guidelines.

stdnum.in_.vid.validate(number)

Check if the number provided is a valid VID number. This checks the length, formatting and check digit.