selfsdk 0.0.186 → 0.0.189

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: 537d89a4c6f35651b5c5935b12861a3b76966a34858fc8c0cce2e6a0c079a574
4
- data.tar.gz: a1e8991eff4ccaf30dd7ee633a17009f43e68e383b28cedb29cd61977135b575
3
+ metadata.gz: 5b2273047a020d9c4a04ae840a37fedb2129cba216613ae91c54de7a04f16539
4
+ data.tar.gz: 56d2336cdb03b894d5a792096ec2471bb9dba07377e3a1a7c735a225362cc886
5
5
  SHA512:
6
- metadata.gz: f2c2a074476b655870575194c68781a905b5a6186823c732c70a612d61baa530f2e10cc501b80013571119befcc9d0decd18dc55c15e999751eb908d7576e9d8
7
- data.tar.gz: 7587e69db01c25ccaa558da3ef9f70d9a668c16d6b93c12b178f86ca8956f5a90b966e8107b9157a7211e6a2cb78ef801644792c1886ee0ea129c8d22363c5cc
6
+ metadata.gz: dc6acc1f75c6eb4fb2b64f372441d3a712f04958bca1f029809ea970d091850a5291d911587068ab4ba348a76d3baf29632cf9e337817e6c750907cddb51cabc
7
+ data.tar.gz: c32cd01077dba0a2e0087d40472dac1b7ef565c01632a7ccd86e9f5286d9f01c6bb3b19865a64acd8b9a45006c0b5ff820a5adc466c32ead069cafebd9ee2958
data/lib/crypto.rb CHANGED
@@ -141,12 +141,17 @@ module SelfSDK
141
141
  if File.exist?(session_file_name)
142
142
  # 7a) if carol's session file exists load the pickle from the file
143
143
  session_with_bob = SelfCrypto::Session.from_pickle(File.read(session_file_name), @storage_key)
144
- else
145
- # 7b-i) if you have not previously sent or received a message to/from bob,
146
- # you should extract the initial message from the group message intended
147
- # for your account id.
148
- m = SelfCrypto::GroupMessage.new(message.to_s).get_message("#{@client.jwt.id}:#{@device}")
144
+ end
145
+
146
+ # 7b-i) if you have not previously sent or received a message to/from bob,
147
+ # you should extract the initial message from the group message intended
148
+ # for your account id.
149
+ m = SelfCrypto::GroupMessage.new(message.to_s).get_message("#{@client.jwt.id}:#{@device}")
149
150
 
151
+ # if there is no session, create one
152
+ # if there is an existing session and we are sent a one time key message, check
153
+ # if it belongs to this current session and create a new inbound session if it doesn't
154
+ if session_with_bob.nil? || m.instance_of?(SelfCrypto::PreKeyMessage) and !session_with_bob.will_receive?(m)
150
155
  # 7b-ii) use the initial message to create a session for bob or carol
151
156
  session_with_bob = @account.inbound_session(m)
152
157
 
@@ -37,7 +37,7 @@ module SelfSDK
37
37
  end
38
38
 
39
39
  def validate!(original)
40
- raise ::StandardError.new("invalid origin") if @to != original.to
40
+ raise ::StandardError.new("invalid origin") if @to.split(":").first != original.to
41
41
  end
42
42
 
43
43
  def signed
@@ -152,7 +152,13 @@ module SelfSDK
152
152
  raise 'provided fact does not specify a name' if f[:fact].empty?
153
153
  return unless f.has_key? :sources
154
154
 
155
- valid_sources = [SOURCE_USER_SPECIFIED, SOURCE_PASSPORT, SOURCE_DRIVING_LICENSE, SOURCE_IDENTITY_CARD]
155
+ valid_sources = [ SOURCE_USER_SPECIFIED,
156
+ SOURCE_PASSPORT,
157
+ SOURCE_DRIVING_LICENSE,
158
+ SOURCE_IDENTITY_CARD,
159
+ SOURCE_TWITTER,
160
+ SOURCE_LINKEDIN,
161
+ SOURCE_FACEBOK ]
156
162
  factsForPassport = [ FACT_DOCUMENT_NUMBER,
157
163
  FACT_SURNAME,
158
164
  FACT_GIVEN_NAMES,
@@ -177,7 +183,11 @@ module SelfSDK
177
183
  FACT_DISPLAY_NAME,
178
184
  FACT_EMAIL,
179
185
  FACT_PHONE ]
180
-
186
+
187
+ factsForTwitter = [ FACT_ACCOUNT_ID, FACT_NICKNAME ]
188
+ factsForLinkedin = [ FACT_ACCOUNT_ID, FACT_NICKNAME ]
189
+ factsForFacebook = [ FACT_ACCOUNT_ID, FACT_NICKNAME ]
190
+
181
191
  f[:sources].each do |s|
182
192
  raise errInvalidSource unless valid_sources.include? s.to_s
183
193
 
@@ -192,6 +202,18 @@ module SelfSDK
192
202
  if s.to_s == SOURCE_USER_SPECIFIED
193
203
  raise errInvalidFactToSource unless factsForUser.include? f[:fact].to_s
194
204
  end
205
+
206
+ if s.to_s == SOURCE_TWITTER
207
+ raise errInvalidFactToSource unless factsForTwitter.include? f[:fact].to_s
208
+ end
209
+
210
+ if s.to_s == SOURCE_LINKEDIN
211
+ raise errInvalidFactToSource unless factsForLinkedin.include? f[:fact].to_s
212
+ end
213
+
214
+ if s.to_s == SOURCE_FACEBOOK
215
+ raise errInvalidFactToSource unless factsForFacebok.include? f[:fact].to_s
216
+ end
195
217
  end
196
218
  end
197
219
  end
data/lib/sources.rb CHANGED
@@ -22,11 +22,16 @@ module SelfSDK
22
22
  FACT_CATEGORIES = "categories"
23
23
  FACT_SORT_CODE = "sort_code"
24
24
  FACT_COUNTRY_OF_ISSUANCE = "country_of_issuance"
25
+ FACT_ACCOUNT_ID = "account_id"
26
+ FACT_NICKNAME = "nickname"
25
27
 
26
28
  SOURCE_USER_SPECIFIED = "user_specified"
27
29
  SOURCE_PASSPORT = "passport"
28
30
  SOURCE_DRIVING_LICENSE = "driving_license"
29
31
  SOURCE_IDENTITY_CARD = "identity_card"
32
+ SOURCE_TWITTER = "twitter"
33
+ SOURCE_LINKEDIN = "linkedin"
34
+ SOURCE_FACEBOOK = "facebook"
30
35
 
31
36
  class << self
32
37
  def message_type(s)
@@ -75,7 +80,9 @@ module SelfSDK
75
80
  valid_to: FACT_VALID_TO,
76
81
  categories: FACT_CATEGORIES,
77
82
  sort_code: FACT_SORT_CODE,
78
- country_of_issuance: FACT_COUNTRY_OF_ISSUANCE }
83
+ country_of_issuance: FACT_COUNTRY_OF_ISSUANCE,
84
+ account_id: FACT_ACCOUNT_ID,
85
+ nickname: FACT_NICKNAME }
79
86
  get(facts, input, "fact")
80
87
  end
81
88
 
@@ -83,7 +90,10 @@ module SelfSDK
83
90
  sources = { user_specified: SOURCE_USER_SPECIFIED,
84
91
  passport: SOURCE_PASSPORT,
85
92
  driving_license: SOURCE_DRIVING_LICENSE,
86
- identity_card: SOURCE_IDENTITY_CARD }
93
+ identity_card: SOURCE_IDENTITY_CARD,
94
+ twitter: SOURCE_TWITTER,
95
+ linkedin: SOURCE_LINKEDIN,
96
+ facebook: SOURCE_FACEBOOK }
87
97
  get(sources, input, "source")
88
98
  end
89
99
 
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.186
4
+ version: 0.0.189
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldgate Ventures
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: google-protobuf
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '3.19'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '3.19'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: httparty
113
113
  requirement: !ruby/object:Gem::Requirement