yoti 1.6.2 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -224
- data/lib/yoti.rb +52 -1
- data/lib/yoti/activity_details.rb +1 -0
- data/lib/yoti/client.rb +13 -4
- data/lib/yoti/configuration.rb +7 -2
- 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/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 +19 -0
- data/lib/yoti/data_type/signed_time_stamp.rb +1 -1
- data/lib/yoti/doc_scan/client.rb +187 -0
- data/lib/yoti/doc_scan/constants.rb +30 -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/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 +53 -0
- data/lib/yoti/doc_scan/session/create/requested_face_match_check.rb +95 -0
- data/lib/yoti/doc_scan/session/create/requested_liveness_check.rb +108 -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/sdk_config.rb +221 -0
- data/lib/yoti/doc_scan/session/create/session_specification.rb +203 -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/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_text_data_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/get_session_result.rb +113 -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 +27 -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 +50 -0
- data/lib/yoti/doc_scan/session/retrieve/resource_response.rb +39 -0
- data/lib/yoti/doc_scan/session/retrieve/task_response.rb +87 -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/extension/thirdparty_attribute_extension.rb +62 -11
- data/lib/yoti/dynamic_share_service/policy/dynamic_policy.rb +84 -22
- data/lib/yoti/dynamic_share_service/share_url.rb +28 -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 +221 -18
- data/lib/yoti/http/signed_request.rb +13 -4
- data/lib/yoti/protobuf/main.rb +1 -1
- data/lib/yoti/ssl.rb +2 -2
- data/lib/yoti/util/anchor_processor.rb +1 -1
- data/lib/yoti/util/validation.rb +41 -0
- data/lib/yoti/version.rb +1 -1
- data/yoti.gemspec +18 -9
- metadata +55 -68
- data/.gitignore +0 -39
- data/CONTRIBUTING.md +0 -127
- data/Guardfile +0 -11
- data/Rakefile +0 -49
- data/lib/yoti/sandbox.rb +0 -4
- data/lib/yoti/sandbox/anchor.rb +0 -49
- data/lib/yoti/sandbox/attribute.rb +0 -52
- data/lib/yoti/sandbox/profile.rb +0 -171
- data/lib/yoti/sandbox/sandbox_client.rb +0 -40
- data/login_flow.png +0 -0
- data/rubocop.yml +0 -57
- data/yardstick.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e34d2dbc6a002d6ea68375d1e0d0ba861587db16a7502e597aaacac5f97799f4
|
4
|
+
data.tar.gz: 81e54ccb7d6b3270efea24d7e1a632d4719f604eccd7da49f101ff6e565ca99d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4433d2b8ac27da64991fe3f1f0d2271feb3c1ad41f43b50c49d9ec0615a75714042e63ef343fb93f4f8ae98860f93a4534f2128eafe1af7813ceba6d88458620
|
7
|
+
data.tar.gz: 0a2338a401a97000ba2a4999347c3e4471bfa896565653d87ac2b548c11b8eae73c86a1241cad5293ef3e19922e97caa7c67658df603c7704ced9965a806abc7
|
data/README.md
CHANGED
@@ -1,44 +1,25 @@
|
|
1
1
|
# Yoti Ruby SDK
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.com/getyoti/yoti-ruby-sdk.svg?branch=master)](https://travis-ci.com/getyoti/yoti-ruby-sdk)
|
4
|
+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aruby&metric=coverage)](https://sonarcloud.io/dashboard?id=getyoti%3Aruby)
|
5
|
+
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aruby&metric=bugs)](https://sonarcloud.io/dashboard?id=getyoti%3Aruby)
|
6
|
+
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aruby&metric=code_smells)](https://sonarcloud.io/dashboard?id=getyoti%3Aruby)
|
7
|
+
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aruby&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=getyoti%3Aruby)
|
4
8
|
|
5
9
|
Welcome to the Yoti Ruby SDK. This repository contains the tools you need to quickly integrate your Ruby back-end with Yoti so that your users can share their identity details with your application in a secure and trusted way.
|
6
10
|
|
7
11
|
## Table of Contents
|
8
12
|
|
9
|
-
1. [An Architectural view](#an-architectural-view) - High level overview of integration
|
10
13
|
1. [Requirements](#requirements) - Everything you need to get started
|
11
|
-
1. [Installing the SDK](#installing-the-sdk) - How to install our SDK
|
12
|
-
1. [Configuration](#configuration) - Configuring the SDK
|
13
|
-
1. [Profile Retrieval](#profile-retrieval) - How to retrieve a Yoti profile using the one time use token
|
14
|
-
1. [AML Integration](#aml-integration) - How to integrate with Yoti's AML (Anti Money Laundering) service
|
15
|
-
1. [Running the Examples](#running-the-examples) - How to run the example projects provided
|
16
|
-
1. [API Coverage](#api-coverage) - Attributes defined
|
17
|
-
1. [Support](#support) - Please feel free to reach out
|
18
|
-
|
19
|
-
## An Architectural view
|
20
|
-
|
21
|
-
To integrate your application with Yoti, your back-end must expose a GET endpoint that Yoti will use to forward tokens.
|
22
|
-
The endpoint is configured in the [Yoti Hub](https://hub.yoti.com) where you create/update your application. To see an example of how this is configured, see the [Running the Examples](#running-the-examples) section.
|
23
14
|
|
24
|
-
|
25
|
-
Yoti SDK carries out for you steps 6, 7, 8 and the profile decryption in step 9.
|
26
|
-
|
27
|
-
![alt text](login_flow.png "Login flow")
|
28
|
-
|
29
|
-
Yoti also allows you to enable user details verification from your mobile app by means of the Android (TBA) and iOS (TBA) SDKs. In that scenario, your Yoti-enabled mobile app is playing both the role of the browser and the Yoti app. Your back-end doesn't need to handle these cases in a significantly different way, but you might decide to handle the `User-Agent` header in order to provide different responses for desktop and mobile clients.
|
15
|
+
1. [Installing the SDK](#installing-the-sdk) - How to install our SDK
|
30
16
|
|
31
|
-
|
17
|
+
1. [Setup](#setup) - Setup required before using the Yoti services
|
32
18
|
|
33
|
-
|
34
|
-
|
35
|
-
* [Protocol buffers][]
|
36
|
-
* [Base64 data][]
|
19
|
+
1. [Products](#products) -
|
20
|
+
Links to more information about the products offered by the Yoti SDK
|
37
21
|
|
38
|
-
[
|
39
|
-
[RSA pkcs asymmetric encryption]: https://en.wikipedia.org/wiki/RSA_(cryptosystem)
|
40
|
-
[Protocol buffers]: https://en.wikipedia.org/wiki/Protocol_Buffers
|
41
|
-
[Base64 data]: https://en.wikipedia.org/wiki/Base64
|
22
|
+
1. [Support](#support) - Please feel free to reach out
|
42
23
|
|
43
24
|
## Requirements
|
44
25
|
|
@@ -72,7 +53,7 @@ bundle install
|
|
72
53
|
Or simply run the following command from your terminal:
|
73
54
|
|
74
55
|
```shell
|
75
|
-
|
56
|
+
gem install yoti
|
76
57
|
```
|
77
58
|
|
78
59
|
## SDK Project Import
|
@@ -85,7 +66,12 @@ rails generate yoti:install
|
|
85
66
|
|
86
67
|
The generated initialisation file can be found in `config/initializers/yoti.rb`.
|
87
68
|
|
88
|
-
##
|
69
|
+
## Setup
|
70
|
+
|
71
|
+
For each service you will need:
|
72
|
+
|
73
|
+
* Your Client SDK ID, generated by [Yoti Hub](https://hub.yoti.com) when you create (and then publish) your app.
|
74
|
+
* Your .pem file. This is your own unique private key which your browser generates from the [Yoti Hub](https://hub.yoti.com) when you create an application.
|
89
75
|
|
90
76
|
A minimal Yoti client initialisation looks like this:
|
91
77
|
|
@@ -97,10 +83,8 @@ end
|
|
97
83
|
```
|
98
84
|
|
99
85
|
Make sure the following environment variables can be accessed by your app:
|
100
|
-
|
101
|
-
`
|
102
|
-
|
103
|
-
`YOTI_KEY_FILE_PATH` - the full path to your security key downloaded from the *Keys* settings page (e.g. /Users/developer/access-security.pem)
|
86
|
+
- `YOTI_CLIENT_SDK_ID`
|
87
|
+
- `YOTI_KEY_FILE_PATH`
|
104
88
|
|
105
89
|
The following options are available:
|
106
90
|
|
@@ -140,197 +124,12 @@ heroku config:add YOTI_KEY ="$(cat your-access-security.pem)"
|
|
140
124
|
|
141
125
|
[Heroku Command Line]: https://devcenter.heroku.com/articles/heroku-command-line
|
142
126
|
|
143
|
-
##
|
144
|
-
|
145
|
-
When your application receives a one time use token via the exposed endpoint (it will be assigned to a query string parameter named `token`), you can easily retrieve the user profile:
|
146
|
-
|
147
|
-
```ruby
|
148
|
-
one_time_use_token = params[:token]
|
149
|
-
yoti_activity_details = Yoti::Client.get_activity_details(one_time_use_token)
|
150
|
-
```
|
151
|
-
|
152
|
-
Before you inspect the user profile, you might want to check whether the user validation was successful. This is done as follows:
|
153
|
-
|
154
|
-
```ruby
|
155
|
-
if yoti_activity_details.outcome == 'SUCCESS'
|
156
|
-
profile = yoti_activity_details.profile
|
157
|
-
given_names = profile.given_names.value
|
158
|
-
family_name = profile.family_name.value
|
159
|
-
else
|
160
|
-
# handle unhappy path
|
161
|
-
end
|
162
|
-
```
|
163
|
-
|
164
|
-
The `profile` object provides a set of attributes corresponding to user attributes. Whether the attributes are present or not depends on the settings you have applied to your app on Yoti Hub.
|
165
|
-
|
166
|
-
### Handling Users
|
167
|
-
|
168
|
-
When you retrieve the user profile, you receive a user ID generated by Yoti exclusively for your application.
|
169
|
-
This means that if the same individual logs into another app, Yoti will assign her/him a different ID.
|
170
|
-
You can use this ID to verify whether (for your application) the retrieved profile identifies a new or an existing user.
|
171
|
-
Here is an example of how this works:
|
172
|
-
|
173
|
-
```ruby
|
174
|
-
if yoti_activity_details.outcome == 'SUCCESS'
|
175
|
-
user = your_user_search_function(yoti_activity_details.user_id)
|
176
|
-
profile = yoti_activity_details.profile
|
177
|
-
|
178
|
-
if user
|
179
|
-
# handle login
|
180
|
-
email = profile.email_address.value
|
181
|
-
else
|
182
|
-
# handle registration
|
183
|
-
given_names = profile.given_names.value
|
184
|
-
family_name = profile.family_name.value
|
185
|
-
email = profile.email_address.value
|
186
|
-
end
|
187
|
-
else
|
188
|
-
# handle unhappy path
|
189
|
-
end
|
190
|
-
```
|
191
|
-
|
192
|
-
Where `your_user_search_function` is a piece of logic in your app that is supposed to find a user, given a user_id. Regardless of whether the user is a new or an existing one, Yoti will always provide their profile, so you don't necessarily need to store it.
|
193
|
-
|
194
|
-
You can retrieve the sources and verifiers for each attribute as follows:
|
195
|
-
|
196
|
-
```ruby
|
197
|
-
given_names_sources = profile.given_names.sources # list of anchors
|
198
|
-
given_names_verifiers = profile.given_names.verifiers # list of anchors
|
199
|
-
given_names_anchors = profile.given_names.anchors # list of anchors
|
200
|
-
```
|
201
|
-
You can also retrieve further properties from these respective anchors in the following way:
|
202
|
-
|
203
|
-
```ruby
|
204
|
-
# Retrieving properties of the first anchor
|
205
|
-
type = given_names_sources[0].type # string
|
206
|
-
value = given_names_sources[0].value # string
|
207
|
-
sub_type = given_names_sources[0].sub_type # string
|
208
|
-
time_stamp = given_names_sources[0].signed_time_stamp.time_stamp # DateTime object
|
209
|
-
origin_server_certs = given_names_sources[0].origin_server_certs # list of X509 certificates
|
210
|
-
```
|
211
|
-
|
212
|
-
In case you want to prove the sources and verifiers of the helper`ActivityDetails.age_verified` on `Age Over 18` set as age derivation, please retrieve it's original attribute from the profile as follow:
|
213
|
-
|
214
|
-
```ruby
|
215
|
-
age_attribute = profile.get_attribute('age_over:18')
|
216
|
-
sources = age_attribute.sources
|
217
|
-
verifiers = age_attribute.verifiers
|
218
|
-
anchors = age_attribute.anchors
|
219
|
-
```
|
220
|
-
|
221
|
-
## AML Integration
|
222
|
-
|
223
|
-
Yoti provides an AML (Anti Money Laundering) check service to allow a deeper KYC process to prevent fraud. This is a chargeable service, so please contact [sdksupport@yoti.com](mailto:sdksupport@yoti.com) for more information.
|
224
|
-
|
225
|
-
Yoti will provide a boolean result on the following checks:
|
226
|
-
|
227
|
-
* PEP list - Verify against Politically Exposed Persons list
|
228
|
-
* Fraud list - Verify against US Social Security Administration Fraud (SSN Fraud) list
|
229
|
-
* Watch list - Verify against watch lists from the Office of Foreign Assets Control
|
230
|
-
|
231
|
-
To use this functionality you must ensure your application is assigned to your organisation in the Yoti Hub - please see [here](https://developers.yoti.com/yoti-app-integration/yoti-app-integration#step-1-creating-an-organisation) for further information.
|
232
|
-
|
233
|
-
For the AML check you will need to provide the following:
|
234
|
-
|
235
|
-
* Data provided by Yoti (please ensure you have selected the Given name(s) and Family name attributes for your scenario on the Yoti Hub)
|
236
|
-
* Given name(s)
|
237
|
-
* Family name
|
238
|
-
* Data that must be collected from the user:
|
239
|
-
* Country of residence (must be an ISO 3166 3-letter code)
|
240
|
-
* Social Security Number (US citizens only)
|
241
|
-
* Postcode/Zip code (US citizens only)
|
242
|
-
|
243
|
-
### Consent
|
244
|
-
|
245
|
-
Performing an AML check on a person *requires* their consent.
|
246
|
-
**You must ensure you have user consent *before* using this service.**
|
247
|
-
|
248
|
-
### Code Example
|
249
|
-
|
250
|
-
Given a YotiClient initialised with your SDK ID and KeyPair (see [Client Initialisation](#client-initialisation)) performing an AML check is a straightforward case of providing basic profile data.
|
251
|
-
|
252
|
-
```ruby
|
253
|
-
require 'yoti'
|
254
|
-
|
255
|
-
Yoti.configure do |config|
|
256
|
-
config.client_sdk_id = ENV['YOTI_CLIENT_SDK_ID']
|
257
|
-
config.key_file_path = ENV['YOTI_KEY_FILE_PATH']
|
258
|
-
end
|
259
|
-
|
260
|
-
aml_address = Yoti::AmlAddress.new('GBR')
|
261
|
-
aml_profile = Yoti::AmlProfile.new('Edward Richard George', 'Heath', aml_address)
|
262
|
-
|
263
|
-
puts Yoti::Client.aml_check(aml_profile)
|
264
|
-
```
|
127
|
+
## Products
|
265
128
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
### Ruby on Rails
|
271
|
-
|
272
|
-
1. Create your application in the [Yoti Hub](https://hub.yoti.com)
|
273
|
-
1. Set the application domain of your app to `localhost:3001`
|
274
|
-
1. Set the scenario callback URL to `/profile`
|
275
|
-
1. Rename the [.env.example](examples/rails/.env.example) file to `.env`
|
276
|
-
1. Fill in the environment variables in this file with the ones specific to your application (mentioned in the [Configuration](#configuration) section)
|
277
|
-
1. Install the dependencies by running the following commands
|
278
|
-
```ruby
|
279
|
-
$ bundle install
|
280
|
-
$ gem install foreman # We are doing this as it's not recommended to include foreman in your Gemfile
|
281
|
-
```
|
282
|
-
1. Start the server `foreman start`
|
283
|
-
|
284
|
-
Visiting `https://localhost:3001/` should show a Yoti Connect button
|
285
|
-
|
286
|
-
### Sinatra
|
287
|
-
|
288
|
-
1. Create your application in the [Yoti Hub](https://hub.yoti.com)
|
289
|
-
1. Set the application domain of your app to `localhost:4567`
|
290
|
-
1. Set the scenario callback URL to `/profile`
|
291
|
-
1. Rename the [.env.example](examples/sinatra/.env.example) file to `.env`
|
292
|
-
1. Fill in the environment variables in this file with the ones specific to your application (mentioned in the [Configuration](#configuration) section)
|
293
|
-
1. Install the dependencies by running the following commands
|
294
|
-
```ruby
|
295
|
-
$ bundle install
|
296
|
-
$ gem install foreman # We are doing this as it's not recommended to include foreman in your Gemfile
|
297
|
-
```
|
298
|
-
1. Start the server `foreman start`
|
299
|
-
|
300
|
-
Visiting `https://localhost:4567/` should show a Yoti Connect button
|
301
|
-
|
302
|
-
### AML Check
|
303
|
-
|
304
|
-
* rename the [.env.example](examples/aml_check/.env.example) file to `.env` and fill in the required configuration values
|
305
|
-
* install the dependencies with `bundle install`
|
306
|
-
* run the script with `ruby ./app.rb`
|
307
|
-
|
308
|
-
## API Coverage
|
309
|
-
|
310
|
-
* Activity Details
|
311
|
-
* [X] Remember Me ID `remember_me_id`
|
312
|
-
* [X] Parent Remember Me ID `parent_remember_me_id`
|
313
|
-
* [X] Receipt ID `receipt_id`
|
314
|
-
* [X] Timestamp `timestamp`
|
315
|
-
* [X] Base64 Selfie URI `base64_selfie_uri`
|
316
|
-
* [X] Age verified `age_verified`
|
317
|
-
* [X] Profile `profile`
|
318
|
-
* [X] Selfie `selfie`
|
319
|
-
* [X] Full Name `full_name`
|
320
|
-
* [X] Given Names `given_names`
|
321
|
-
* [X] Family Name `family_name`
|
322
|
-
* [X] Mobile Number `phone_number`
|
323
|
-
* [X] Email Address `email_address`
|
324
|
-
* [X] Age / Date of Birth `date_of_birth`
|
325
|
-
* [X] Address `postal_address`
|
326
|
-
* [X] Structured Postal Address `structured_postal_address`
|
327
|
-
* [X] Gender `gender`
|
328
|
-
* [X] Nationality `nationality`
|
329
|
-
* [X] Application Profile `application_profile`
|
330
|
-
* [X] Name `name`
|
331
|
-
* [X] URL `url`
|
332
|
-
* [X] Logo `logo`
|
333
|
-
* [X] Receipt Background Color `receipt_bgcolor`
|
129
|
+
The Yoti SDK can be used for the following products, follow the links for more information about each:
|
130
|
+
1) [Yoti app integration](/docs/PROFILE.md) - Connect with already-verified customers.
|
131
|
+
1) [Yoti Doc Scan](/docs/DOCSCAN.md) - Identity verification embedded in your website or app.
|
132
|
+
1) [Yoti AML](/docs/AML.md) - Anti-Money Laundering check service to allow a deeper KYC process, preventing fraud
|
334
133
|
|
335
134
|
## Support
|
336
135
|
|
data/lib/yoti.rb
CHANGED
@@ -18,6 +18,7 @@ require_relative 'yoti/data_type/application_profile'
|
|
18
18
|
require_relative 'yoti/data_type/profile'
|
19
19
|
require_relative 'yoti/data_type/attribute'
|
20
20
|
require_relative 'yoti/data_type/signed_time_stamp'
|
21
|
+
require_relative 'yoti/data_type/media'
|
21
22
|
require_relative 'yoti/data_type/image'
|
22
23
|
require_relative 'yoti/data_type/image_jpeg'
|
23
24
|
require_relative 'yoti/data_type/image_png'
|
@@ -26,7 +27,8 @@ require_relative 'yoti/data_type/document_details'
|
|
26
27
|
|
27
28
|
require_relative 'yoti/util/age_processor'
|
28
29
|
require_relative 'yoti/util/anchor_processor'
|
29
|
-
require_relative 'yoti/util/log
|
30
|
+
require_relative 'yoti/util/log'
|
31
|
+
require_relative 'yoti/util/validation'
|
30
32
|
|
31
33
|
require_relative 'yoti/activity_details'
|
32
34
|
require_relative 'yoti/client'
|
@@ -47,6 +49,55 @@ require_relative 'yoti/dynamic_share_service/extension/thirdparty_attribute_exte
|
|
47
49
|
require_relative 'yoti/share/extra_data'
|
48
50
|
require_relative 'yoti/share/attribute_issuance_details'
|
49
51
|
|
52
|
+
require_relative 'yoti/doc_scan/client'
|
53
|
+
require_relative 'yoti/doc_scan/constants'
|
54
|
+
require_relative 'yoti/doc_scan/errors'
|
55
|
+
|
56
|
+
require_relative 'yoti/doc_scan/session/create/create_session_result'
|
57
|
+
require_relative 'yoti/doc_scan/session/create/requested_check'
|
58
|
+
require_relative 'yoti/doc_scan/session/create/requested_document_authenticity_check'
|
59
|
+
require_relative 'yoti/doc_scan/session/create/requested_face_match_check'
|
60
|
+
require_relative 'yoti/doc_scan/session/create/requested_liveness_check'
|
61
|
+
require_relative 'yoti/doc_scan/session/create/requested_task'
|
62
|
+
require_relative 'yoti/doc_scan/session/create/requested_text_extraction_task'
|
63
|
+
require_relative 'yoti/doc_scan/session/create/document_filter'
|
64
|
+
require_relative 'yoti/doc_scan/session/create/document_restrictions_filter'
|
65
|
+
require_relative 'yoti/doc_scan/session/create/orthogonal_restrictions_filter'
|
66
|
+
require_relative 'yoti/doc_scan/session/create/required_document'
|
67
|
+
require_relative 'yoti/doc_scan/session/create/required_id_document'
|
68
|
+
require_relative 'yoti/doc_scan/session/create/sdk_config'
|
69
|
+
require_relative 'yoti/doc_scan/session/create/notification_config'
|
70
|
+
require_relative 'yoti/doc_scan/session/create/session_specification'
|
71
|
+
|
72
|
+
require_relative 'yoti/doc_scan/session/retrieve/check_response'
|
73
|
+
require_relative 'yoti/doc_scan/session/retrieve/resource_response'
|
74
|
+
require_relative 'yoti/doc_scan/session/retrieve/authenticity_check_response'
|
75
|
+
require_relative 'yoti/doc_scan/session/retrieve/breakdown_response'
|
76
|
+
require_relative 'yoti/doc_scan/session/retrieve/details_response'
|
77
|
+
require_relative 'yoti/doc_scan/session/retrieve/document_fields_response'
|
78
|
+
require_relative 'yoti/doc_scan/session/retrieve/document_id_photo_response'
|
79
|
+
require_relative 'yoti/doc_scan/session/retrieve/face_map_response'
|
80
|
+
require_relative 'yoti/doc_scan/session/retrieve/face_match_check_response'
|
81
|
+
require_relative 'yoti/doc_scan/session/retrieve/frame_response'
|
82
|
+
require_relative 'yoti/doc_scan/session/retrieve/generated_check_response'
|
83
|
+
require_relative 'yoti/doc_scan/session/retrieve/generated_media'
|
84
|
+
require_relative 'yoti/doc_scan/session/retrieve/generated_text_data_check_response'
|
85
|
+
require_relative 'yoti/doc_scan/session/retrieve/get_session_result'
|
86
|
+
require_relative 'yoti/doc_scan/session/retrieve/id_document_resource_response'
|
87
|
+
require_relative 'yoti/doc_scan/session/retrieve/liveness_check_response'
|
88
|
+
require_relative 'yoti/doc_scan/session/retrieve/liveness_resource_response'
|
89
|
+
require_relative 'yoti/doc_scan/session/retrieve/media_response'
|
90
|
+
require_relative 'yoti/doc_scan/session/retrieve/page_response'
|
91
|
+
require_relative 'yoti/doc_scan/session/retrieve/recommendation_response'
|
92
|
+
require_relative 'yoti/doc_scan/session/retrieve/report_response'
|
93
|
+
require_relative 'yoti/doc_scan/session/retrieve/resource_container'
|
94
|
+
require_relative 'yoti/doc_scan/session/retrieve/task_response'
|
95
|
+
require_relative 'yoti/doc_scan/session/retrieve/text_data_check_response'
|
96
|
+
require_relative 'yoti/doc_scan/session/retrieve/text_extraction_task_response'
|
97
|
+
require_relative 'yoti/doc_scan/session/retrieve/zoom_liveness_resource_response'
|
98
|
+
|
99
|
+
require_relative 'yoti/doc_scan/support/supported_documents'
|
100
|
+
|
50
101
|
# The main module namespace of the Yoti gem
|
51
102
|
module Yoti
|
52
103
|
class << self
|
data/lib/yoti/client.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
module Yoti
|
2
2
|
#
|
3
|
-
# Handles all the publicly
|
4
|
-
#
|
3
|
+
# Handles all the publicly accessible Yoti methods for
|
4
|
+
# getting data using an encrypted connect token
|
5
5
|
#
|
6
6
|
module Client
|
7
7
|
#
|
8
8
|
# Performs all the steps required to get the decrypted profile from an API request
|
9
9
|
#
|
10
|
-
# @param
|
10
|
+
# @param [String] encrypted_connect_token
|
11
|
+
# Token provided as a base 64 string
|
11
12
|
#
|
12
|
-
# @return [
|
13
|
+
# @return [ActivityDetails]
|
14
|
+
# An ActivityDetails instance encapsulating the user profile
|
13
15
|
#
|
14
16
|
def self.get_activity_details(encrypted_connect_token)
|
15
17
|
receipt = Yoti::ProfileRequest.new(encrypted_connect_token).receipt
|
@@ -22,6 +24,13 @@ module Yoti
|
|
22
24
|
ActivityDetails.new(receipt, user_profile, application_profile, extra_data)
|
23
25
|
end
|
24
26
|
|
27
|
+
#
|
28
|
+
# Perform AML check
|
29
|
+
#
|
30
|
+
# @param [AmlProfile] aml_profile
|
31
|
+
#
|
32
|
+
# @return [<Hash>]
|
33
|
+
#
|
25
34
|
def self.aml_check(aml_profile)
|
26
35
|
Yoti::AmlCheckRequest.new(aml_profile).response
|
27
36
|
end
|
data/lib/yoti/configuration.rb
CHANGED
@@ -3,7 +3,7 @@ module Yoti
|
|
3
3
|
attr_accessor :client_sdk_id, :key_file_path, :key, :sdk_identifier,
|
4
4
|
:api_url, :api_port, :api_version
|
5
5
|
|
6
|
-
attr_writer :api_endpoint
|
6
|
+
attr_writer :api_endpoint, :doc_scan_api_endpoint
|
7
7
|
|
8
8
|
# Set config variables by using a configuration block
|
9
9
|
def initialize
|
@@ -18,7 +18,12 @@ module Yoti
|
|
18
18
|
|
19
19
|
# @return [String] the API endpoint for the selected API version
|
20
20
|
def api_endpoint
|
21
|
-
@api_endpoint ||= "#{@api_url}/api/#{@api_version}"
|
21
|
+
@api_endpoint ||= ENV['YOTI_API_URL'] || "#{@api_url}/api/#{@api_version}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [String] the Doc Scan API endpoint
|
25
|
+
def doc_scan_api_endpoint
|
26
|
+
@doc_scan_api_endpoint ||= ENV['YOTI_DOC_SCAN_API_URL'] || "#{@api_url}/idverify/#{@api_version}"
|
22
27
|
end
|
23
28
|
|
24
29
|
# Validates the configuration values set in instance variables
|
@@ -37,7 +37,7 @@ module Yoti
|
|
37
37
|
attr_reader :age
|
38
38
|
|
39
39
|
#
|
40
|
-
# @param [Yoti::Attribute]
|
40
|
+
# @param [Yoti::Attribute] attribute
|
41
41
|
#
|
42
42
|
def initialize(attribute)
|
43
43
|
raise(ArgumentError, "'#{attribute.name}' is not a valid age verification") unless /^[^:]+:(?!.*:)[0-9]+$/.match?(attribute.name)
|