selfsdk 0.0.135 → 0.0.136

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6874c12ba149144c253e6ad15005ee7f9c4b009c26dcd0add8b36048e5201e51
4
- data.tar.gz: 6c4021e2009ec63cfe6070f59d660f9d49bd86fcaafa9d3480cce743b9917dec
3
+ metadata.gz: 80d405628b95421e76e1461dcff31f3351109cd009c7b0b677ce29d27ecf133d
4
+ data.tar.gz: 20235912eef39c3a084dd7afeab7cbb9d050d1649d02a45acdcf1a4403519e7f
5
5
  SHA512:
6
- metadata.gz: 973e78bfd9b9c515cbd0ea71ee8a533c067bd9ac8b518fadf0c960abbee47031ccf75a2a83a935184ec2bf2d6351664a0e49450f22445cc4a0fce12b4b6cbe14
7
- data.tar.gz: e83af77e1516bb4fa5e6c77b0ffa731ae042491611a1eb626173cdb3ac6b7a90df5f6b5e5d76008c91fa9f6a08a0e4c61b44dd35dca9a5ff857c392831eb8771
6
+ metadata.gz: 734d43a91a7485370a5aa3a16fc56f2d097fc510aef007b25ad63645cf255629f286213371f787e7d2bd1e07d22ab7640a55b50b55518927a34c70dd72227d93
7
+ data.tar.gz: 9c7484084c68f95078154b2d21884c9a333a7388213fa0782ac6de7b236bedc5c5a6683fb9e62ed1e52c6c31bd63dc46cff159f977aac51886161dfbc5bec169
@@ -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(@messaging_client, @client)
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(@messaging_client, @client)
69
+ @authentication ||= SelfSDK::Services::Authentication.new(messaging, @client)
70
70
  end
71
71
 
72
72
  # Provides access to SelfSDK::Services::Identity service
@@ -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)
@@ -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)
@@ -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
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.135
4
+ version: 0.0.136
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldgate Ventures