yoti 1.6.4 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +22 -224
  4. data/lib/yoti.rb +63 -1
  5. data/lib/yoti/activity_details.rb +3 -5
  6. data/lib/yoti/client.rb +13 -4
  7. data/lib/yoti/configuration.rb +8 -3
  8. data/lib/yoti/data_type/age_verification.rb +1 -1
  9. data/lib/yoti/data_type/base_profile.rb +1 -1
  10. data/lib/yoti/data_type/document_details.rb +1 -1
  11. data/lib/yoti/data_type/image.rb +4 -12
  12. data/lib/yoti/data_type/image_jpeg.rb +2 -0
  13. data/lib/yoti/data_type/image_png.rb +2 -0
  14. data/lib/yoti/data_type/media.rb +22 -0
  15. data/lib/yoti/data_type/signed_time_stamp.rb +1 -1
  16. data/lib/yoti/doc_scan/client.rb +191 -0
  17. data/lib/yoti/doc_scan/constants.rb +35 -0
  18. data/lib/yoti/doc_scan/errors.rb +81 -0
  19. data/lib/yoti/doc_scan/session/create/create_session_result.rb +50 -0
  20. data/lib/yoti/doc_scan/session/create/document_filter.rb +31 -0
  21. data/lib/yoti/doc_scan/session/create/document_restrictions_filter.rb +140 -0
  22. data/lib/yoti/doc_scan/session/create/notification_config.rb +142 -0
  23. data/lib/yoti/doc_scan/session/create/objective/objective.rb +31 -0
  24. data/lib/yoti/doc_scan/session/create/objective/proof_of_address_objective.rb +31 -0
  25. data/lib/yoti/doc_scan/session/create/orthogonal_restrictions_filter.rb +150 -0
  26. data/lib/yoti/doc_scan/session/create/requested_check.rb +39 -0
  27. data/lib/yoti/doc_scan/session/create/requested_document_authenticity_check.rb +95 -0
  28. data/lib/yoti/doc_scan/session/create/requested_face_match_check.rb +95 -0
  29. data/lib/yoti/doc_scan/session/create/requested_id_document_comparison_check.rb +53 -0
  30. data/lib/yoti/doc_scan/session/create/requested_liveness_check.rb +108 -0
  31. data/lib/yoti/doc_scan/session/create/requested_supplementary_doc_text_extraction_task.rb +94 -0
  32. data/lib/yoti/doc_scan/session/create/requested_task.rb +39 -0
  33. data/lib/yoti/doc_scan/session/create/requested_text_extraction_task.rb +116 -0
  34. data/lib/yoti/doc_scan/session/create/required_document.rb +31 -0
  35. data/lib/yoti/doc_scan/session/create/required_id_document.rb +53 -0
  36. data/lib/yoti/doc_scan/session/create/required_supplementary_document.rb +90 -0
  37. data/lib/yoti/doc_scan/session/create/sdk_config.rb +221 -0
  38. data/lib/yoti/doc_scan/session/create/session_specification.rb +221 -0
  39. data/lib/yoti/doc_scan/session/retrieve/authenticity_check_response.rb +12 -0
  40. data/lib/yoti/doc_scan/session/retrieve/breakdown_response.rb +38 -0
  41. data/lib/yoti/doc_scan/session/retrieve/check_response.rb +63 -0
  42. data/lib/yoti/doc_scan/session/retrieve/details_response.rb +28 -0
  43. data/lib/yoti/doc_scan/session/retrieve/document_fields_response.rb +21 -0
  44. data/lib/yoti/doc_scan/session/retrieve/document_id_photo_response.rb +21 -0
  45. data/lib/yoti/doc_scan/session/retrieve/face_map_response.rb +21 -0
  46. data/lib/yoti/doc_scan/session/retrieve/face_match_check_response.rb +12 -0
  47. data/lib/yoti/doc_scan/session/retrieve/file_response.rb +21 -0
  48. data/lib/yoti/doc_scan/session/retrieve/frame_response.rb +21 -0
  49. data/lib/yoti/doc_scan/session/retrieve/generated_check_response.rb +28 -0
  50. data/lib/yoti/doc_scan/session/retrieve/generated_media.rb +28 -0
  51. data/lib/yoti/doc_scan/session/retrieve/generated_supplementary_document_text_data_check_response.rb +12 -0
  52. data/lib/yoti/doc_scan/session/retrieve/generated_text_data_check_response.rb +12 -0
  53. data/lib/yoti/doc_scan/session/retrieve/get_session_result.rb +145 -0
  54. data/lib/yoti/doc_scan/session/retrieve/id_document_comparison_check_response.rb +12 -0
  55. data/lib/yoti/doc_scan/session/retrieve/id_document_resource_response.rb +57 -0
  56. data/lib/yoti/doc_scan/session/retrieve/liveness_check_response.rb +12 -0
  57. data/lib/yoti/doc_scan/session/retrieve/liveness_resource_response.rb +24 -0
  58. data/lib/yoti/doc_scan/session/retrieve/media_response.rb +38 -0
  59. data/lib/yoti/doc_scan/session/retrieve/page_response.rb +37 -0
  60. data/lib/yoti/doc_scan/session/retrieve/recommendation_response.rb +34 -0
  61. data/lib/yoti/doc_scan/session/retrieve/report_response.rb +31 -0
  62. data/lib/yoti/doc_scan/session/retrieve/resource_container.rb +69 -0
  63. data/lib/yoti/doc_scan/session/retrieve/resource_response.rb +41 -0
  64. data/lib/yoti/doc_scan/session/retrieve/supplementary_document_resource_response.rb +57 -0
  65. data/lib/yoti/doc_scan/session/retrieve/supplementary_document_text_data_check_response.rb +12 -0
  66. data/lib/yoti/doc_scan/session/retrieve/supplementary_document_text_extraction_task_response.rb +18 -0
  67. data/lib/yoti/doc_scan/session/retrieve/task_response.rb +89 -0
  68. data/lib/yoti/doc_scan/session/retrieve/text_data_check_response.rb +12 -0
  69. data/lib/yoti/doc_scan/session/retrieve/text_extraction_task_response.rb +18 -0
  70. data/lib/yoti/doc_scan/session/retrieve/zoom_liveness_resource_response.rb +33 -0
  71. data/lib/yoti/doc_scan/support/supported_documents.rb +60 -0
  72. data/lib/yoti/dynamic_share_service/dynamic_scenario.rb +5 -0
  73. data/lib/yoti/dynamic_share_service/extension/extension.rb +3 -0
  74. data/lib/yoti/dynamic_share_service/extension/location_constraint_extension.rb +3 -0
  75. data/lib/yoti/dynamic_share_service/extension/thirdparty_attribute_extension.rb +1 -1
  76. data/lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb +4 -0
  77. data/lib/yoti/dynamic_share_service/policy/dynamic_policy.rb +74 -9
  78. data/lib/yoti/dynamic_share_service/policy/wanted_anchor.rb +3 -0
  79. data/lib/yoti/dynamic_share_service/policy/wanted_attribute.rb +5 -0
  80. data/lib/yoti/dynamic_share_service/share_url.rb +26 -33
  81. data/lib/yoti/errors.rb +15 -2
  82. data/lib/yoti/http/aml_check_request.rb +12 -6
  83. data/lib/yoti/http/payloads/aml_address.rb +4 -0
  84. data/lib/yoti/http/payloads/aml_profile.rb +7 -1
  85. data/lib/yoti/http/profile_request.rb +11 -6
  86. data/lib/yoti/http/request.rb +219 -18
  87. data/lib/yoti/http/signed_request.rb +13 -4
  88. data/lib/yoti/protobuf/main.rb +8 -8
  89. data/lib/yoti/share/attribute_issuance_details.rb +6 -0
  90. data/lib/yoti/ssl.rb +4 -4
  91. data/lib/yoti/util/age_processor.rb +1 -1
  92. data/lib/yoti/util/anchor_processor.rb +2 -2
  93. data/lib/yoti/util/log.rb +1 -1
  94. data/lib/yoti/util/validation.rb +41 -0
  95. data/lib/yoti/version.rb +1 -1
  96. data/yoti.gemspec +18 -6
  97. metadata +69 -33
  98. data/.github/ISSUE_TEMPLATE.md +0 -17
  99. data/.gitignore +0 -39
  100. data/CONTRIBUTING.md +0 -98
  101. data/Guardfile +0 -11
  102. data/Rakefile +0 -54
  103. data/login_flow.png +0 -0
  104. data/rubocop.yml +0 -57
  105. data/yardstick.yml +0 -9
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # Requests creation of a Check to be performed on a document
9
+ #
10
+ class RequestedCheck
11
+ #
12
+ # @param [String] type The type of the Check to create
13
+ # @param [#as_json] config The configuration to apply to the Check
14
+ #
15
+ def initialize(type, config)
16
+ raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(RequestedCheck)
17
+
18
+ Validation.assert_is_a(String, type, 'type')
19
+ @type = type
20
+
21
+ Validation.assert_respond_to(:as_json, config, 'config')
22
+ @config = config
23
+ end
24
+
25
+ def to_json(*_args)
26
+ as_json.to_json
27
+ end
28
+
29
+ def as_json(*_args)
30
+ {
31
+ type: @type,
32
+ config: @config.as_json
33
+ }
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # Requests creation of a Document Authenticity Check
9
+ #
10
+ class RequestedDocumentAuthenticityCheck < RequestedCheck
11
+ def initialize(config)
12
+ Validation.assert_is_a(
13
+ RequestedDocumentAuthenticityCheckConfig,
14
+ config,
15
+ 'config'
16
+ )
17
+
18
+ super(Constants::ID_DOCUMENT_AUTHENTICITY, config)
19
+ end
20
+
21
+ #
22
+ # @return [RequestedDocumentAuthenticityCheckBuilder]
23
+ #
24
+ def self.builder
25
+ RequestedDocumentAuthenticityCheckBuilder.new
26
+ end
27
+ end
28
+
29
+ #
30
+ # The configuration applied when creating a {RequestedDocumentAuthenticityCheck}
31
+ #
32
+ class RequestedDocumentAuthenticityCheckConfig
33
+ #
34
+ # @param [String] manual_check
35
+ #
36
+ def initialize(manual_check)
37
+ Validation.assert_is_a(String, manual_check, 'manual_check', true)
38
+ @manual_check = manual_check
39
+ end
40
+
41
+ def as_json(*_args)
42
+ {
43
+ manual_check: @manual_check
44
+ }.compact
45
+ end
46
+ end
47
+
48
+ #
49
+ # Builder to assist the creation of {RequestedDocumentAuthenticityCheck}
50
+ #
51
+ class RequestedDocumentAuthenticityCheckBuilder
52
+ #
53
+ # Requires that a manual follow-up check is always performed
54
+ #
55
+ # @return [self]
56
+ #
57
+ def with_manual_check_always
58
+ @manual_check = Constants::ALWAYS
59
+ self
60
+ end
61
+
62
+ #
63
+ # Requires that a manual follow-up check is performed only on failed checks,
64
+ # and those with a low level of confidence
65
+ #
66
+ # @return [self]
67
+ #
68
+ def with_manual_check_fallback
69
+ @manual_check = Constants::FALLBACK
70
+ self
71
+ end
72
+
73
+ #
74
+ # Requires that only an automated check is performed. No manual follow-up
75
+ # Check will ever be initiated
76
+ #
77
+ # @return [self]
78
+ #
79
+ def with_manual_check_never
80
+ @manual_check = Constants::NEVER
81
+ self
82
+ end
83
+
84
+ #
85
+ # @return [RequestedDocumentAuthenticityCheck]
86
+ #
87
+ def build
88
+ config = RequestedDocumentAuthenticityCheckConfig.new(@manual_check)
89
+ RequestedDocumentAuthenticityCheck.new(config)
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # Requests creation of a Face Match Check
9
+ #
10
+ class RequestedFaceMatchCheck < RequestedCheck
11
+ #
12
+ # @param [RequestedFaceMatchCheckConfig] config
13
+ #
14
+ def initialize(config)
15
+ Validation.assert_is_a(
16
+ RequestedFaceMatchCheckConfig,
17
+ config,
18
+ 'config'
19
+ )
20
+
21
+ super(Constants::ID_DOCUMENT_FACE_MATCH, config)
22
+ end
23
+
24
+ #
25
+ # @return [RequestedFaceMatchCheckBuilder]
26
+ #
27
+ def self.builder
28
+ RequestedFaceMatchCheckBuilder.new
29
+ end
30
+ end
31
+
32
+ #
33
+ # The configuration applied when creating a {RequestedFaceMatchCheck}
34
+ #
35
+ class RequestedFaceMatchCheckConfig
36
+ #
37
+ # @param [String] manual_check
38
+ #
39
+ def initialize(manual_check)
40
+ Validation.assert_is_a(String, manual_check, 'manual_check')
41
+ @manual_check = manual_check
42
+ end
43
+
44
+ def as_json(*_args)
45
+ {
46
+ manual_check: @manual_check
47
+ }
48
+ end
49
+ end
50
+
51
+ #
52
+ # Builder to assist the creation of {RequestedFaceMatchCheck}
53
+ #
54
+ class RequestedFaceMatchCheckBuilder
55
+ #
56
+ # Requires that a manual follow-up check is always performed
57
+ #
58
+ # @return [self]
59
+ #
60
+ def with_manual_check_always
61
+ @manual_check = Constants::ALWAYS
62
+ self
63
+ end
64
+
65
+ #
66
+ # Requires that a manual follow-up check is performed only on failed checks,
67
+ # and those with a low level of confidence
68
+ #
69
+ # @return [self]
70
+ #
71
+ def with_manual_check_fallback
72
+ @manual_check = Constants::FALLBACK
73
+ self
74
+ end
75
+
76
+ #
77
+ # Requires that only an automated check is performed. No manual follow-up
78
+ # Check will ever be initiated
79
+ #
80
+ # @return [self]
81
+ #
82
+ def with_manual_check_never
83
+ @manual_check = Constants::NEVER
84
+ self
85
+ end
86
+
87
+ def build
88
+ config = RequestedFaceMatchCheckConfig.new(@manual_check)
89
+ RequestedFaceMatchCheck.new(config)
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # Requests creation of an ID Document Comparison Check
9
+ #
10
+ class RequestedIdDocumentComparisonCheck < RequestedCheck
11
+ def initialize(config)
12
+ Validation.assert_is_a(
13
+ RequestedIdDocumentComparisonCheckConfig,
14
+ config,
15
+ 'config'
16
+ )
17
+
18
+ super(Constants::ID_DOCUMENT_COMPARISON, config)
19
+ end
20
+
21
+ #
22
+ # @return [RequestedIdDocumentComparisonCheckBuilder]
23
+ #
24
+ def self.builder
25
+ RequestedIdDocumentComparisonCheckBuilder.new
26
+ end
27
+ end
28
+
29
+ #
30
+ # The configuration applied when creating a {RequestedIdDocumentComparisonCheck}
31
+ #
32
+ class RequestedIdDocumentComparisonCheckConfig
33
+ def as_json(*_args)
34
+ {}
35
+ end
36
+ end
37
+
38
+ #
39
+ # Builder to assist the creation of {RequestedIdDocumentComparisonCheck}
40
+ #
41
+ class RequestedIdDocumentComparisonCheckBuilder
42
+ #
43
+ # @return [RequestedIdDocumentComparisonCheck]
44
+ #
45
+ def build
46
+ config = RequestedIdDocumentComparisonCheckConfig.new
47
+ RequestedIdDocumentComparisonCheck.new(config)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # Requests creation of a Liveness Check
9
+ #
10
+ class RequestedLivenessCheck < RequestedCheck
11
+ #
12
+ # @param [RequestedLivenessCheckConfig] config
13
+ #
14
+ def initialize(config)
15
+ Validation.assert_is_a(
16
+ RequestedLivenessCheckConfig,
17
+ config,
18
+ 'config'
19
+ )
20
+
21
+ super(Constants::LIVENESS, config)
22
+ end
23
+
24
+ #
25
+ # @return [RequestedLivenessCheckBuilder]
26
+ #
27
+ def self.builder
28
+ RequestedLivenessCheckBuilder.new
29
+ end
30
+ end
31
+
32
+ #
33
+ # The configuration applied when creating a {RequestedLivenessCheck}
34
+ #
35
+ class RequestedLivenessCheckConfig
36
+ #
37
+ # @param [String] liveness_type
38
+ # @param [String] max_retries
39
+ #
40
+ def initialize(liveness_type, max_retries)
41
+ Validation.assert_is_a(String, liveness_type, 'liveness_type')
42
+ @liveness_type = liveness_type
43
+
44
+ Validation.assert_is_a(Integer, max_retries, 'max_retries')
45
+ @max_retries = max_retries
46
+ end
47
+
48
+ def as_json(*_args)
49
+ {
50
+ liveness_type: @liveness_type,
51
+ max_retries: @max_retries
52
+ }
53
+ end
54
+ end
55
+
56
+ #
57
+ # Builder to assist the creation of {RequestedLivenessCheck}
58
+ #
59
+ class RequestedLivenessCheckBuilder
60
+ def initialize
61
+ @max_retries = 1
62
+ end
63
+
64
+ #
65
+ # Sets the type of the liveness check to the supplied value
66
+ #
67
+ # @param [String] liveness_type
68
+ #
69
+ # @return [self]
70
+ #
71
+ def for_liveness_type(liveness_type)
72
+ @liveness_type = liveness_type
73
+ self
74
+ end
75
+
76
+ #
77
+ # Sets the type to be of a ZOOM liveness check
78
+ #
79
+ # @return [self]
80
+ #
81
+ def for_zoom_liveness
82
+ for_liveness_type(Constants::ZOOM)
83
+ end
84
+
85
+ #
86
+ # Sets the maximum number of retries allowed by the user
87
+ #
88
+ # @param [Integer] max_retries
89
+ #
90
+ # @return [self]
91
+ #
92
+ def with_max_retries(max_retries)
93
+ @max_retries = max_retries
94
+ self
95
+ end
96
+
97
+ #
98
+ # @return [RequestedLivenessCheck]
99
+ #
100
+ def build
101
+ config = RequestedLivenessCheckConfig.new(@liveness_type, @max_retries)
102
+ RequestedLivenessCheck.new(config)
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ class RequestedSupplementaryDocTextExtractionTask < RequestedTask
8
+ #
9
+ # @param [RequestedSupplementaryDocTextExtractionTaskConfig] config
10
+ #
11
+ def initialize(config)
12
+ Validation.assert_is_a(
13
+ RequestedSupplementaryDocTextExtractionTaskConfig,
14
+ config,
15
+ 'config'
16
+ )
17
+
18
+ super(Constants::SUPPLEMENTARY_DOCUMENT_TEXT_DATA_EXTRACTION, config)
19
+ end
20
+
21
+ #
22
+ # @return [RequestedSupplementaryDocTextExtractionTaskBuilder]
23
+ #
24
+ def self.builder
25
+ RequestedSupplementaryDocTextExtractionTaskBuilder.new
26
+ end
27
+ end
28
+
29
+ #
30
+ # The configuration applied when creating each SupplementaryDocTextExtractionTask
31
+ #
32
+ class RequestedSupplementaryDocTextExtractionTaskConfig
33
+ #
34
+ # @param [String] manual_check
35
+ # Describes the manual fallback behaviour applied to each Task
36
+ #
37
+ def initialize(manual_check)
38
+ Validation.assert_is_a(String, manual_check, 'manual_check')
39
+ @manual_check = manual_check
40
+ end
41
+
42
+ def as_json(*_args)
43
+ {
44
+ manual_check: @manual_check
45
+ }.compact
46
+ end
47
+ end
48
+
49
+ #
50
+ # Builder to assist creation of {RequestedSupplementaryDocTextExtractionTask}
51
+ #
52
+ class RequestedSupplementaryDocTextExtractionTaskBuilder
53
+ #
54
+ # Requires that the Task is always followed by a manual TextDataCheck
55
+ #
56
+ # @return [self]
57
+ #
58
+ def with_manual_check_always
59
+ @manual_check = Constants::ALWAYS
60
+ self
61
+ end
62
+
63
+ #
64
+ # Requires that only failed Tasks are followed by a manual TextDataCheck
65
+ #
66
+ # @return [self]
67
+ #
68
+ def with_manual_check_fallback
69
+ @manual_check = Constants::FALLBACK
70
+ self
71
+ end
72
+
73
+ #
74
+ # The SupplementaryDocTextExtractionTask will never fallback to a manual TextDataCheck
75
+ #
76
+ # @return [self]
77
+ #
78
+ def with_manual_check_never
79
+ @manual_check = Constants::NEVER
80
+ self
81
+ end
82
+
83
+ #
84
+ # @return [RequestedSupplementaryDocTextExtractionTask]
85
+ #
86
+ def build
87
+ config = RequestedSupplementaryDocTextExtractionTaskConfig.new(@manual_check)
88
+ RequestedSupplementaryDocTextExtractionTask.new(config)
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end