selfsdk 0.0.186 → 0.0.187
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crypto.rb +10 -5
- data/lib/messages/attestation.rb +1 -1
- data/lib/services/facts.rb +24 -2
- data/lib/sources.rb +12 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2efe13e1c9449fe24bbfbe5754377fe0ef1dc3bd8a5815b6ccc77f854ab8339
|
4
|
+
data.tar.gz: 07c371286f2aa7fd97ac2a4423daeb2ac3b767be2bb54c0233a7d5db8d1bde91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0748ed14d36949e1a96b8299d325189ea0a8f554e2b31d95d0831763051c74f0440f6f319e1808372bc1f09a43c3da7035bf1554843df9adda6d1eecaa51eae6'
|
7
|
+
data.tar.gz: 73f72a6b7357359af3d07bb5067b718147a32395fdee1a24fca29a82adeaafe7956483860ab7e8b74864d9e2dbb4fef11e9193651dd79c41e56f1a21f9c65984
|
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
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
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
|
|
data/lib/messages/attestation.rb
CHANGED
data/lib/services/facts.rb
CHANGED
@@ -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,
|
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
|
|