selfsdk 0.0.151 → 0.0.156

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea2ab105920df2fe071f7ffcd72928756f67a49ab45adf55de62194faab98442
4
- data.tar.gz: e1e82f6c2d44aaa24845a04098368ace775ddc608afca5f25ff3e8e61074dfe4
3
+ metadata.gz: 60b6d8b51dbc4342626614a4e46fef73108e2682a64720a6e2258660a89ef82e
4
+ data.tar.gz: a5c531247384f1b2f7306caea9786f113e1a19332c276e53b9c7647744f58d5b
5
5
  SHA512:
6
- metadata.gz: 32d1860c2ad8a5864312939468dc01e05a5cf829ba6ee86248ec2ebd066e193d56fa8f200cdaa775c8377ed0ff48cf33313b69e558c11f8babfea2562959993b
7
- data.tar.gz: 7c66b887cc4f7b60c69abb2c53a6757f37e47e2bd2d8802e5648a4fcb1d74db49564cf35d3b588fbd0831ee98dfc276f3a870ee3779b06cc260b88726d049c33
6
+ metadata.gz: 4d4627bf6291729efa8a8de5fc80f3999d9a6580f9fb76ecb07dc911be9cfa4f1c1844e0069082394c70934a1831d85b55efdf1ac619f298736216489516e0b0
7
+ data.tar.gz: a09427be697a2be3c1cfd745c482146ee07f428a26b5fab80d6f89fdc7fc8e6cfdcf3fb2e31084f54c3be8514ba48f49561cd452db2cb0a64f4c8fbd91df294d
@@ -17,7 +17,7 @@ module SelfSDK
17
17
 
18
18
  protected
19
19
 
20
- def proto
20
+ def proto(to_device)
21
21
  nil
22
22
  end
23
23
  end
@@ -21,9 +21,9 @@ module SelfSDK
21
21
  msgs = []
22
22
  devices.each do |d|
23
23
  msgs << proto(d)
24
+ SelfSDK.logger.info "synchronously messaging to #{@to}:#{d}"
24
25
  end
25
26
  res = @messaging.send_and_wait_for_response(msgs, self)
26
- SelfSDK.logger.info "synchronously messaging to #{@to}:#{@d}"
27
27
  res
28
28
  end
29
29
 
@@ -32,7 +32,7 @@ module SelfSDK
32
32
  res = []
33
33
  devices.each do |d|
34
34
  res << @messaging.send_message(proto(d))
35
- SelfSDK.logger.info "asynchronously requested information to #{@to}:#{@d}"
35
+ SelfSDK.logger.info "asynchronously requested information to #{@to}:#{d}"
36
36
  end
37
37
  res.first
38
38
  end
@@ -72,7 +72,7 @@ module SelfSDK
72
72
 
73
73
  protected
74
74
 
75
- def proto
75
+ def proto(to_device)
76
76
  raise ::StandardError.new("must define this method")
77
77
  end
78
78
 
@@ -59,6 +59,7 @@ module SelfSDK
59
59
  m.to = @from
60
60
  m.audience = @from
61
61
  m.to_device = @messaging.device_id
62
+ m.from_device = @to_device
62
63
  m.facts = @facts
63
64
  m
64
65
  end
@@ -62,7 +62,7 @@ module SelfSDK
62
62
 
63
63
  protected
64
64
 
65
- def proto
65
+ def proto(to_device)
66
66
  encoded_facts = []
67
67
  @facts.each do |fact|
68
68
  encoded_facts.push(fact.to_hash)
@@ -85,7 +85,7 @@ module SelfSDK
85
85
  id: SecureRandom.uuid,
86
86
  sender: "#{@jwt.id}:#{@messaging.device_id}",
87
87
  recipient: "#{@to}:#{@to_device}",
88
- ciphertext: body,
88
+ ciphertext: encrypt_message(body, @to, @to_device)
89
89
  )
90
90
  end
91
91
  end
@@ -40,13 +40,13 @@ module SelfSDK
40
40
  # @param app_id [string] the app id.
41
41
  # @param app_key [string] the app api key provided by developer portal.
42
42
  # @param storage_key [string] the key to be used to encrypt persisted data.
43
+ # @param storage_dir [String] The folder where encryption sessions and settings will be stored
43
44
  # @param [Hash] opts the options to authenticate.
44
45
  # @option opts [String] :base_url The self provider url.
45
46
  # @option opts [String] :messaging_url The messaging self provider url.
46
47
  # @option opts [Bool] :auto_reconnect Automatically reconnects to websocket if connection is lost (defaults to true).
47
48
  # @option opts [Symbol] :env The environment to be used, defaults to ":production".
48
- # @option opts [String] :storage_dir The folder where encryption sessions and settings will be stored
49
- def initialize(app_id, app_key, storage_key, opts = {})
49
+ def initialize(app_id, app_key, storage_key, storage_dir, opts = {})
50
50
  SelfSDK.logger.debug "syncing ntp times #{SelfSDK::Time.now}"
51
51
  env = opts.fetch(:env, "")
52
52
 
@@ -56,7 +56,7 @@ module SelfSDK
56
56
  @messaging_client = MessagingClient.new(messaging_url,
57
57
  @client,
58
58
  storage_key,
59
- storage_dir: opts.fetch(:storage_dir, MessagingClient::DEFAULT_STORAGE_DIR),
59
+ storage_dir: storage_dir,
60
60
  auto_reconnect: opts.fetch(:auto_reconnect, MessagingClient::DEFAULT_AUTO_RECONNECT),
61
61
  device_id: opts.fetch(:device_id, MessagingClient::DEFAULT_DEVICE))
62
62
  end
@@ -150,7 +150,7 @@ module SelfSDK
150
150
  raise 'provided fact does not specify a name' if f[:fact].empty?
151
151
  return unless f.has_key? :sources
152
152
 
153
- valid_sources = [SOURCE_USER_SPECIFIED, SOURCE_PASSPORT, SOURCE_DRIVING_LICENSE, SOURCE_ID_CARD]
153
+ valid_sources = [SOURCE_USER_SPECIFIED, SOURCE_PASSPORT, SOURCE_DRIVING_LICENSE, SOURCE_IDENTITY_CARD]
154
154
  factsForPassport = [ FACT_DOCUMENT_NUMBER,
155
155
  FACT_SURNAME,
156
156
  FACT_GIVEN_NAMES,
@@ -179,7 +179,7 @@ module SelfSDK
179
179
  f[:sources].each do |s|
180
180
  raise errInvalidSource unless valid_sources.include? s.to_s
181
181
 
182
- if s.to_s == SOURCE_PASSPORT || s.to_s == SOURCE_ID_CARD
182
+ if s.to_s == SOURCE_PASSPORT || s.to_s == SOURCE_IDENTITY_CARD
183
183
  raise errInvalidFactToSource unless factsForPassport.include? f[:fact]
184
184
  end
185
185
 
@@ -26,7 +26,7 @@ module SelfSDK
26
26
  SOURCE_USER_SPECIFIED = "user_specified"
27
27
  SOURCE_PASSPORT = "passport"
28
28
  SOURCE_DRIVING_LICENSE = "driving_license"
29
- SOURCE_ID_CARD = "identity_card"
29
+ SOURCE_IDENTITY_CARD = "identity_card"
30
30
 
31
31
  class << self
32
32
  def message_type(s)
@@ -75,7 +75,7 @@ module SelfSDK
75
75
  sources = { user_specified: SOURCE_USER_SPECIFIED,
76
76
  passport: SOURCE_PASSPORT,
77
77
  driving_license: SOURCE_DRIVING_LICENSE,
78
- id_card: SOURCE_ID_CARD }
78
+ identity_card: SOURCE_IDENTITY_CARD }
79
79
  get(sources, input, "source")
80
80
  end
81
81
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selfsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.151
4
+ version: 0.0.156
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldgate Ventures