verified 1.3.1 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/verified/parser/mrz/check.rb +28 -19
- data/lib/verified/parser/mrz/yy_date.rb +12 -2
- data/lib/verified/version.rb +1 -1
- data/verified.gemspec +2 -2
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 428fa44212b4131c25dfc466ab1d6dd5ed0f1d25
|
4
|
+
data.tar.gz: a853ccd41f7ff35921a8201ba4c7c88c6ba5a610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e76a0e0f12d0abe3b98ee38754d18a62d223328daa65a46792269724a73d94f34f03727ae42063a4f897abc634ddbc4c9270bd6aba870a261f818556f6cdddb7
|
7
|
+
data.tar.gz: 41efd277424c9e4e5db6c8021a22c6395d112a5986586fb19722851df8f6476c2f80d7d99e5cd325d34d3e9bc786df96613135b0e80e61488eb193d83477274a
|
data/README.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# Verified has moved!
|
2
|
+
|
3
|
+
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](https://github.com/rubymeow/identification). I will no longer be supporting verified and I highly recommend you move over to identification. Thanks!
|
4
|
+
|
1
5
|
# Verified
|
2
6
|
|
3
7
|
A simple Ruby Gem to verify and parse MRZ codes on passports. Useful if you need to meet KYC or Money Laundering requirements.
|
@@ -6,25 +6,11 @@ module MRZ
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def check(mrz_line_1, mrz_line_2)
|
9
|
-
|
9
|
+
|
10
10
|
if mrz_line_1.length != 44 && mrz_line_2.length != 44
|
11
11
|
return false
|
12
12
|
end
|
13
13
|
|
14
|
-
# Read the first line without chevrons
|
15
|
-
split = mrz_line_1.split(/<+/)
|
16
|
-
|
17
|
-
doc_data = Hash.new(9)
|
18
|
-
doc_data["issuing_state"] = mrz_line_1[2...5].sub(/<+/, '')
|
19
|
-
doc_data["last_name"] = split[1][3..-1]
|
20
|
-
doc_data["first_names"] = split[2..-1]
|
21
|
-
doc_data["passport_number"] = mrz_line_2[0...9]
|
22
|
-
doc_data["nationality"] = mrz_line_2[10...13].sub(/<+/, '')
|
23
|
-
doc_data["date_of_birth"] = @@date_converter.convert_to_date(mrz_line_2[13...19])
|
24
|
-
doc_data["gender"] = mrz_line_2[20].sub(/<+/, '')
|
25
|
-
doc_data["expiry_date"] = @@date_converter.convert_to_date(mrz_line_2[21...27])
|
26
|
-
doc_data["personal_number"] = mrz_line_2[28...42].sub(/<+/, '')
|
27
|
-
|
28
14
|
# Grabbing the MRZ's check digits
|
29
15
|
doc_check = Array.new
|
30
16
|
doc_check[0] = mrz_line_2[9].to_s
|
@@ -39,14 +25,37 @@ module MRZ
|
|
39
25
|
our_check[1] = @@digit_checker.check_calc(mrz_line_2[13...19])
|
40
26
|
our_check[2] = @@digit_checker.check_calc(mrz_line_2[21...27])
|
41
27
|
our_check[3] = @@digit_checker.check_calc(mrz_line_2[28...42])
|
42
|
-
our_check[4]
|
28
|
+
our_check[4] = @@digit_checker.check_calc(mrz_line_2[0...10]+mrz_line_2[13...20]+mrz_line_2[21...43])
|
43
29
|
|
44
30
|
# The 4th check digit can be either > or 0, we always return 0 from our CheckDigit calc.
|
45
31
|
if our_check[3] == "0" && doc_check[3] == "<"
|
46
|
-
|
32
|
+
our_check[3] = "<"
|
47
33
|
end
|
48
|
-
|
49
|
-
|
34
|
+
|
35
|
+
if doc_check.uniq.sort == our_check.uniq.sort
|
36
|
+
# Read the first line without chevrons
|
37
|
+
split = mrz_line_1.split(/<+/)
|
38
|
+
|
39
|
+
doc_data = Hash.new(9)
|
40
|
+
doc_data["date_of_birth"] = @@date_converter.convert_to_date(mrz_line_2[13...19])
|
41
|
+
doc_data["expiry_date"] = @@date_converter.convert_to_date(mrz_line_2[21...27])
|
42
|
+
|
43
|
+
# Incase of an invalid date...
|
44
|
+
if doc_data["date_of_birth"] == false || doc_data["expiry_date"] == false
|
45
|
+
return false
|
46
|
+
end
|
47
|
+
|
48
|
+
doc_data["issuing_state"] = mrz_line_1[2...5].sub(/<+/, '')
|
49
|
+
doc_data["last_name"] = split[1][3..-1]
|
50
|
+
doc_data["first_names"] = split[2..-1]
|
51
|
+
doc_data["passport_number"] = mrz_line_2[0...9]
|
52
|
+
doc_data["nationality"] = mrz_line_2[10...13].sub(/<+/, '')
|
53
|
+
doc_data["gender"] = mrz_line_2[20].sub(/<+/, '')
|
54
|
+
doc_data["personal_number"] = mrz_line_2[28...42].sub(/<+/, '')
|
55
|
+
|
56
|
+
return doc_data
|
57
|
+
end
|
58
|
+
|
50
59
|
return false
|
51
60
|
end
|
52
61
|
end
|
@@ -9,8 +9,18 @@ module MRZ
|
|
9
9
|
input_year_yy = input_date[0..1]
|
10
10
|
input_month = input_date[2..3]
|
11
11
|
input_day = input_date[4..5]
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
begin
|
14
|
+
return Date.parse(input_day+"-"+input_month+"-"+"19"+input_year_yy) if input_year_yy >= current_year_yy
|
15
|
+
rescue
|
16
|
+
return false
|
17
|
+
end
|
18
|
+
|
19
|
+
begin
|
20
|
+
return Date.parse(input_day+"-"+input_month+"-"+"20"+input_year_yy)
|
21
|
+
rescue
|
22
|
+
return false
|
23
|
+
end
|
14
24
|
end
|
15
25
|
end
|
16
26
|
end
|
data/lib/verified/version.rb
CHANGED
data/verified.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Ruby"]
|
10
10
|
spec.email = ["hi@ruby.sh"]
|
11
11
|
|
12
|
-
spec.summary = "Really simple passport, drivers license and other identification parsing and verification."
|
13
|
-
spec.description = "
|
12
|
+
spec.summary = "NO LONGER SUPPORTED, CHECK THE GITHUB - Really simple passport, drivers license and other identification parsing and verification."
|
13
|
+
spec.description = "CHECK GITHUB - THIS GEM WILL NO LONGER BE UPDATED - a simple gem to verify and parse MRZ codes and numbers on passports and UK drivers licenses. Useful if you need to comply with KYC or Money Laundering ID checks."
|
14
14
|
spec.homepage = "http://github.com/rubymeow/verified"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verified
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description:
|
56
|
-
|
57
|
-
checks.
|
55
|
+
description: CHECK GITHUB - THIS GEM WILL NO LONGER BE UPDATED - a simple gem to verify
|
56
|
+
and parse MRZ codes and numbers on passports and UK drivers licenses. Useful if
|
57
|
+
you need to comply with KYC or Money Laundering ID checks.
|
58
58
|
email:
|
59
59
|
- hi@ruby.sh
|
60
60
|
executables: []
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
-
- .gitattributes
|
65
|
-
- .gitignore
|
66
|
-
- .travis.yml
|
64
|
+
- ".gitattributes"
|
65
|
+
- ".gitignore"
|
66
|
+
- ".travis.yml"
|
67
67
|
- Gemfile
|
68
68
|
- LICENSE.txt
|
69
69
|
- README.md
|
@@ -93,12 +93,12 @@ require_paths:
|
|
93
93
|
- lib
|
94
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
@@ -106,6 +106,6 @@ rubyforge_project:
|
|
106
106
|
rubygems_version: 2.4.8
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
|
-
summary: Really simple passport, drivers license
|
110
|
-
and verification.
|
109
|
+
summary: NO LONGER SUPPORTED, CHECK THE GITHUB - Really simple passport, drivers license
|
110
|
+
and other identification parsing and verification.
|
111
111
|
test_files: []
|