selfsdk 0.0.135 → 0.0.136
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/selfsdk.rb +2 -2
- data/lib/services/auth.rb +3 -1
- data/lib/services/facts.rb +3 -1
- data/lib/services/messaging.rb +9 -0
- 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: 80d405628b95421e76e1461dcff31f3351109cd009c7b0b677ce29d27ecf133d
|
4
|
+
data.tar.gz: 20235912eef39c3a084dd7afeab7cbb9d050d1649d02a45acdcf1a4403519e7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 734d43a91a7485370a5aa3a16fc56f2d097fc510aef007b25ad63645cf255629f286213371f787e7d2bd1e07d22ab7640a55b50b55518927a34c70dd72227d93
|
7
|
+
data.tar.gz: 9c7484084c68f95078154b2d21884c9a333a7388213fa0782ac6de7b236bedc5c5a6683fb9e62ed1e52c6c31bd63dc46cff159f977aac51886161dfbc5bec169
|
data/lib/selfsdk.rb
CHANGED
@@ -61,12 +61,12 @@ module SelfSDK
|
|
61
61
|
|
62
62
|
# Provides access to SelfSDK::Services::Facts service
|
63
63
|
def facts
|
64
|
-
@facts ||= SelfSDK::Services::Facts.new(
|
64
|
+
@facts ||= SelfSDK::Services::Facts.new(messaging, @client)
|
65
65
|
end
|
66
66
|
|
67
67
|
# Provides access to SelfSDK::Services::Authentication service
|
68
68
|
def authentication
|
69
|
-
@authentication ||= SelfSDK::Services::Authentication.new(
|
69
|
+
@authentication ||= SelfSDK::Services::Authentication.new(messaging, @client)
|
70
70
|
end
|
71
71
|
|
72
72
|
# Provides access to SelfSDK::Services::Identity service
|
data/lib/services/auth.rb
CHANGED
@@ -15,7 +15,8 @@ module SelfSDK
|
|
15
15
|
#
|
16
16
|
# @return [SelfSDK::Services::Authentication] authentication service.
|
17
17
|
def initialize(messaging, client)
|
18
|
-
@messaging = messaging
|
18
|
+
@messaging = messaging.client
|
19
|
+
@messaging_service = messaging
|
19
20
|
@client = client
|
20
21
|
end
|
21
22
|
|
@@ -38,6 +39,7 @@ module SelfSDK
|
|
38
39
|
# @return [String, String] conversation id or encoded body.
|
39
40
|
def request(selfid, opts = {}, &block)
|
40
41
|
SelfSDK.logger.info "authenticating #{selfid}"
|
42
|
+
raise "You're not permitting connections from #{selfid}" unless @messaging_service.is_permitted?(selfid)
|
41
43
|
|
42
44
|
req = SelfSDK::Messages::AuthenticationReq.new(@messaging)
|
43
45
|
req.populate(selfid, opts)
|
data/lib/services/facts.rb
CHANGED
@@ -17,7 +17,8 @@ module SelfSDK
|
|
17
17
|
#
|
18
18
|
# @return [SelfSDK::Services::Facts] facts service.
|
19
19
|
def initialize(messaging, client)
|
20
|
-
@messaging = messaging
|
20
|
+
@messaging = messaging.client
|
21
|
+
@messaging_service = messaging
|
21
22
|
@client = client
|
22
23
|
end
|
23
24
|
|
@@ -40,6 +41,7 @@ module SelfSDK
|
|
40
41
|
# @return [Object] SelfSDK:::Messages::FactRequest
|
41
42
|
def request(selfid, facts, opts = {}, &block)
|
42
43
|
SelfSDK.logger.info "authenticating #{selfid}"
|
44
|
+
raise "You're not permitting connections from #{selfid}" unless @messaging_service.is_permitted?(selfid)
|
43
45
|
|
44
46
|
req = SelfSDK::Messages::FactRequest.new(@messaging)
|
45
47
|
req.populate(selfid, prepare_facts(facts), opts)
|
data/lib/services/messaging.rb
CHANGED
@@ -44,6 +44,15 @@ module SelfSDK
|
|
44
44
|
acl.list
|
45
45
|
end
|
46
46
|
|
47
|
+
# Checks if you're permitting messages from a specific self identifier
|
48
|
+
# @return [Boolean] yes|no
|
49
|
+
def is_permitted?(id)
|
50
|
+
conns = allowed_connections
|
51
|
+
return true if conns.include? "*"
|
52
|
+
return true if conns.include? id
|
53
|
+
return false
|
54
|
+
end
|
55
|
+
|
47
56
|
# Revokes incoming messages from the given identity.
|
48
57
|
#
|
49
58
|
# @param [String] selfid to be denied
|