Verified has moved!

As I'm now expanding Verified to do more than just verify passports (experimental support for UK Drivers Licenses and generators coming soon), I've renamed it "identification" which can be found here. I will no longer be supporting verified and I highly recommend you move over to identification. Thanks!

Verified

A simple Ruby Gem to verify and parse MRZ codes on passports. Useful if you need to meet KYC or Money Laundering requirements.

Examples

Setup a new instance

passport = Verified::Passport.new("mrz_code_1", "mrz_code_2")

and you're done! Use it like this:

passport.verified?
# => true
passport.last_name
# => LAST
passport.gender
# => M

Installation

Add this line to your application's Gemfile:

gem 'verified'

And then execute:

$ bundle

Or install it yourself as:

$ gem install verified

Usage

Passport

Setup your passport instance like so:

passport = Verified::Passport.new("mrz_line_1", "mrz_line_2")
mrz_line_1: The first line of a Passport MRZ (the long strip of text on the bottom). (string, required)
mrz_line_2: The second line of a Passport MRZ (the long strip of text on the bottom). (string, required)

It then can be called using any of the folllowing methods:

verified? : Returns true if it's a valid passport MRZ, false if it's not.
issuing_state : Issuing country of the passport
last_name : Last name on the passport
first_names : Array of first names on the passport (First and any middle names)
passport_number : Passport Number
nationality : Nationality of the person on the passport. Different from the issuing state (eg. Swedish person who is also a citizen of UK.)
date_of_birth : Date of Birth, given as a Ruby Date object.
gender : Gender, given as M, F or nil if not specified.
expiry_date : Expiry date of the passport, given as a Ruby Date object.
personal_number : Personal number, if chosen to be given by issuer. Nil if not specified.

UK Drivers License

This is coming soon, as I'm currently waiting for the DVLA to respond to a freedom of information request that will allow me to understand how the check digits in UK driver numbers are calculated so I can verify them. Feel free to follow the FOI request on WhatDoTheyKnow and I'll update the gem as soon as I can once I have a response.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install the gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rubymeow/verified.

License

The gem is available as open source under the terms of the MIT License.

MRZ parsing based on Document 9303 (Machine Readable Travel Documents - Part 1 - Machine Readable Passports. Volume 1 - Passports with Machine Readable Data Stored in Optical Character Recognition format) by the ICAO which can be found here: http://www.icao.int/publications/pages/publication.aspx?docnum=9303

Warning: This is by no means a KYC solution on it's own. This merely parses MRZ's and validates they are valid mrz codes. This does not confirm the document you are verifying is legitimate.