Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding 'isAdhaar' as a Validator #2027

Closed
Akshat-Mishra101 opened this issue Aug 14, 2022 · 6 comments
Closed

Adding 'isAdhaar' as a Validator #2027

Akshat-Mishra101 opened this issue Aug 14, 2022 · 6 comments

Comments

@Akshat-Mishra101
Copy link

Hey guys, I need permission to add a validator for a popular Indian identity card, called the "Adhaar Card"

What is an Adhaar Number?

According to UIDAI -- Aadhaar number is a 12-digit random number issued by the UIDAI (“Authority”) to the residents of India after satisfying the verification process laid down by the Authority. Any individual, irrespective of age and gender, who is a resident of India, may voluntarily enrol to obtain Aadhaar number.

The rules for an adhaar number are as follows

  • It should have 12 digits.
  • It should not start with 0 and 1.
  • It should not contain any alphabet and special characters.
  • It should have white space after every 4 digits.
@braaar
Copy link
Contributor

braaar commented Aug 15, 2022

I would suggest implementing this as a locale in isIdentityCard(str [, locale])

@Akshat-Mishra101
Copy link
Author

Sure, just one doubt though. Since we already have a locale for the indian region identity (which is not the same as adhaar) how would we include this new identity? or what locale would we choose?

@braaar
Copy link
Contributor

braaar commented Aug 15, 2022

I think adding it as a separate "locale" (not stricly a real locale, but I suppose it's justified when multiple standards exist within the same locale) is the cleanest option. IN-2, IN-2016, IN-UIDAI, IN-aadhaar perhaps?

@braaar
Copy link
Contributor

braaar commented Aug 15, 2022

I just looked into it, and according to the PR where it was added, the existing identity card validator in the INlocale is for aadhaar.

@braaar
Copy link
Contributor

braaar commented Aug 15, 2022

Take a look at the test cases to see what it validates:

locale: 'IN',
valid: [
'298448863364',
'2984 4886 3364',
],
invalid: [
'99999999R',
'12345678Z',
'01234567L',
'01234567l',
'X1234567l',
'x1234567l',
'X1234567L',
],

@Akshat-Mishra101
Copy link
Author

Thanks braaar, this seems it; I'll close this issue. There are a couple of more identifications I'd like to add to this, which I'll open in the next few issues :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants