Skip to content

Latest commit

 

History

History
250 lines (180 loc) · 9.28 KB

README.md

File metadata and controls

250 lines (180 loc) · 9.28 KB


Logo

Passport Verification Api

A restful Api for verifying passport


Table of Contents
  1. About The Project
  2. Getting Started
  3. License
  4. Contact
  5. Acknowledgments

About The Project

Project Scope

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

Project Design

Architecture

System uses a restfull api to share its resources. But what is a rest API?

architecture Diagram

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.

Endpoint Design

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

How does the verification work?

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.

CloneDetection

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.
CloneDetection
  • Clone Detection. Cloning, copying and pasting of certain objects or areas in the image is detected with scaling and rotation support.
CloneDetection
  • 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.

CloneDetection

Above diagram shows Double Compression Artifacts

Built With

Used python , flask, tensorflow, keras and Jason Web Token to build the rest api, including postman for testing.

Python Python Python Python

(back to top)

Getting Started

Prerequisites

You should have the below software installed in your pc :

  • Python3
  • Anaconda
  • Tesseract OCR
  • and your preferred IDE or text editor

Installation

  1. Get a free API Key at https://github.com/settings/tokens

  2. Clone the repo

    git clone https://github.com/kudzaiprichard/passport-verification-api
  3. Open project in desired IDE or text editor

  4. Create a python environment

    python -m venv myenv
  5. Activate created environment

    source myenv/bin/activate
  6. Install required python packages

    pip install -r requirements.txt
  7. You can now run the system using below flask command

    flask run

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

🔥 Contribution

Your contributions are always welcome and appreciated. Following are the things you can do to contribute to this project.

  1. 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.

  2. Request a feature
    You can also request for a feature here, and if it will viable, it will be picked for development.

  3. 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.

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Kudzai P Matizirofa - linkedin.com/in/kudzai-prichard - [email protected]

Project Link: https://github.com/kudzaiprichard/passport-verification-api

(back to top)

Acknowledgments

list of resources I found helpful and would like to give credit to.

(back to top)