selfsdk 0.0.129 → 0.0.134
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acl.rb +1 -5
- data/lib/jwt_service.rb +3 -1
- data/lib/messages/base.rb +2 -2
- data/lib/services/auth.rb +5 -7
- data/lib/services/facts.rb +3 -3
- data/lib/signature_graph.rb +17 -17
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4fffd35f233da5c8c03dcb72ba1c42e5ca52bfad7d33c294d7c51eefb1b4f98
|
4
|
+
data.tar.gz: 829d219abcf1914726e049374a131698a9b3e20e538b93a29979c20619746580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 782029e58a85a7e86b92232542819159a761f816fc6f46cde8e84d8bb460ac58f55f092d830679f1af5ed855a22fbb60c1f33cba3af62bc3ce28539b0b5c59b8
|
7
|
+
data.tar.gz: b0ae4896efaf530ae5f121da799ae5a4f7d761222faa5555b58878fadd58abd8d8c3cd7a446dfcabbc9a3d4bd6b6589cd4af497f83e8d05aaaf8dea3a5d33cf3
|
data/lib/acl.rb
CHANGED
@@ -14,11 +14,7 @@ module SelfSDK
|
|
14
14
|
# Lists allowed connections.
|
15
15
|
def list
|
16
16
|
SelfSDK.logger.info "Listing allowed connections"
|
17
|
-
|
18
|
-
@messaging.list_acl_rules.each do |c|
|
19
|
-
rules[c['acl_source']] = DateTime.parse(c['acl_exp'])
|
20
|
-
end
|
21
|
-
rules
|
17
|
+
@messaging.list_acl_rules
|
22
18
|
end
|
23
19
|
|
24
20
|
# Allows incomming messages from the given identity.
|
data/lib/jwt_service.rb
CHANGED
data/lib/messages/base.rb
CHANGED
@@ -78,9 +78,9 @@ module SelfSDK
|
|
78
78
|
payload
|
79
79
|
end
|
80
80
|
|
81
|
-
def verify!(
|
81
|
+
def verify!(input, kid)
|
82
82
|
k = @client.public_key(@from, kid).raw_public_key
|
83
|
-
return if @jwt.verify(
|
83
|
+
return if @jwt.verify(input, k)
|
84
84
|
|
85
85
|
SelfSDK.logger.info "skipping message, invalid signature"
|
86
86
|
raise ::StandardError.new("invalid signature on incoming message")
|
data/lib/services/auth.rb
CHANGED
@@ -82,11 +82,11 @@ module SelfSDK
|
|
82
82
|
body = @client.jwt.encode(request(selfid, opts))
|
83
83
|
|
84
84
|
if @client.env.empty?
|
85
|
-
return "https://
|
85
|
+
return "https://joinself.page.link/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app"
|
86
86
|
elsif @client.env == 'development'
|
87
|
-
return "https://
|
87
|
+
return "https://joinself.page.link/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.dev"
|
88
88
|
end
|
89
|
-
"https://
|
89
|
+
"https://joinself.page.link/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.#{@client.env}"
|
90
90
|
end
|
91
91
|
|
92
92
|
# Adds an observer for an authentication response
|
@@ -115,6 +115,7 @@ module SelfSDK
|
|
115
115
|
def valid_payload(response)
|
116
116
|
parse_payload(response)
|
117
117
|
rescue StandardError => e
|
118
|
+
SelfSDK.logger.error e
|
118
119
|
uuid = ""
|
119
120
|
uuid = response[:cid] unless response.nil?
|
120
121
|
SelfSDK.logger.error "error checking authentication for #{uuid} : #{e.message}"
|
@@ -153,10 +154,7 @@ module SelfSDK
|
|
153
154
|
identity = @client.entity(payload[:sub])
|
154
155
|
return if identity.nil?
|
155
156
|
|
156
|
-
|
157
|
-
return payload if @client.jwt.verify(jws, key[:key])
|
158
|
-
end
|
159
|
-
nil
|
157
|
+
return payload
|
160
158
|
end
|
161
159
|
end
|
162
160
|
end
|
data/lib/services/facts.rb
CHANGED
@@ -108,11 +108,11 @@ module SelfSDK
|
|
108
108
|
body = @client.jwt.encode(request(selfid, facts, opts))
|
109
109
|
|
110
110
|
if @client.env.empty?
|
111
|
-
return "https://
|
111
|
+
return "https://joinself.page.link/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app"
|
112
112
|
elsif @client.env == 'development'
|
113
|
-
return "https://
|
113
|
+
return "https://joinself.page.link/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.dev"
|
114
114
|
end
|
115
|
-
"https://
|
115
|
+
"https://joinself.page.link/?link=#{callback}%3Fqr=#{body}&apn=com.joinself.app.#{@client.env}"
|
116
116
|
end
|
117
117
|
|
118
118
|
private
|
data/lib/signature_graph.rb
CHANGED
@@ -9,7 +9,7 @@ module SelfSDK
|
|
9
9
|
ACTION_REVOKE = "key.revoke"
|
10
10
|
KEY_TYPE_DEVICE = "device.key"
|
11
11
|
KEY_TYPE_RECOVERY = "recovery.key"
|
12
|
-
|
12
|
+
|
13
13
|
class Operation
|
14
14
|
|
15
15
|
attr_reader :sequence, :previous, :timestamp, :actions, :signing_key, :jws
|
@@ -46,7 +46,7 @@ module SelfSDK
|
|
46
46
|
def revokes(kid)
|
47
47
|
@actions.each do |action|
|
48
48
|
if action[:kid] == kid && action[:action] == ACTION_REVOKE
|
49
|
-
return true
|
49
|
+
return true
|
50
50
|
end
|
51
51
|
end
|
52
52
|
return false
|
@@ -64,8 +64,8 @@ module SelfSDK
|
|
64
64
|
@created = action[:from]
|
65
65
|
@revoked = 0
|
66
66
|
|
67
|
-
@raw_public_key =
|
68
|
-
@public_key = Ed25519::VerifyKey.new(@raw_public_key)
|
67
|
+
@raw_public_key = action[:key]
|
68
|
+
@public_key = Ed25519::VerifyKey.new(Base64.urlsafe_decode64(@raw_public_key))
|
69
69
|
|
70
70
|
@incoming = Array.new
|
71
71
|
@outgoing = Array.new
|
@@ -104,7 +104,7 @@ module SelfSDK
|
|
104
104
|
@recovery_key = nil
|
105
105
|
|
106
106
|
history.each do |operation|
|
107
|
-
execute(operation)
|
107
|
+
execute(operation)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -124,10 +124,10 @@ module SelfSDK
|
|
124
124
|
op = Operation.new(operation)
|
125
125
|
|
126
126
|
raise "operation sequence is out of order" if op.sequence != @operations.length
|
127
|
-
|
128
|
-
if op.sequence > 0
|
127
|
+
|
128
|
+
if op.sequence > 0
|
129
129
|
if @signatures[op.previous] != op.sequence - 1
|
130
|
-
raise "operation previous signature does not match"
|
130
|
+
raise "operation previous signature does not match"
|
131
131
|
end
|
132
132
|
|
133
133
|
if @operations[op.sequence - 1].timestamp >= op.timestamp
|
@@ -135,7 +135,7 @@ module SelfSDK
|
|
135
135
|
end
|
136
136
|
|
137
137
|
sk = @keys[op.signing_key]
|
138
|
-
|
138
|
+
|
139
139
|
raise "operation specifies a signing key that does not exist" if sk.nil?
|
140
140
|
|
141
141
|
if sk.revoked? && op.timestamp > sk.revoked
|
@@ -144,7 +144,7 @@ module SelfSDK
|
|
144
144
|
|
145
145
|
if sk.type == KEY_TYPE_RECOVERY && op.revokes(op.signing_key) != true
|
146
146
|
raise "account recovery operation does not revoke the current active recovery key"
|
147
|
-
end
|
147
|
+
end
|
148
148
|
end
|
149
149
|
|
150
150
|
execute_actions(op)
|
@@ -154,7 +154,7 @@ module SelfSDK
|
|
154
154
|
raise "operation specifies a signing key that does not exist" if sk.nil?
|
155
155
|
|
156
156
|
if op.timestamp < sk.created || sk.revoked? && op.timestamp > sk.revoked
|
157
|
-
raise "operation was signed with a key that was revoked"
|
157
|
+
raise "operation was signed with a key that was revoked"
|
158
158
|
end
|
159
159
|
|
160
160
|
sig = Base64.urlsafe_decode64(op.jws[:signature])
|
@@ -198,9 +198,9 @@ module SelfSDK
|
|
198
198
|
end
|
199
199
|
|
200
200
|
if action[:from] < 0
|
201
|
-
raise "operation action does not provide a valid timestamp for the action to take effect from"
|
201
|
+
raise "operation action does not provide a valid timestamp for the action to take effect from"
|
202
202
|
end
|
203
|
-
|
203
|
+
|
204
204
|
case action[:action]
|
205
205
|
when ACTION_ADD
|
206
206
|
action[:from] = op.timestamp
|
@@ -213,7 +213,7 @@ module SelfSDK
|
|
213
213
|
|
214
214
|
def add(operation, action)
|
215
215
|
if @keys[action[:kid]].nil? != true
|
216
|
-
raise "operation contains a key with a duplicate identifier"
|
216
|
+
raise "operation contains a key with a duplicate identifier"
|
217
217
|
end
|
218
218
|
|
219
219
|
k = Key.new(action)
|
@@ -226,7 +226,7 @@ module SelfSDK
|
|
226
226
|
end
|
227
227
|
when KEY_TYPE_RECOVERY
|
228
228
|
unless @recovery_key.nil?
|
229
|
-
raise "operation contains more than one active recovery key" unless @recovery_key.revoked?
|
229
|
+
raise "operation contains more than one active recovery key" unless @recovery_key.revoked?
|
230
230
|
end
|
231
231
|
|
232
232
|
@recovery_key = k
|
@@ -239,7 +239,7 @@ module SelfSDK
|
|
239
239
|
@root = k
|
240
240
|
return
|
241
241
|
end
|
242
|
-
|
242
|
+
|
243
243
|
parent = @keys[operation.signing_key]
|
244
244
|
|
245
245
|
raise "operation specifies a signing key that does not exist" if parent.nil?
|
@@ -271,7 +271,7 @@ module SelfSDK
|
|
271
271
|
|
272
272
|
return
|
273
273
|
end
|
274
|
-
|
274
|
+
|
275
275
|
k.child_keys.each do |ck|
|
276
276
|
ck.revoke(action[:from]) unless ck.created < action[:from]
|
277
277
|
end
|
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.
|
4
|
+
version: 0.0.134
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aldgate Ventures
|
@@ -328,7 +328,8 @@ files:
|
|
328
328
|
- lib/signature_graph.rb
|
329
329
|
- lib/sources.rb
|
330
330
|
homepage: https://www.joinself.com/
|
331
|
-
licenses:
|
331
|
+
licenses:
|
332
|
+
- MIT
|
332
333
|
metadata: {}
|
333
334
|
post_install_message:
|
334
335
|
rdoc_options: []
|