selfsdk 0.0.205 → 0.0.207
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 +4 -4
- data/lib/chat/file_object.rb +3 -1
- data/lib/jwt_service.rb +15 -0
- data/lib/selfsdk.rb +1 -0
- data/lib/services/auth.rb +1 -1
- data/lib/services/chat.rb +1 -7
- data/lib/services/facts.rb +1 -1
- data/lib/services/requester.rb +3 -8
- 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: 565f3e3071fcb9d7f8686480e0890af54c1b6ee55996453e24028f3c2050803e
|
4
|
+
data.tar.gz: 16ed62893ffd1f8ef278e8626f4fc26279fa71b77e40c2d7135f0f39ed9e660a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58019c1d8e3c7ccb93b0dbdc9a577a662465628708baddbf26cf5f065c98094e187bb8b20b781d9715b51169b8e330f9d602e97b4d54cda45c7d8e57671b1de4
|
7
|
+
data.tar.gz: 644041c1d742e1a5886a981c744c31ac324ce1ddecdef842157babd82a796df8f1d921e6fe2a5379f4ef83267a245c6b59bb88321e8989668531f7b78ff7913c
|
data/lib/chat/file_object.rb
CHANGED
@@ -36,12 +36,14 @@ module SelfSDK
|
|
36
36
|
def build_from_object(input)
|
37
37
|
# Download from CDN
|
38
38
|
ciphertext = ""
|
39
|
+
link = input[:link]
|
39
40
|
5.times do
|
40
41
|
begin
|
41
|
-
ciphertext = URI.open(
|
42
|
+
ciphertext = URI.open(link, "Authorization" => "Bearer #{@token}").read
|
42
43
|
break
|
43
44
|
rescue => e
|
44
45
|
SelfSDK.logger.info "error fetching #{input[:link]} : #{e.message}"
|
46
|
+
link = link.replace("localhost:8080", "api:8080")
|
45
47
|
sleep 1
|
46
48
|
end
|
47
49
|
end
|
data/lib/jwt_service.rb
CHANGED
@@ -93,6 +93,21 @@ module SelfSDK
|
|
93
93
|
"#{payload}.#{signature}"
|
94
94
|
end
|
95
95
|
|
96
|
+
def build_dynamic_link(body, env, callback)
|
97
|
+
base_url = "https://#{env}.links.joinself.com"
|
98
|
+
portal_url = "https://developer.#{env}.joinself.com"
|
99
|
+
apn = "com.joinself.app.#{env}"
|
100
|
+
|
101
|
+
if env.empty? || env == 'development'
|
102
|
+
base_url = "https://links.joinself.com"
|
103
|
+
portal_url = "https://developer.joinself.com"
|
104
|
+
apn = "com.joinself.app"
|
105
|
+
end
|
106
|
+
apn = "com.joinself.app.dev" if env == 'development'
|
107
|
+
|
108
|
+
"#{base_url}?link=#{portal_url}/callback/#{callback}%3Fqr=#{body}&apn=#{apn}"
|
109
|
+
end
|
110
|
+
|
96
111
|
private
|
97
112
|
|
98
113
|
def header
|
data/lib/selfsdk.rb
CHANGED
data/lib/services/auth.rb
CHANGED
@@ -69,7 +69,7 @@ module SelfSDK
|
|
69
69
|
|
70
70
|
# Generates a deep link to authenticate with self app.
|
71
71
|
#
|
72
|
-
# @param callback [String] the
|
72
|
+
# @param callback [String] the callback identifier you'll be redirected to if the app is not installed.
|
73
73
|
# @option opts [String] :selfid the user selfid you want to authenticate.
|
74
74
|
# @option opts [String] :cid The unique identifier of the authentication request.
|
75
75
|
#
|
data/lib/services/chat.rb
CHANGED
@@ -184,13 +184,7 @@ module SelfSDK
|
|
184
184
|
body = @jwt.encode(body)
|
185
185
|
|
186
186
|
env = @messaging.client.client.env
|
187
|
-
|
188
|
-
return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app"
|
189
|
-
elsif env == 'development'
|
190
|
-
return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.dev"
|
191
|
-
end
|
192
|
-
|
193
|
-
"https://#{env}.links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.#{env}"
|
187
|
+
@jwt.build_dynamic_link(body, env, callback)
|
194
188
|
end
|
195
189
|
|
196
190
|
# Subscribes to a connection response
|
data/lib/services/facts.rb
CHANGED
@@ -84,7 +84,7 @@ module SelfSDK
|
|
84
84
|
# Generates a deep link to authenticate with self app.
|
85
85
|
#
|
86
86
|
# @param facts [Array] a list of facts to be requested.
|
87
|
-
# @param callback [String] the
|
87
|
+
# @param callback [String] the callback identifier you'll be redirected to if the app is not installed.
|
88
88
|
# @option opts [String] :selfid the user selfid you want to authenticate.
|
89
89
|
# @option opts [String] :cid The unique identifier of the authentication request.
|
90
90
|
#
|
data/lib/services/requester.rb
CHANGED
@@ -124,7 +124,7 @@ module SelfSDK
|
|
124
124
|
# Generates a deep link to authenticate with self app.
|
125
125
|
#
|
126
126
|
# @param facts [Array] a list of facts to be requested.
|
127
|
-
# @param callback [String] the
|
127
|
+
# @param callback [String] the callback identifier you'll be redirected to if the app is not installed.
|
128
128
|
# @option opts [String] :selfid the user selfid you want to authenticate.
|
129
129
|
# @option opts [String] :cid The unique identifier of the authentication request.
|
130
130
|
#
|
@@ -132,14 +132,9 @@ module SelfSDK
|
|
132
132
|
def generate_deep_link(facts, callback, opts = {})
|
133
133
|
opts[:request] = false
|
134
134
|
selfid = opts.fetch(:selfid, "-")
|
135
|
-
body = @client.jwt.encode(request(selfid, facts, opts))
|
136
135
|
|
137
|
-
|
138
|
-
|
139
|
-
elsif @client.env == 'development'
|
140
|
-
return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.dev"
|
141
|
-
end
|
142
|
-
"https://#{@client.env}.links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.#{@client.env}"
|
136
|
+
body = @client.jwt.encode(request(selfid, facts, opts))
|
137
|
+
@client.jwt.build_dynamic_link(body, @client.env, callback)
|
143
138
|
end
|
144
139
|
|
145
140
|
private
|