trusona 0.19.0 → 0.20.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86dadc0e339a0f3fab0224c8dcb277b751c7d9a27c08b3aca8cc476609056b3c
4
- data.tar.gz: cfaf39cfbf6fa7cdde0ccf606bbeb0290d5494257abe38395123a5b0ba213904
3
+ metadata.gz: bdcf928f661f66469a27da5a6515b3b1ec68b3ce245faaa76158c061f17c1fe7
4
+ data.tar.gz: dc9389c4b77105a019ee0d0ffb6ca2de767f8eebca50b4fb75201424613b15ba
5
5
  SHA512:
6
- metadata.gz: 2fa476090b8cf3241d6967aa0eab6db67d4d5e5d12231718619880896dab55362dbf31b74546e8c2b41bf51a06033e0da9852050dfef9896152bf60d5c2cab2b
7
- data.tar.gz: d7ed5c8dcb5c67919b5b1565271fe13fdf5c9851e1964fee2bc4b1a1ee5a3480e1563144c6235f2cf84bf32a8994b1c65df6c86805e653870658d6ed6aa00848
6
+ metadata.gz: 5e44c1b04895ecf2b2678276b39b1eeeab62694354f649f688c4977563fc1da549fcb547606a0d9edda41a38d1d6133c0780f801ebf45b1f16aed4501c71e0cb
7
+ data.tar.gz: 04184f98a61b4fed7906ea170eed8e8dfb2a603ca9fab25bf99794274dc9aad6723995763b74166012616f9105cd443160c342d15d00e651d008d7343904c281
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -87,11 +87,9 @@ The binding requires two values, the user identifier that helps you identify the
87
87
  Trusona::DeviceUserBinding.activate(id: binding.id)
88
88
  ```
89
89
 
90
- ### Trusonafications
90
+ ### Creating Trusonafications
91
91
 
92
- #### Creating a Trusonafication
93
-
94
- A simple Essential level Trusonafication
92
+ #### Creating an Essential Trusonafication
95
93
 
96
94
  ```ruby
97
95
  Trusona::EssentialTrusonafication.create(params: {
@@ -101,29 +99,46 @@ A simple Essential level Trusonafication
101
99
  })
102
100
  ```
103
101
 
104
- An Executive level Trusonafication
102
+ By default, Essential Trusonafications are built such that the user's presence is required and a prompt asking the user to "Accept" or "Reject" the Trusonafication is presented by the Trusona Mobile SDK. A user's presence is determined by their ability to interact with the device's OS Security, usually by using a biometric or entering the device passcode.
103
+
104
+ #### Creating an Essential Trusonafication, without user presence or a prompt
105
105
 
106
106
  ```ruby
107
- Trusona::ExecutiveTrusonafication.create(params: {
107
+ Trusona::EssentialTrusonafication.create(params: {
108
108
  action: 'login',
109
109
  resource: 'Acme Bank',
110
- device_identifier: 'PBanKaajTmz_Cq1pDkrRzyeISBSBoGjExzp5r6-UjcI'
110
+ device_identifier: 'PBanKaajTmz_Cq1pDkrRzyeISBSBoGjExzp5r6-UjcI',
111
+ user_presence: false,
112
+ prompt: false
111
113
  })
112
114
  ```
113
115
 
114
- A more complex example, toggling optional fields
116
+ In the above example, the addition of `user_presence: false` and `prompt: false` will result in a Trusonafication that can be accepted solely with possession of the device.
115
117
 
118
+ #### Creating an Essential Trusonafication, with the user's email address
116
119
  ```ruby
117
120
  Trusona::EssentialTrusonafication.create(params: {
118
121
  action: 'login',
119
122
  resource: 'Acme Bank',
120
- device_identifier: 'PBanKaajTmz_Cq1pDkrRzyeISBSBoGjExzp5r6-UjcI',
121
- user_presence: false,
122
- prompt: false
123
+ email: 'user@domain.com'
123
124
  })
124
125
  ```
126
+ In some cases you may be able to send a Trusonafication to a user
127
+ by specifying their email address. This is the case if one of the following is true:
128
+ - You have verified ownership of a domain through the Trusona Developer's site
129
+ - You have an agreement with Trusona allowing you to send Trusonafications to any email address.
130
+ Creating a Trusonafication with an email address is similar to the other
131
+ use cases, except you use the `email` parameter rather than `user_identifier` or `device_identifier`.
125
132
 
133
+ #### An Executive level Trusonafication
126
134
 
135
+ ```ruby
136
+ Trusona::ExecutiveTrusonafication.create(params: {
137
+ action: 'login',
138
+ resource: 'Acme Bank',
139
+ device_identifier: 'PBanKaajTmz_Cq1pDkrRzyeISBSBoGjExzp5r6-UjcI'
140
+ })
141
+ ```
127
142
 
128
143
  #### Trusonafication Options
129
144
 
@@ -30,10 +30,10 @@ module Trusona
30
30
  # device: 'PBanKaajTmz_Cq1pDkrRzyeISBSBoGjExzp5r6-UjcI'
31
31
  # )
32
32
  #
33
-
34
33
  def self.create(user: nil, device: nil)
35
34
  raise ArgumentError, 'User is missing' if user.nil? || user.empty?
36
35
  raise ArgumentError, 'Device is missing' if device.nil? || device.empty?
36
+
37
37
  Trusona::Workers::DeviceUserBindingCreator.new.create(
38
38
  user: user, device: device
39
39
  )
@@ -50,6 +50,7 @@ module Trusona
50
50
 
51
51
  def self.activate(id: nil)
52
52
  raise ArgumentError if id.nil? || id.empty?
53
+
53
54
  Trusona::Workers::DeviceUserBindingActivator.new.activate(id: id)
54
55
  end
55
56
  end
@@ -39,6 +39,10 @@ module Trusona
39
39
  # An error resulting from 400 errors from the Trusona REST API
40
40
  class BadRequestError < RequestError; end
41
41
 
42
+ ##
43
+ # An error resulting from 422 errors from the Trusona REST API
44
+ class UnprocessableEntityError < RequestError; end
45
+
42
46
  ##
43
47
  # An error resulting from 424 errors from the Trusona REST API
44
48
  class FailedDependencyError < RequestError; end
@@ -30,6 +30,7 @@ module Trusona
30
30
  def self.all(user_identifier: nil)
31
31
  # rubocop:disable Metrics/LineLength
32
32
  raise ArgumentError, 'A user identifier is required.' unless user_identifier
33
+
33
34
  # rubocop:enable Metrics/LineLength
34
35
 
35
36
  Trusona::Workers::IdentityDocumentFinder.new.find_all(user_identifier)
@@ -56,6 +57,7 @@ module Trusona
56
57
  def self.find(id: nil)
57
58
  # rubocop:disable Metrics/LineLength
58
59
  raise ArgumentError, 'An Identity Document identifier is required.' unless id
60
+
59
61
  # rubocop:enable Metrics/LineLength
60
62
 
61
63
  Trusona::Workers::IdentityDocumentFinder.new.find(id)
@@ -9,7 +9,7 @@ module Trusona
9
9
  include Trusona::Helpers::TimeNormalizer
10
10
 
11
11
  attr_accessor :device_identifier, :user_identifier, :trucode_id,
12
- :resource, :action, :level, :id,
12
+ :resource, :action, :level, :id, :email,
13
13
  :accepted_level, :trusona_id, :expires_at,
14
14
  :user_presence, :callback_url, :prompt
15
15
 
@@ -23,6 +23,7 @@ module Trusona
23
23
  self.device_identifier = @params[:device_identifier]
24
24
  self.user_identifier = @params[:user_identifier]
25
25
  self.trucode_id = @params[:trucode_id]
26
+ self.email = @params[:email]
26
27
  self.expires_at = normalize_time(@params[:expires_at])
27
28
  self.id = @params[:id]
28
29
  self.level = @params[:level]
@@ -47,6 +48,7 @@ module Trusona
47
48
  user_identifier: user_identifier,
48
49
  trucode_id: trucode_id,
49
50
  trusona_id: trusona_id,
51
+ email: email,
50
52
  resource: resource,
51
53
  action: action,
52
54
  desired_level: level,
@@ -130,7 +132,7 @@ module Trusona
130
132
  end
131
133
 
132
134
  def identifier
133
- device_identifier || user_identifier || trucode_id || trusona_id
135
+ device_identifier || user_identifier || trucode_id || trusona_id || email
134
136
  end
135
137
  end
136
138
  end
@@ -67,6 +67,8 @@ module Trusona
67
67
  not_found
68
68
  when 403
69
69
  unauthorized
70
+ when 422
71
+ unprocessable_entity
70
72
  when 424
71
73
  failed_dependency
72
74
  when 500..599
@@ -87,6 +89,10 @@ module Trusona
87
89
  raise Trusona::BadRequestError, readable_error
88
90
  end
89
91
 
92
+ def unprocessable_entity
93
+ raise Trusona::UnprocessableEntityError, readable_error
94
+ end
95
+
90
96
  def failed_dependency
91
97
  raise Trusona::FailedDependencyError, readable_error
92
98
  end
@@ -42,6 +42,9 @@ module Trusona
42
42
  # @option params [String] :user_identifier The user identifier,
43
43
  # previously registered with Trusona, of the user to which this
44
44
  # Trusonafication will be sent.
45
+ # @option params [String] :email The user email address,
46
+ # previously registered with Trusona, of the user to which this
47
+ # Trusonafication will be sent.
45
48
  # @option params [String] :trucode_id The TruCode ID that has either been
46
49
  # scanned or will be scanned using the mobile SDK that will be used to
47
50
  # determine which device to send the Trusonafication to.
@@ -86,7 +89,8 @@ module Trusona
86
89
  normalized_params[:user_identifier] ||
87
90
  normalized_params[:device_identifier] ||
88
91
  normalized_params[:trucode_id] ||
89
- normalized_params[:trusona_id]
92
+ normalized_params[:trusona_id] ||
93
+ normalized_params[:email]
90
94
  end
91
95
  end
92
96
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Trusona
4
- VERSION = '0.19.0'
4
+ VERSION = '0.20.0'
5
5
  end
@@ -43,4 +43,4 @@ module Trusona
43
43
  # rubocop:enable Metrics/MethodLength
44
44
  end
45
45
  end
46
- end
46
+ end
@@ -24,4 +24,4 @@ module Trusona
24
24
  end
25
25
  end
26
26
  end
27
- end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusona
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trusona
@@ -35,7 +35,7 @@ cert_chain:
35
35
  vbhUT8kOS+bZTalorEol37DD/P4Bbv0fMpw+ozetR2RmwhwTKPKJ5r0oQP6tiqHn
36
36
  hQ==
37
37
  -----END CERTIFICATE-----
38
- date: 2018-08-02 00:00:00.000000000 Z
38
+ date: 2018-10-24 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: httparty
metadata.gz.sig CHANGED
Binary file