Table of Contents
The API verifies the authenticity of passports by checking against global databases, ensuring that you have access to accurate and up-to-date information. Integrate the API into your existing onboarding workflow to streamline your verification process, reduce errors, and improve your operational efficiency.
System uses a simple flask restfull api.It only stores users registration data for authentication and processes the passport. Then it returns the passport data and if It's valid or not. The passport goes through two layers of processing:
- image forgery detection
passport eye
passport details verification
System uses a restfull api to share its resources. But what is a rest API?
REST (Representational State Transfer) is an architectural style that defines a set of constraints for creating web services. REST API is a type of web service that is designed to interact with resources on the web, such as web pages, files, or other data. In the illustration below, we are showing how different types of applications can access a database using REST API.
Below is a screenshot of the project restful api endpoints and the HTTP Method supported by each endpoint
Method | resource |
---|---|
POST | api/v1/auth/register |
POST | api/v1/auth/authenticate |
POST | /api/v1/document/validate/passport |
What is passport Eye?
The package provides tools for recognizing machine-readable zones (MRZ) from scanned identification documents
.
The documents may be located rather arbitrarily on the page. The code tries to find anything resembling a MRZ
and parse it from there.
What is MRZ?
Machine-Readable Zone MRZ
is a codified element of identity documents. Its purpose is to facilitate
easier automated
scanning of basic personal details of the document holder, such as their full name
, document number
, nationality
, date of birth
, and the document expiration date
.
Above diagram shows passport Eye MRZ output
What is image forgery detection?
Image forgery detection can mainly be divided into two categories: active and passive. Sometimes these methods also give a localization of the altered/forged areas of the image, and even provide an estimate of the original visual content
How does image forgery work?
Error Level Analysis
. Manipulation attempts are detected by comparing compression quality between different areas of the image.
Clone Detection
. Cloning, copying and pasting of certain objects or areas in the image is detected with scaling and rotation support.
-
Quantization Table Analysis
. Digital cameras and PC-based image editing tools use different quantization tables when saving encoding images into JPEG format. Quantization tables can be extracted and analyzed. If the tables are different from those used by the camera model as specified in the image's EXIF information, then a manipulation attempt is present. -
Double Compression Artifacts
. JPEG is a lossy compression format, meaning that certain artifacts are introduced every time an image is saved. By opening, editing and saving a JPEG picture, one inevitably introduces compression artifacts that were not present in the original JPEG. As certain correlation of neighboring pixels is only present in JPEG images when they are opened and compressed again, it becomes possible to detect these artifacts and bring investigator's attention to the altered image.
Above diagram shows Double Compression Artifacts
Used python
, flask
, tensorflow
, keras
and Jason Web Token
to build the rest api, including postman
for testing.
You should have the below software installed in your pc :
- Python3
- Anaconda
- Tesseract OCR
- and your preferred IDE or text editor
-
Get a free API Key at https://github.com/settings/tokens
-
Clone the repo
git clone https://github.com/kudzaiprichard/passport-verification-api
-
Open project in desired IDE or text editor
-
Create a python environment
python -m venv myenv
-
Activate created environment
source myenv/bin/activate
-
Install required python packages
pip install -r requirements.txt
-
You can now run the system using below flask command
flask run
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Your contributions are always welcome and appreciated. Following are the things you can do to contribute to this project.
-
Report a bug
If you think you have encountered a bug, and I should know about it, feel free to report it here and I will take care of it. -
Request a feature
You can also request for a feature here, and if it will viable, it will be picked for development. -
Create a pull request
It can't get better than this, your pull request will be appreciated by the community. You can get started by picking up any open issues from here and make a pull request.
If you are new to open-source, make sure to check read more about it here and learn more about creating a pull request here.
Distributed under the MIT License. See
LICENSE.txt
for more information.
Kudzai P Matizirofa - linkedin.com/in/kudzai-prichard - [email protected]
Project Link: https://github.com/kudzaiprichard/passport-verification-api
list of resources I found helpful and would like to give credit to.