yoti 1.6.4 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +22 -224
- data/lib/yoti.rb +63 -1
- data/lib/yoti/activity_details.rb +3 -5
- data/lib/yoti/client.rb +13 -4
- data/lib/yoti/configuration.rb +8 -3
- data/lib/yoti/data_type/age_verification.rb +1 -1
- data/lib/yoti/data_type/base_profile.rb +1 -1
- data/lib/yoti/data_type/document_details.rb +1 -1
- data/lib/yoti/data_type/image.rb +4 -12
- data/lib/yoti/data_type/image_jpeg.rb +2 -0
- data/lib/yoti/data_type/image_png.rb +2 -0
- data/lib/yoti/data_type/media.rb +22 -0
- data/lib/yoti/data_type/signed_time_stamp.rb +1 -1
- data/lib/yoti/doc_scan/client.rb +191 -0
- data/lib/yoti/doc_scan/constants.rb +35 -0
- data/lib/yoti/doc_scan/errors.rb +81 -0
- data/lib/yoti/doc_scan/session/create/create_session_result.rb +50 -0
- data/lib/yoti/doc_scan/session/create/document_filter.rb +31 -0
- data/lib/yoti/doc_scan/session/create/document_restrictions_filter.rb +140 -0
- data/lib/yoti/doc_scan/session/create/notification_config.rb +142 -0
- data/lib/yoti/doc_scan/session/create/objective/objective.rb +31 -0
- data/lib/yoti/doc_scan/session/create/objective/proof_of_address_objective.rb +31 -0
- data/lib/yoti/doc_scan/session/create/orthogonal_restrictions_filter.rb +150 -0
- data/lib/yoti/doc_scan/session/create/requested_check.rb +39 -0
- data/lib/yoti/doc_scan/session/create/requested_document_authenticity_check.rb +95 -0
- data/lib/yoti/doc_scan/session/create/requested_face_match_check.rb +95 -0
- data/lib/yoti/doc_scan/session/create/requested_id_document_comparison_check.rb +53 -0
- data/lib/yoti/doc_scan/session/create/requested_liveness_check.rb +108 -0
- data/lib/yoti/doc_scan/session/create/requested_supplementary_doc_text_extraction_task.rb +94 -0
- data/lib/yoti/doc_scan/session/create/requested_task.rb +39 -0
- data/lib/yoti/doc_scan/session/create/requested_text_extraction_task.rb +116 -0
- data/lib/yoti/doc_scan/session/create/required_document.rb +31 -0
- data/lib/yoti/doc_scan/session/create/required_id_document.rb +53 -0
- data/lib/yoti/doc_scan/session/create/required_supplementary_document.rb +90 -0
- data/lib/yoti/doc_scan/session/create/sdk_config.rb +221 -0
- data/lib/yoti/doc_scan/session/create/session_specification.rb +221 -0
- data/lib/yoti/doc_scan/session/retrieve/authenticity_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/breakdown_response.rb +38 -0
- data/lib/yoti/doc_scan/session/retrieve/check_response.rb +63 -0
- data/lib/yoti/doc_scan/session/retrieve/details_response.rb +28 -0
- data/lib/yoti/doc_scan/session/retrieve/document_fields_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/document_id_photo_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/face_map_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/face_match_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/file_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/frame_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/generated_check_response.rb +28 -0
- data/lib/yoti/doc_scan/session/retrieve/generated_media.rb +28 -0
- data/lib/yoti/doc_scan/session/retrieve/generated_supplementary_document_text_data_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/generated_text_data_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/get_session_result.rb +145 -0
- data/lib/yoti/doc_scan/session/retrieve/id_document_comparison_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/id_document_resource_response.rb +57 -0
- data/lib/yoti/doc_scan/session/retrieve/liveness_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/liveness_resource_response.rb +24 -0
- data/lib/yoti/doc_scan/session/retrieve/media_response.rb +38 -0
- data/lib/yoti/doc_scan/session/retrieve/page_response.rb +37 -0
- data/lib/yoti/doc_scan/session/retrieve/recommendation_response.rb +34 -0
- data/lib/yoti/doc_scan/session/retrieve/report_response.rb +31 -0
- data/lib/yoti/doc_scan/session/retrieve/resource_container.rb +69 -0
- data/lib/yoti/doc_scan/session/retrieve/resource_response.rb +41 -0
- data/lib/yoti/doc_scan/session/retrieve/supplementary_document_resource_response.rb +57 -0
- data/lib/yoti/doc_scan/session/retrieve/supplementary_document_text_data_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/supplementary_document_text_extraction_task_response.rb +18 -0
- data/lib/yoti/doc_scan/session/retrieve/task_response.rb +89 -0
- data/lib/yoti/doc_scan/session/retrieve/text_data_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/text_extraction_task_response.rb +18 -0
- data/lib/yoti/doc_scan/session/retrieve/zoom_liveness_resource_response.rb +33 -0
- data/lib/yoti/doc_scan/support/supported_documents.rb +60 -0
- data/lib/yoti/dynamic_share_service/dynamic_scenario.rb +5 -0
- data/lib/yoti/dynamic_share_service/extension/extension.rb +3 -0
- data/lib/yoti/dynamic_share_service/extension/location_constraint_extension.rb +3 -0
- data/lib/yoti/dynamic_share_service/extension/thirdparty_attribute_extension.rb +1 -1
- data/lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb +4 -0
- data/lib/yoti/dynamic_share_service/policy/dynamic_policy.rb +74 -9
- data/lib/yoti/dynamic_share_service/policy/wanted_anchor.rb +3 -0
- data/lib/yoti/dynamic_share_service/policy/wanted_attribute.rb +5 -0
- data/lib/yoti/dynamic_share_service/share_url.rb +26 -33
- data/lib/yoti/errors.rb +15 -2
- data/lib/yoti/http/aml_check_request.rb +12 -6
- data/lib/yoti/http/payloads/aml_address.rb +4 -0
- data/lib/yoti/http/payloads/aml_profile.rb +7 -1
- data/lib/yoti/http/profile_request.rb +11 -6
- data/lib/yoti/http/request.rb +219 -18
- data/lib/yoti/http/signed_request.rb +13 -4
- data/lib/yoti/protobuf/main.rb +8 -8
- data/lib/yoti/share/attribute_issuance_details.rb +6 -0
- data/lib/yoti/ssl.rb +4 -4
- data/lib/yoti/util/age_processor.rb +1 -1
- data/lib/yoti/util/anchor_processor.rb +2 -2
- data/lib/yoti/util/log.rb +1 -1
- data/lib/yoti/util/validation.rb +41 -0
- data/lib/yoti/version.rb +1 -1
- data/yoti.gemspec +18 -6
- metadata +69 -33
- data/.github/ISSUE_TEMPLATE.md +0 -17
- data/.gitignore +0 -39
- data/CONTRIBUTING.md +0 -98
- data/Guardfile +0 -11
- data/Rakefile +0 -54
- data/login_flow.png +0 -0
- data/rubocop.yml +0 -57
- data/yardstick.yml +0 -9
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Retrieve
|
7
|
+
class FileResponse
|
8
|
+
# @return [MediaResponse]
|
9
|
+
attr_reader :media
|
10
|
+
|
11
|
+
#
|
12
|
+
# @param [Hash] file
|
13
|
+
#
|
14
|
+
def initialize(file)
|
15
|
+
@media = MediaResponse.new(file['media']) unless file['media'].nil?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Retrieve
|
7
|
+
class FrameResponse
|
8
|
+
# @return [MediaResponse]
|
9
|
+
attr_reader :media
|
10
|
+
|
11
|
+
#
|
12
|
+
# @param [Hash] frame
|
13
|
+
#
|
14
|
+
def initialize(frame)
|
15
|
+
@media = MediaResponse.new(frame['media']) unless frame['media'].nil?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Retrieve
|
7
|
+
class GeneratedCheckResponse
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :id
|
10
|
+
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :type
|
13
|
+
|
14
|
+
#
|
15
|
+
# @param [Hash] check
|
16
|
+
#
|
17
|
+
def initialize(check)
|
18
|
+
Validation.assert_is_a(String, check['id'], 'id', true)
|
19
|
+
@id = check['id']
|
20
|
+
|
21
|
+
Validation.assert_is_a(String, check['type'], 'type', true)
|
22
|
+
@type = check['type']
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Retrieve
|
7
|
+
class GeneratedMedia
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :id
|
10
|
+
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :type
|
13
|
+
|
14
|
+
#
|
15
|
+
# @param [Hash] media
|
16
|
+
#
|
17
|
+
def initialize(media)
|
18
|
+
Validation.assert_is_a(String, media['id'], 'id', true)
|
19
|
+
@id = media['id']
|
20
|
+
|
21
|
+
Validation.assert_is_a(String, media['type'], 'type', true)
|
22
|
+
@type = media['type']
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Retrieve
|
7
|
+
class GetSessionResult
|
8
|
+
# @return [Integer]
|
9
|
+
attr_reader :client_session_token_ttl
|
10
|
+
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :client_session_token
|
13
|
+
|
14
|
+
# @return [String]
|
15
|
+
attr_reader :session_id
|
16
|
+
|
17
|
+
# @return [String]
|
18
|
+
attr_reader :user_tracking_id
|
19
|
+
|
20
|
+
# @return [String]
|
21
|
+
attr_reader :state
|
22
|
+
|
23
|
+
# @return [Array<CheckResponse>]
|
24
|
+
attr_reader :checks
|
25
|
+
|
26
|
+
# @return [ResourceContainer]
|
27
|
+
attr_reader :resources
|
28
|
+
|
29
|
+
# @return [DateTime]
|
30
|
+
attr_reader :biometric_consent_timestamp
|
31
|
+
|
32
|
+
#
|
33
|
+
# @param [Hash] response
|
34
|
+
#
|
35
|
+
def initialize(response)
|
36
|
+
Validation.assert_is_a(Integer, response['client_session_token_ttl'], 'client_session_token_ttl', true)
|
37
|
+
@client_session_token_ttl = response['client_session_token_ttl']
|
38
|
+
|
39
|
+
Validation.assert_is_a(String, response['session_id'], 'session_id', true)
|
40
|
+
@session_id = response['session_id']
|
41
|
+
|
42
|
+
Validation.assert_is_a(String, response['user_tracking_id'], 'user_tracking_id', true)
|
43
|
+
@user_tracking_id = response['user_tracking_id']
|
44
|
+
|
45
|
+
Validation.assert_is_a(String, response['state'], 'state', true)
|
46
|
+
@state = response['state']
|
47
|
+
|
48
|
+
Validation.assert_is_a(String, response['client_session_token'], 'client_session_token', true)
|
49
|
+
@client_session_token = response['client_session_token']
|
50
|
+
|
51
|
+
if response['checks'].nil?
|
52
|
+
@checks = []
|
53
|
+
else
|
54
|
+
Validation.assert_is_a(Array, response['checks'], 'checks')
|
55
|
+
@checks = map_checks(response['checks'])
|
56
|
+
end
|
57
|
+
|
58
|
+
@resources = ResourceContainer.new(response['resources']) unless response['resources'].nil?
|
59
|
+
|
60
|
+
@biometric_consent_timestamp = DateTime.parse(response['biometric_consent']) unless response['biometric_consent'].nil?
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# @return [Array<AuthenticityCheckResponse>]
|
65
|
+
#
|
66
|
+
def authenticity_checks
|
67
|
+
@checks.select { |check| check.is_a?(AuthenticityCheckResponse) }
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
# @return [Array<FaceMatchCheckResponse>]
|
72
|
+
#
|
73
|
+
def face_match_checks
|
74
|
+
@checks.select { |check| check.is_a?(FaceMatchCheckResponse) }
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
# @deprecated replaced by id_document_text_data_checks
|
79
|
+
#
|
80
|
+
# @return [Array<TextDataCheckResponse>]
|
81
|
+
#
|
82
|
+
def text_data_checks
|
83
|
+
id_document_text_data_checks
|
84
|
+
end
|
85
|
+
|
86
|
+
#
|
87
|
+
# @return [Array<TextDataCheckResponse>]
|
88
|
+
#
|
89
|
+
def id_document_text_data_checks
|
90
|
+
@checks.select { |check| check.is_a?(TextDataCheckResponse) }
|
91
|
+
end
|
92
|
+
|
93
|
+
#
|
94
|
+
# @return [Array<SupplementaryDocumentTextDataCheckResponse>]
|
95
|
+
#
|
96
|
+
def supplementary_document_text_data_checks
|
97
|
+
@checks.select { |check| check.is_a?(SupplementaryDocumentTextDataCheckResponse) }
|
98
|
+
end
|
99
|
+
|
100
|
+
#
|
101
|
+
# @return [Array<LivenessCheckResponse>]
|
102
|
+
#
|
103
|
+
def liveness_checks
|
104
|
+
@checks.select { |check| check.is_a?(LivenessCheckResponse) }
|
105
|
+
end
|
106
|
+
|
107
|
+
#
|
108
|
+
# @return [Array<IdDocumentComparisonCheckResponse>]
|
109
|
+
#
|
110
|
+
def id_document_comparison_checks
|
111
|
+
@checks.select { |check| check.is_a?(IdDocumentComparisonCheckResponse) }
|
112
|
+
end
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
#
|
117
|
+
# @param [Array<Hash>] checks
|
118
|
+
#
|
119
|
+
# @return [Array<CheckResponse>]
|
120
|
+
#
|
121
|
+
def map_checks(checks)
|
122
|
+
checks.map do |check|
|
123
|
+
case check['type']
|
124
|
+
when Constants::ID_DOCUMENT_AUTHENTICITY
|
125
|
+
AuthenticityCheckResponse.new(check)
|
126
|
+
when Constants::ID_DOCUMENT_COMPARISON
|
127
|
+
IdDocumentComparisonCheckResponse.new(check)
|
128
|
+
when Constants::ID_DOCUMENT_FACE_MATCH
|
129
|
+
FaceMatchCheckResponse.new(check)
|
130
|
+
when Constants::ID_DOCUMENT_TEXT_DATA_CHECK
|
131
|
+
TextDataCheckResponse.new(check)
|
132
|
+
when Constants::LIVENESS
|
133
|
+
LivenessCheckResponse.new(check)
|
134
|
+
when Constants::SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK
|
135
|
+
SupplementaryDocumentTextDataCheckResponse.new(check)
|
136
|
+
else
|
137
|
+
CheckResponse.new(check)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Retrieve
|
7
|
+
class IdDocumentResourceResponse < ResourceResponse
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :document_type
|
10
|
+
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :issuing_country
|
13
|
+
|
14
|
+
# @return [Array<PageResponse>]
|
15
|
+
attr_reader :pages
|
16
|
+
|
17
|
+
# @return [DocumentFieldsResponse]
|
18
|
+
attr_reader :document_fields
|
19
|
+
|
20
|
+
# @return [DocumentIdPhotoResponse]
|
21
|
+
attr_reader :document_id_photo
|
22
|
+
|
23
|
+
#
|
24
|
+
# @param [Hash] resource
|
25
|
+
#
|
26
|
+
def initialize(resource)
|
27
|
+
super(resource)
|
28
|
+
|
29
|
+
Validation.assert_is_a(String, resource['document_type'], 'document_type', true)
|
30
|
+
@document_type = resource['document_type']
|
31
|
+
|
32
|
+
Validation.assert_is_a(String, resource['issuing_country'], 'issuing_country', true)
|
33
|
+
@issuing_country = resource['issuing_country']
|
34
|
+
|
35
|
+
if resource['pages'].nil?
|
36
|
+
@pages = []
|
37
|
+
else
|
38
|
+
Validation.assert_is_a(Array, resource['pages'], 'pages')
|
39
|
+
@pages = resource['pages'].map { |page| PageResponse.new(page) }
|
40
|
+
end
|
41
|
+
|
42
|
+
@document_fields = DocumentFieldsResponse.new(resource['document_fields']) unless resource['document_fields'].nil?
|
43
|
+
|
44
|
+
@document_id_photo = DocumentIdPhotoResponse.new(resource['document_id_photo']) unless resource['document_id_photo'].nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# @return [Array<TextExtractionTaskResponse>]
|
49
|
+
#
|
50
|
+
def text_extraction_tasks
|
51
|
+
@tasks.select { |task| task.is_a?(TextExtractionTaskResponse) }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Retrieve
|
7
|
+
class LivenessResourceResponse < ResourceResponse
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :liveness_type
|
10
|
+
|
11
|
+
#
|
12
|
+
# @param [Hash] resource
|
13
|
+
#
|
14
|
+
def initialize(resource)
|
15
|
+
super(resource)
|
16
|
+
|
17
|
+
Validation.assert_is_a(String, resource['liveness_type'], 'liveness_type', true)
|
18
|
+
@liveness_type = resource['liveness_type']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Retrieve
|
7
|
+
class MediaResponse
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :id
|
10
|
+
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :type
|
13
|
+
|
14
|
+
# @return [DateTime]
|
15
|
+
attr_reader :created
|
16
|
+
|
17
|
+
# @return [DateTime]
|
18
|
+
attr_reader :last_updated
|
19
|
+
|
20
|
+
#
|
21
|
+
# @param [Hash] media
|
22
|
+
#
|
23
|
+
def initialize(media)
|
24
|
+
Validation.assert_is_a(String, media['id'], 'id', true)
|
25
|
+
@id = media['id']
|
26
|
+
|
27
|
+
Validation.assert_is_a(String, media['type'], 'type', true)
|
28
|
+
@type = media['type']
|
29
|
+
|
30
|
+
@created = DateTime.parse(media['created']) unless media['created'].nil?
|
31
|
+
|
32
|
+
@last_updated = DateTime.parse(media['last_updated']) unless media['last_updated'].nil?
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Retrieve
|
7
|
+
class PageResponse
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :capture_method
|
10
|
+
|
11
|
+
# @return [MediaResponse]
|
12
|
+
attr_reader :media
|
13
|
+
|
14
|
+
# @return [Array<FrameResponse>]
|
15
|
+
attr_reader :frames
|
16
|
+
|
17
|
+
#
|
18
|
+
# @param [Hash] page
|
19
|
+
#
|
20
|
+
def initialize(page)
|
21
|
+
Validation.assert_is_a(String, page['capture_method'], 'capture_method', true)
|
22
|
+
@capture_method = page['capture_method']
|
23
|
+
|
24
|
+
@media = MediaResponse.new(page['media']) unless page['media'].nil?
|
25
|
+
|
26
|
+
if page['frames'].nil?
|
27
|
+
@frames = []
|
28
|
+
else
|
29
|
+
Validation.assert_is_a(Array, page['frames'], 'frames')
|
30
|
+
@frames = page['frames'].map { |frame| FrameResponse.new(frame) }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|