yoti 1.6.2 → 1.6.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c4c6b42bdd6df1e2563833af67cdae2986629ac2af375f12bcaf4ece3337584
4
- data.tar.gz: 4c715d060b60a2fea8d72a29ba36706b8f95e72dd86fbece7a73a7e750a6f9f2
3
+ metadata.gz: 296612e32508787e11d3c6f9404434b9d9575284008ae7d60df4a20f83526f6f
4
+ data.tar.gz: 4e0e6a0c0ea6a297399df4a9937ae3e6cd82da95f67d5a70b8cc7db0665e5c50
5
5
  SHA512:
6
- metadata.gz: 36ea44c5b17a8f8b87ce6177e1d3278aa6323f3e77492cd87a6fc88bb7d0fd47d33be56c81e810ae3cac54fa21d61df80cb1d95941d98cec681b5a642667f60e
7
- data.tar.gz: 36e481733c4d16d4f894e341695d63cb8ac20c34be7116439f8881f5d8d5a4e0e9f819c8e1c89b2f971cd2439a1b17e3033dc5da51242344a4bd95971d25ec94
6
+ metadata.gz: fc8a50eab70a1b29ba480e7df303144d56b4edb46b48124292dbfb98de9167659eee80b2d38e0c633c709151953252cb888dad5f2114c721eed8871915b3f0b2
7
+ data.tar.gz: 2c8dcc5342813067af5fb6980ef0acb8c5c8f2981c23fbf4311261a46034f852ba35b1c028a6cfed33c5fda52d0b193cb857e145cbafa4b342e0377e0ff2effb
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Custom issue template
3
+ about: " There's a better way to get help!"
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ #
11
+ # Wait ✋
12
+ #
13
+ # There's a better way to get help!
14
+ #
15
+ # Send your questions or issues to sdksupport@yoti.com
16
+ #
17
+ #
@@ -1,4 +1,5 @@
1
1
  require 'net/http'
2
+ require 'time'
2
3
 
3
4
  module Yoti
4
5
  #
data/lib/yoti/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Yoti
2
2
  # @return [String] the gem's current version
3
- VERSION = '1.6.2'.freeze
3
+ VERSION = '1.6.3'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yoti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Zaremba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-13 00:00:00.000000000 Z
11
+ date: 2020-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -208,6 +208,7 @@ executables: []
208
208
  extensions: []
209
209
  extra_rdoc_files: []
210
210
  files:
211
+ - ".github/ISSUE_TEMPLATE.md"
211
212
  - ".gitignore"
212
213
  - CONTRIBUTING.md
213
214
  - Gemfile
@@ -261,11 +262,6 @@ files:
261
262
  - lib/yoti/protobuf/sharepubapi/ExtraData_pb.rb
262
263
  - lib/yoti/protobuf/sharepubapi/IssuingAttributes_pb.rb
263
264
  - lib/yoti/protobuf/sharepubapi/ThirdPartyAttribute_pb.rb
264
- - lib/yoti/sandbox.rb
265
- - lib/yoti/sandbox/anchor.rb
266
- - lib/yoti/sandbox/attribute.rb
267
- - lib/yoti/sandbox/profile.rb
268
- - lib/yoti/sandbox/sandbox_client.rb
269
265
  - lib/yoti/share/attribute_issuance_details.rb
270
266
  - lib/yoti/share/extra_data.rb
271
267
  - lib/yoti/ssl.rb
data/lib/yoti/sandbox.rb DELETED
@@ -1,4 +0,0 @@
1
- require_relative 'sandbox/anchor'
2
- require_relative 'sandbox/attribute'
3
- require_relative 'sandbox/profile'
4
- require_relative 'sandbox/sandbox_client'
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Sandbox
4
- # Anchor describes an anchor on a Sandbox Attribute
5
- class Anchor
6
- attr_reader :type
7
- attr_reader :value
8
- attr_reader :sub_type
9
- attr_reader :timestamp
10
-
11
- def initialize(type:, value:, sub_type: '', timestamp: Time.now)
12
- @type = type
13
- @value = value
14
- @sub_type = sub_type
15
- @timestamp = timestamp
16
- end
17
-
18
- def as_json(*_args)
19
- {
20
- type: @type,
21
- value: @value,
22
- sub_type: @sub_type,
23
- timestamp: @timestamp.to_i
24
- }
25
- end
26
-
27
- def to_json(*args)
28
- as_json.to_json(*args)
29
- end
30
-
31
- def self.source(value, sub_type: '', timestamp: Time.now)
32
- Anchor.new(
33
- type: 'SOURCE',
34
- value: value,
35
- sub_type: sub_type,
36
- timestamp: timestamp
37
- )
38
- end
39
-
40
- def self.verifier(value, sub_type: '', timestamp: Time.now)
41
- Anchor.new(
42
- type: 'VERIFIER',
43
- value: value,
44
- sub_type: sub_type,
45
- timestamp: timestamp
46
- )
47
- end
48
- end
49
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Sandbox
4
- # Attribute describes an attribute on a sandbox profile
5
- class Attribute
6
- attr_accessor :name
7
- attr_accessor :value
8
- attr_accessor :derivation
9
- attr_accessor :optional
10
- attr_reader :anchors
11
-
12
- def initialize(
13
- name: '',
14
- value: '',
15
- derivation: '',
16
- optional: false,
17
- anchors: []
18
- )
19
- @name = name
20
- @value = value
21
- @derivation = derivation
22
- @optional = optional
23
- @anchors = anchors
24
- end
25
-
26
- def as_json(*_args)
27
- {
28
- name: name,
29
- value: value,
30
- derivation: derivation,
31
- optional: optional,
32
- anchors: anchors
33
- }
34
- end
35
-
36
- def with_anchor(anchor)
37
- @anchors.push anchor
38
- self
39
- end
40
- end
41
-
42
- # Helper functions for building derivation strings
43
- module Derivation
44
- def self.age_over(age)
45
- "age_over:#{age}"
46
- end
47
-
48
- def self.age_under(age)
49
- "age_under:#{age}"
50
- end
51
- end
52
- end
@@ -1,171 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'yoti/data_type/attribute'
4
-
5
- require 'base64'
6
-
7
- require_relative 'attribute'
8
-
9
- module Sandbox
10
- # Builds a user profile on the sandbox instance
11
- class Profile
12
- attr_reader :remember_me_id
13
- attr_reader :attributes
14
-
15
- def as_json(*_args)
16
- {
17
- remember_me_id: remember_me_id,
18
- profile_attributes: attributes.map(&:as_json)
19
- }
20
- end
21
-
22
- def to_json(*_args)
23
- as_json.to_json
24
- end
25
-
26
- def initialize
27
- @remember_me_id = ''
28
- @attributes = []
29
- end
30
-
31
- def with_remember_me_id(id)
32
- @remember_me_id = id
33
- self
34
- end
35
-
36
- def with_attribute(
37
- name:,
38
- value:,
39
- derivation: '',
40
- optional: false,
41
- anchors: []
42
- )
43
- @attributes.push Sandbox::Attribute.new(
44
- name: name,
45
- value: value,
46
- derivation: derivation,
47
- optional: optional,
48
- anchors: anchors
49
- )
50
- self
51
- end
52
-
53
- def with_given_names(value, optional: false, anchors: [])
54
- with_attribute(
55
- name: Yoti::Attribute::GIVEN_NAMES,
56
- value: value,
57
- optional: optional,
58
- anchors: anchors
59
- )
60
- end
61
-
62
- def with_family_name(value, optional: false, anchors: [])
63
- with_attribute(
64
- name: Yoti::Attribute::FAMILY_NAME,
65
- value: value,
66
- optional: optional,
67
- anchors: anchors
68
- )
69
- end
70
-
71
- def with_full_name(value, optional: false, anchors: [])
72
- with_attribute(
73
- name: Yoti::Attribute::FULL_NAME,
74
- value: value,
75
- optional: optional,
76
- anchors: anchors
77
- )
78
- end
79
-
80
- def with_date_of_birth(date, optional: false, anchors: [])
81
- with_attribute(
82
- name: Yoti::Attribute::DATE_OF_BIRTH,
83
- value: date.to_s,
84
- optional: optional,
85
- anchors: anchors
86
- )
87
- end
88
-
89
- def with_age_verification(dob:, derivation:, optional: false, anchors: [])
90
- with_attribute(
91
- name: Yoti::Attribute::DATE_OF_BIRTH,
92
- value: dob.to_s,
93
- derivation: derivation,
94
- optional: optional,
95
- anchors: anchors
96
- )
97
- end
98
-
99
- def with_gender(value, optional: false, anchors: [])
100
- with_attribute(
101
- name: Yoti::Attribute::GENDER,
102
- value: value,
103
- optional: optional,
104
- anchors: anchors
105
- )
106
- end
107
-
108
- def with_phone_number(value, optional: false, anchors: [])
109
- with_attribute(
110
- name: Yoti::Attribute::PHONE_NUMBER,
111
- value: value,
112
- optional: optional,
113
- anchors: anchors
114
- )
115
- end
116
-
117
- def with_nationality(value, optional: false, anchors: [])
118
- with_attribute(
119
- name: Yoti::Attribute::NATIONALITY,
120
- value: value,
121
- optional: optional,
122
- anchors: anchors
123
- )
124
- end
125
-
126
- def with_postal_address(value, optional: false, anchors: [])
127
- with_attribute(
128
- name: Yoti::Attribute::POSTAL_ADDRESS,
129
- value: value,
130
- optional: optional,
131
- anchors: anchors
132
- )
133
- end
134
-
135
- def with_structured_postal_address(data, optional: false, anchors: [])
136
- with_attribute(
137
- name: Yoti::Attribute::STRUCTURED_POSTAL_ADDRESS,
138
- value: data.to_json,
139
- optional: optional,
140
- anchors: anchors
141
- )
142
- end
143
-
144
- def with_selfie(data, optional: false, anchors: [])
145
- with_attribute(
146
- name: Yoti::Attribute::SELFIE,
147
- value: Base64.strict_encode64(data),
148
- optional: optional,
149
- anchors: anchors
150
- )
151
- end
152
-
153
- def with_email_address(value, optional: false, anchors: [])
154
- with_attribute(
155
- name: Yoti::Attribute::EMAIL_ADDRESS,
156
- value: value,
157
- optional: optional,
158
- anchors: anchors
159
- )
160
- end
161
-
162
- def with_document_details(value, optional: false, anchors: [])
163
- with_attribute(
164
- name: Yoti::Attribute::DOCUMENT_DETAILS,
165
- value: value,
166
- optional: optional,
167
- anchors: anchors
168
- )
169
- end
170
- end
171
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Sandbox
4
- # Client is responsible for setting up test data in the sandbox instance
5
- class Client
6
- attr_accessor :base_url
7
-
8
- def initialize(base_url:)
9
- @base_url = base_url
10
- end
11
-
12
- def setup_sharing_profile(profile)
13
- endpoint = "/apps/#{Yoti.configuration.client_sdk_id}/tokens?\
14
- nonce=#{SecureRandom.uuid}&timestamp=#{Time.now.to_i}"
15
- uri = URI(
16
- "#{@base_url}/#{endpoint}"
17
- )
18
-
19
- response = Net::HTTP.start(
20
- uri.hostname,
21
- uri.port,
22
- use_ssl: true
23
- ) do |http|
24
- unsigned = Net::HTTP::Post.new uri
25
- unsigned.body = profile.to_json
26
- signed_request = Yoti::SignedRequest.new(
27
- unsigned,
28
- endpoint,
29
- profile
30
- ).sign
31
- http.request signed_request
32
- end
33
-
34
- raise "Failed to share profile #{response.code}: #{response.body}" unless response.code == '201'
35
-
36
- token = JSON.parse(response.body)['token']
37
- token
38
- end
39
- end
40
- end