selfsdk 0.0.185 → 0.0.186
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/messages/fact_request.rb +2 -0
- data/lib/messages/fact_response.rb +5 -3
- data/lib/services/auth.rb +3 -3
- data/lib/services/facts.rb +4 -3
- 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: 537d89a4c6f35651b5c5935b12861a3b76966a34858fc8c0cce2e6a0c079a574
|
4
|
+
data.tar.gz: a1e8991eff4ccaf30dd7ee633a17009f43e68e383b28cedb29cd61977135b575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2c2a074476b655870575194c68781a905b5a6186823c732c70a612d61baa530f2e10cc501b80013571119befcc9d0decd18dc55c15e999751eb908d7576e9d8
|
7
|
+
data.tar.gz: 7587e69db01c25ccaa558da3ef9f70d9a668c16d6b93c12b178f86ca8956f5a90b966e8107b9157a7211e6a2cb78ef801644792c1886ee0ea129c8d22363c5cc
|
@@ -35,6 +35,7 @@ module SelfSDK
|
|
35
35
|
@description = opts.include?(:description) ? opts[:description] : nil
|
36
36
|
@exp_timeout = opts.fetch(:exp_timeout, DEFAULT_EXP_TIMEOUT)
|
37
37
|
@allowed_for = opts.fetch(:allowed_for, nil)
|
38
|
+
@auth = opts.fetch(:auth, false)
|
38
39
|
|
39
40
|
@intermediary = if opts.include?(:intermediary)
|
40
41
|
opts[:intermediary]
|
@@ -91,6 +92,7 @@ module SelfSDK
|
|
91
92
|
b[:options] = @options unless (@options.nil? || @options == false)
|
92
93
|
b[:description] = @description unless (@description.nil? || @description.empty?)
|
93
94
|
b[:allowed_until] = (SelfSDK::Time.now + @allowed_for).strftime('%FT%TZ') unless @allowed_for.nil?
|
95
|
+
b[:auth] = @auth unless @auth.nil?
|
94
96
|
b
|
95
97
|
end
|
96
98
|
|
@@ -11,7 +11,7 @@ module SelfSDK
|
|
11
11
|
class FactResponse < Base
|
12
12
|
MSG_TYPE = "identities.facts.query.resp"
|
13
13
|
|
14
|
-
attr_accessor :facts, :audience
|
14
|
+
attr_accessor :facts, :audience, :auth
|
15
15
|
|
16
16
|
def parse(input, envelope=nil)
|
17
17
|
@input = input
|
@@ -24,6 +24,7 @@ module SelfSDK
|
|
24
24
|
@issued = ::Time.parse(payload[:iat])
|
25
25
|
@audience = payload[:aud]
|
26
26
|
@status = payload[:status]
|
27
|
+
@auth = payload[:auth]
|
27
28
|
@facts = []
|
28
29
|
payload[:facts] = [] if payload[:facts].nil?
|
29
30
|
payload[:facts].each do |f|
|
@@ -69,7 +70,7 @@ module SelfSDK
|
|
69
70
|
@facts.each do |fact|
|
70
71
|
encoded_facts.push(fact.to_hash)
|
71
72
|
end
|
72
|
-
|
73
|
+
|
73
74
|
{ typ: MSG_TYPE,
|
74
75
|
iss: @jwt.id,
|
75
76
|
sub: @sub || @to,
|
@@ -79,7 +80,8 @@ module SelfSDK
|
|
79
80
|
cid: @id,
|
80
81
|
jti: SecureRandom.uuid,
|
81
82
|
status: @status,
|
82
|
-
facts: encoded_facts
|
83
|
+
facts: encoded_facts,
|
84
|
+
auth: @auth }
|
83
85
|
end
|
84
86
|
|
85
87
|
protected
|
data/lib/services/auth.rb
CHANGED
@@ -89,11 +89,11 @@ module SelfSDK
|
|
89
89
|
body = @client.jwt.encode(request(selfid, opts))
|
90
90
|
|
91
91
|
if @client.env.empty?
|
92
|
-
return "https://joinself.
|
92
|
+
return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app"
|
93
93
|
elsif @client.env == 'development'
|
94
|
-
return "https://joinself.
|
94
|
+
return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.dev"
|
95
95
|
end
|
96
|
-
"https
|
96
|
+
"https://#{@client.env}.links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.#{@client.env}"
|
97
97
|
end
|
98
98
|
|
99
99
|
# Adds an observer for an authentication response
|
data/lib/services/facts.rb
CHANGED
@@ -41,6 +41,7 @@ module SelfSDK
|
|
41
41
|
# @option opts [String] :cid The unique identifier of the authentication request.
|
42
42
|
# @option opts [Integer] :exp_timeout timeout in seconds to expire the request.
|
43
43
|
# @option opts [Integer] :allowed_for number of seconds for enabling recurrent requests.
|
44
|
+
# @option opts [Boolean] :auth allows displaying the request as anuthentication request with facts.
|
44
45
|
# @return [Object] SelfSDK:::Messages::FactRequest
|
45
46
|
def request(selfid, facts, opts = {}, &block)
|
46
47
|
SelfSDK.logger.info "authenticating #{selfid}"
|
@@ -116,11 +117,11 @@ module SelfSDK
|
|
116
117
|
body = @client.jwt.encode(request(selfid, facts, opts))
|
117
118
|
|
118
119
|
if @client.env.empty?
|
119
|
-
return "https://joinself.
|
120
|
+
return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app"
|
120
121
|
elsif @client.env == 'development'
|
121
|
-
return "https://joinself.
|
122
|
+
return "https://links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.dev"
|
122
123
|
end
|
123
|
-
"https
|
124
|
+
"https://#{@client.env}.links.joinself.com/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.#{@client.env}"
|
124
125
|
end
|
125
126
|
|
126
127
|
private
|