It's an implementation aimed at mimicking the working of Aadhaar's Authentication and eKYC APIs to use on local environment.
Running Instructions -
- Create postgres and redis
cd db_containers
docker-compose up -d
- Change Dir to NirAadhaar_Server
cd NirAadhaar_Server
- Install python dependencies
pipenv install
- Activate pipenv
pipenv shell
- Migrate Django Models & Authenticate
python manage.py migrate # migrates django models to a sqlite3 db
python manage.py makemigrations authenticate # make migrations for authenticate app
python manage.py migrate --database niraadhaardb # migrate other models to postgresql
- Run Server
python manage.py runserver 0.0.0.0:8000 # starts NirAadhaar server at all IPs that the host pc is connected to
Indexing AUA, ASA and Residents
Aadhaar uses AUAs and ASAs in order to regulate which end points can have access to their database. We should replicate this functionality as well.
navigate to-
http://localhost:8000/admin
Enter super user, username and password.
Add an ASA with info as-
{
"AsaID": "TEST_ASA",
"Asalk": "TEST_ASALK",
"Data": {"AUAList": ["TEST_AUA"]}
}
Add an AUA with info as-
{
"AuaID": "TEST_AUA",
"Asa": "TEST_ASA",
"Data": { "privateKey": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBMDRia29rc1FTS0pEMXJvWmVRVjJ2YjNOT29XcGFMYnp3RDJNVHR6cHpZQUhFWjlSCnE5ZXRqMVBCQmhrZnpsV293TnUvNWloU1MxSkREWnRQd1NzQlJRejhvVHg4WlFSaTl2N3FoODlUaVprVFdyelkKekE5N2UwRWZoYkJCeTZsNGV3WXQ4NVJiZWk5TWxZV3R4TEQ5Z0Z0QlQxWHIrSXNaMldvcnMyMTBrc2Vxemkzdworb0NGanloVWJNRG4yMm1BOUV2VVZLQ1RraEVTWDJ2OXFKSHpTY1YzNVJic2FNWmlLTlNFTDlzY3YwMXQzU2h5CkpKVnlPS1RWcU9iQW9FUVRTaGRMbzUzTkpDci96b3FMR0pxMUtHNXBoTkZ2dmdtLzliVjIwZXA0SGZ5ZkE1c2QKcERFNmt1eEhUQzV3OUxrdFNBN29TSzcrRFFuNDlIaEJXangvTFFJREFRQUJB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4eldXZXBHWm9YbnJBcwpRVlN4VWVMRWdicnV0cGFsT3gySDd2QklocUtpaVM3L1dVQ2QweDBQZWpKSWVGNlpadkUveGYvQ24yV1FFMndMCmtrdjlyV083U0UvMTZlMHd6aEluOFFLQmdRQzlLcnY1blVKMVl5cnRWT3hVdW1iRGlpRExWdmUvS2tQNWxYeGwKcjFISnQrd3BGcXY3VnZ1NGZqb2o3bEw4bDBkWUFJY1dDS0FKMlRhTERDYU9kbkNzbnU0VU9qMTFDcno4b1pzUQptQ21HSk9uMXgwTzBaWnlRYWtmQjUzQjBtV1ZiYUtUdlN1UmdNc2tlQ2t4ZHJuekMrRW5zd2dPU3BvNE5sTFNXCmlsSTZzUUtCZ1FDanEvK0RLbmVlSDNFQzl3bjIrYnZlTy9QcDhqdlFGUmltTVE4Q2IzUWRad0M5NG9XSFpLeWoKVVJ4WU1HOXZPNkxlNlN2cUJncS8rZ3NsdVRXbUMrdHpBU2JYbkpLbUJxZlU3cFp4ZlNPVlFtUGRmQUt0SmFvSwp1U2lnQksyeWlMSzdhMXBwNVQvVnVHdXlBSFd3cWNsVHNEZzlUa0Y1WjBpRHVXL1VOMEhURlE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=", "LicenseRights": "1111111111"}
Add any Aadhaar card's data in the format of SampleAUA/Input_Template.json To Resident Table. For reference on meaning of fields see SampleAUA/Input.json
for sample requests to NirAadhaar Server See SampleAUA module.
from SampleAUA import OTPInit
# It might or might not send OTP to the number, configure your own SMS Gateway or use the way2sms script in OTPgen/views.py/sendSMSto
OTPInit('11', 'AADHAAR_NUMBER_OF_REGISTERD_RESIDENT')
# 11 = send sms and mail both
eKYCInit("JSONInfo based on Input Template [just fill the uid field after importing the json]", "OTP received by the consumer")
# it will either return the error else the saved information of the person