yoti 1.6.0 → 1.6.1

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
  SHA1:
3
- metadata.gz: 691432df23cdd73c562aedd1f85ea6077ce38508
4
- data.tar.gz: ba22b06a08a95aaff4c3309e1e7c1db4195f4a10
3
+ metadata.gz: 554c3f07a3798f6c7f40a0dcd126449a8d866fe6
4
+ data.tar.gz: 3f09b020f30e99038faf01bc74db8106f4fc7b31
5
5
  SHA512:
6
- metadata.gz: b8fba42c58a939ffbd6f66d97e2970cc34a705e1b3f04ccffb5fddba494a8f273de9aadb6d9c88b5c3cd6be8a673655c23347f35da303f7f408c74cc22747155
7
- data.tar.gz: de2c82706cd19db939a182e45134c3d0aaf282cb1b0785e443e8691cf419b76250921ad0507f84987206c3075fdf127fa4b2d1b554d499764dc95f1db43c86cd
6
+ metadata.gz: 37cbabc0963156cdd95bc7ba2bd1657ce01a180619c44993f4e2298e902f0d7856d924c887a1333bec73fd8c24c8d553136b18733470191df2a59b3d5399fca2
7
+ data.tar.gz: 49c22b5abc8a43e6e3c7b0021a7b3a2c37b417f24f6247f01dd6844c638969b4c216be52fd0e646b1f1a4285d93ce2a3982b6d687f9d9d06451c3a4387b19369
@@ -93,6 +93,9 @@ module Yoti
93
93
  #
94
94
  # @param receipt [Hash] the receipt from the API request
95
95
  # @param decrypted_profile [Object] Protobuf AttributeList decrypted object containing the profile attributes
96
+ # @param decrypted_application_profile [Object] Protobuf AttributeList decrypted object containing profile attributes for the application profile
97
+ # @param extra_data [Yoti::Share::ExtraData|nil] Processed extra data object or nil
98
+ # if absent from the receipt
96
99
  #
97
100
  def initialize(receipt, decrypted_profile = nil, decrypted_application_profile = nil, extra_data = nil)
98
101
  @remember_me_id = receipt['remember_me_id']
@@ -103,7 +106,7 @@ module Yoti
103
106
  @timestamp = receipt['timestamp'] ? Time.parse(receipt['timestamp']) : nil
104
107
  @extended_user_profile = process_decrypted_profile(decrypted_profile)
105
108
  @extended_application_profile = process_decrypted_profile(decrypted_application_profile)
106
- @extra_data = Share::ExtraData.new(extra_data) if extra_data
109
+ @extra_data = extra_data
107
110
  @user_profile = @extended_user_profile.map do |name, attribute|
108
111
  [name, attribute.value]
109
112
  end.to_h
@@ -2,6 +2,16 @@
2
2
 
3
3
  module Yoti
4
4
  module DynamicSharingService
5
+ class ThirdPartyAttributeDefinition
6
+ def initialize(name)
7
+ @name = name
8
+ end
9
+
10
+ def to_json(*_args)
11
+ { name: @name }.to_json
12
+ end
13
+ end
14
+
5
15
  class ThirdPartyAttributeExtensionBuilder
6
16
  def initialize
7
17
  @expiry_date = nil
@@ -14,8 +24,8 @@ module Yoti
14
24
  end
15
25
 
16
26
  def with_definitions(*names)
17
- names.each do |s|
18
- @definitions += [{ name: s }]
27
+ @definitions += names.map do |name|
28
+ ThirdPartyAttributeDefinition.new(name)
19
29
  end
20
30
  self
21
31
  end
@@ -44,9 +44,9 @@ module Yoti
44
44
  end
45
45
 
46
46
  def extra_data(receipt)
47
- return nil unless valid_receipt?(receipt)
47
+ return nil if receipt['extra_data_content'].nil? || receipt['extra_data_content'] == ''
48
48
 
49
- decipher_profile(receipt['extra_data'], receipt['wrapped_receipt_key']) if receipt['extra_data']
49
+ decipher_extra_data(receipt['extra_data_content'], receipt['wrapped_receipt_key'])
50
50
  end
51
51
 
52
52
  def attribute_list(data)
@@ -111,11 +111,21 @@ module Yoti
111
111
  end
112
112
 
113
113
  def decipher_profile(profile_content, wrapped_key)
114
- encrypted_data = decode_profile(profile_content)
115
- unwrapped_key = Yoti::SSL.decrypt_token(wrapped_key)
116
- decrypted_data = Yoti::SSL.decipher(unwrapped_key, encrypted_data.iv, encrypted_data.cipher_text)
114
+ decrypted_data = decipher_data(profile_content, wrapped_key)
117
115
  Protobuf.attribute_list(decrypted_data)
118
116
  end
117
+
118
+ def decipher_extra_data(extra_data_content, wrapped_key)
119
+ decrypted_data = decipher_data(extra_data_content, wrapped_key)
120
+ proto = Yoti::Protobuf::Sharepubapi::ExtraData.decode(decrypted_data)
121
+ Share::ExtraData.new(proto)
122
+ end
123
+
124
+ def decipher_data(encrypted_content, wrapped_key)
125
+ encrypted_data = decode_profile(encrypted_content)
126
+ unwrapped_key = Yoti::SSL.decrypt_token(wrapped_key)
127
+ Yoti::SSL.decipher(unwrapped_key, encrypted_data.iv, encrypted_data.cipher_text)
128
+ end
119
129
  end
120
130
  end
121
131
  end
@@ -28,7 +28,7 @@ module Yoti
28
28
  # @param [Yoti::Protobuf::Sharepubapi::ThirdPartyAttribute] data_entry
29
29
  #
30
30
  def initialize(data_entry)
31
- @token = Base64.encode64(data_entry.issuance_token)
31
+ @token = Base64.strict_encode64(data_entry.issuance_token)
32
32
  begin
33
33
  @expiry_date = DateTime.parse(data_entry.issuing_attributes.expiry_date)
34
34
  rescue ArgumentError
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.0'.freeze
3
+ VERSION = '1.6.1'.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.0
4
+ version: 1.6.1
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-01-15 00:00:00.000000000 Z
11
+ date: 2020-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport