waylon-core 0.1.4 → 0.1.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb29b523a0f093d01b8a9abdf5cd23d54b2815ae0430b81f8e670680959d02f6
4
- data.tar.gz: 4c79ff418934e61e9063db9568d2397409117afd2a7519d9b4c9348233991667
3
+ metadata.gz: 4d396f88fe34083537cabbe245d1063ecd1b8c0d15e5391c80eb0a9f4902aa39
4
+ data.tar.gz: bc7d2a6b5da80e36508032d3bcfaa59f91395d016e0fb69e65a24c56366f26e3
5
5
  SHA512:
6
- metadata.gz: 505ad2082ae04e37478e03637b13952d81d8c26c9e8107eeded3b4247ae25f776f7d1d7d4a4fd0739edd670ba74256e33adbd22c6f46957f528c820ef371bfce
7
- data.tar.gz: a9c1b1de874c75d7d909a83904e46360236334f652dae8ad059d5adf8b405315030245420dba3a8e159b21d99d221a502d30cfe439f2b2b77411ff06261af695
6
+ metadata.gz: 229980e2a8c719c57baa00a26d137a10c6677fe1081adfc3aa73f4bfd13c83ee74c1f8b10933ba43688a9d40fa8e0c71c264cbbe7dec40ec202192ade05e4b1c
7
+ data.tar.gz: 82814e648a191b886619f8e15bf6b934b8c1cbc6112d77f39a1bbcf96f0b5def15267260609a45b46c3c8252a98d569e454c07f754c4baa39b1ee0aba8923c92
data/Gemfile.lock CHANGED
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waylon-core (0.1.4)
4
+ waylon-core (0.1.8)
5
5
  addressable (~> 2.8)
6
6
  faraday (~> 1.8)
7
7
  i18n (~> 1.8)
8
8
  json (~> 2.6)
9
9
  moneta (~> 1.4)
10
10
  puma (~> 5.5)
11
+ rbnacl (~> 7.1)
11
12
  resque (~> 2.2)
12
13
 
13
14
  GEM
@@ -35,20 +36,21 @@ GEM
35
36
  faraday-em_synchrony (1.0.0)
36
37
  faraday-excon (1.1.0)
37
38
  faraday-httpclient (1.0.1)
38
- faraday-multipart (1.0.3)
39
- multipart-post (>= 1.2, < 3)
39
+ faraday-multipart (1.0.4)
40
+ multipart-post (~> 2)
40
41
  faraday-net_http (1.0.1)
41
42
  faraday-net_http_persistent (1.2.0)
42
43
  faraday-patron (1.0.0)
43
44
  faraday-rack (1.0.0)
44
45
  faraday-retry (1.0.3)
46
+ ffi (1.15.5)
45
47
  i18n (1.10.0)
46
48
  concurrent-ruby (~> 1.0)
47
49
  json (2.6.2)
48
50
  moneta (1.5.1)
49
51
  mono_logger (1.1.1)
50
52
  multi_json (1.15.0)
51
- multipart-post (2.1.1)
53
+ multipart-post (2.2.0)
52
54
  mustermann (1.1.1)
53
55
  ruby2_keywords (~> 0.0.1)
54
56
  nio4r (2.5.8)
@@ -58,15 +60,17 @@ GEM
58
60
  public_suffix (4.0.7)
59
61
  puma (5.6.4)
60
62
  nio4r (~> 2.0)
61
- rack (2.2.3)
63
+ rack (2.2.3.1)
62
64
  rack-protection (2.2.0)
63
65
  rack
64
66
  rainbow (3.1.1)
65
67
  rake (13.0.6)
68
+ rbnacl (7.1.1)
69
+ ffi
66
70
  redis (4.6.0)
67
71
  redis-namespace (1.8.2)
68
72
  redis (>= 3.0.4)
69
- regexp_parser (2.4.0)
73
+ regexp_parser (2.5.0)
70
74
  resque (2.2.1)
71
75
  mono_logger (~> 1.0)
72
76
  multi_json (~> 1.0)
@@ -86,13 +90,13 @@ GEM
86
90
  diff-lcs (>= 1.2.0, < 2.0)
87
91
  rspec-support (~> 3.11.0)
88
92
  rspec-support (3.11.0)
89
- rubocop (1.29.1)
93
+ rubocop (1.30.1)
90
94
  parallel (~> 1.10)
91
95
  parser (>= 3.1.0.0)
92
96
  rainbow (>= 2.2.2, < 4.0)
93
97
  regexp_parser (>= 1.8, < 3.0)
94
98
  rexml (>= 3.2.5, < 4.0)
95
- rubocop-ast (>= 1.17.0, < 2.0)
99
+ rubocop-ast (>= 1.18.0, < 2.0)
96
100
  ruby-progressbar (~> 1.7)
97
101
  unicode-display_width (>= 1.4.0, < 3.0)
98
102
  rubocop-ast (1.18.0)
@@ -117,7 +121,7 @@ GEM
117
121
  tilt (2.0.10)
118
122
  unicode-display_width (2.1.0)
119
123
  webrick (1.7.0)
120
- yard (0.9.27)
124
+ yard (0.9.28)
121
125
  webrick (~> 1.7.0)
122
126
 
123
127
  PLATFORMS
data/bin/console CHANGED
@@ -2,7 +2,12 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require "waylon"
5
+ require "waylon/core"
6
+ require "waylon/skills/default"
7
+ require "waylon/skills/diagnostics"
8
+ require "waylon/skills/fun"
9
+ require "waylon/skills/groups"
10
+ require "waylon/skills/help"
6
11
 
7
12
  # You can add fixtures and/or initialization code here to make experimenting
8
13
  # with your gem easier. You can also use a different console, if you like.
@@ -46,7 +46,7 @@ module Waylon
46
46
  @namespace || name.to_s.split("::").last.downcase
47
47
  end
48
48
 
49
- # Creates namespaced configuration keys for Webhook subclasses
49
+ # Creates namespaced configuration keys for BaseComponent subclasses
50
50
  # @param (see Config#add_schema)
51
51
  def config(key, default: nil, required: false, type: String)
52
52
  conf = Config.instance
@@ -127,7 +127,7 @@ module Waylon
127
127
  end
128
128
 
129
129
  # A wrapper for accessing the persistent storage
130
- # @return [Waylon::Storage] The Storage wrapper class
130
+ # @return [Waylon::Storage] The Storage wrapper module
131
131
  def storage
132
132
  Waylon::Storage
133
133
  end
data/lib/waylon/core.rb CHANGED
@@ -21,6 +21,7 @@ require "faraday"
21
21
  require "i18n"
22
22
  require "json"
23
23
  require "moneta"
24
+ require "rbnacl"
24
25
  require "resque"
25
26
  require "sinatra"
26
27
 
@@ -32,6 +33,7 @@ require "waylon/exceptions/not_implemented_error"
32
33
  require "waylon/exceptions/validation_error"
33
34
  require "waylon/group"
34
35
  require "waylon/logger"
36
+ require "waylon/storage"
35
37
  require "waylon/base_component"
36
38
  require "waylon/condition"
37
39
  require "waylon/message"
@@ -20,7 +20,7 @@ config = Waylon::Config.instance
20
20
  config.load_env
21
21
 
22
22
  Waylon::Cache = Moneta.new(:Cookie)
23
- Waylon::Storage = Moneta.new(:LRUHash)
23
+ p Waylon::Storage
24
24
  Waylon::Logger.log("Found Global Admins: #{config.admins}")
25
25
 
26
26
  Waylon::RSpec::TestUser.find_or_create(
data/lib/waylon/rspec.rb CHANGED
@@ -47,4 +47,4 @@ module Waylon
47
47
  end
48
48
 
49
49
  Waylon::Cache = Moneta.new(:Cookie)
50
- Waylon::Storage = Moneta.new(:Cookie)
50
+ Waylon::Storage::Store = Moneta.new(:Cookie)
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Waylon
4
+ # Used for working with the Moneta store
5
+ module Storage
6
+ Store = Moneta.new(
7
+ :Redis,
8
+ url: "redis://#{ENV.fetch("REDIS", "localhost:6379")}/1"
9
+ )
10
+
11
+ def self.cipher
12
+ key_bytes = RbNaCl::Hash.sha256(ENV.fetch("ENCRYPTION_KEY", "thisisVeryUnsafe4U"))[0..31]
13
+ RbNaCl::SimpleBox.from_secret_key(key_bytes)
14
+ end
15
+
16
+ def self.clear
17
+ Store.clear
18
+ end
19
+
20
+ def self.key?(name)
21
+ Store.key?(name)
22
+ end
23
+
24
+ def self.load(key)
25
+ this_cipher = cipher
26
+ raw = Store.load(key)
27
+ return nil unless raw
28
+
29
+ decoded = Base64.decode64(raw)
30
+ plain = this_cipher.decrypt(decoded)
31
+ JSON.parse(plain)
32
+ end
33
+
34
+ def self.store(key, value)
35
+ this_cipher = cipher
36
+ encrypted = this_cipher.encrypt(value.to_json)
37
+ encoded = Base64.encode64(encrypted)
38
+ Store.store(key, encoded)
39
+ end
40
+ end
41
+ end
@@ -6,7 +6,7 @@ module Waylon
6
6
  VERSION = [
7
7
  0, # Major
8
8
  1, # Minor
9
- 4 # Patch
9
+ 8 # Patch
10
10
  ].join(".")
11
11
  end
12
12
  end
data/scripts/release.sh CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
+ apt-get update && apt-get install -y libsodium-dev
4
+
3
5
  gem install bundler -v '~> 2.3'
4
6
  bundle install
5
7
  rm -rf pkg/*.gem
data/scripts/test.sh CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
+ apt-get update && apt-get install -y libsodium-dev
4
+
3
5
  gem install bundler -v '~> 2.3'
4
6
  bundle install
5
7
  bundle exec rake
data/waylon-core.gemspec CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "json", "~> 2.6"
34
34
  spec.add_dependency "moneta", "~> 1.4"
35
35
  spec.add_dependency "puma", "~> 5.5"
36
+ spec.add_dependency "rbnacl", "~> 7.1"
36
37
  spec.add_dependency "resque", "~> 2.2"
37
38
 
38
39
  spec.add_development_dependency "bundler", "~> 2.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waylon-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-02 00:00:00.000000000 Z
11
+ date: 2022-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '5.5'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rbnacl
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '7.1'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '7.1'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: resque
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -246,7 +260,6 @@ files:
246
260
  - Rakefile
247
261
  - bin/console
248
262
  - bin/setup
249
- - lib/waylon.rb
250
263
  - lib/waylon/base_component.rb
251
264
  - lib/waylon/condition.rb
252
265
  - lib/waylon/conditions/black_hole.rb
@@ -284,6 +297,7 @@ files:
284
297
  - lib/waylon/skills/fun.rb
285
298
  - lib/waylon/skills/groups.rb
286
299
  - lib/waylon/skills/help.rb
300
+ - lib/waylon/storage.rb
287
301
  - lib/waylon/user.rb
288
302
  - lib/waylon/version.rb
289
303
  - lib/waylon/webhook.rb
data/lib/waylon.rb DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "waylon/core"
4
- require "waylon/skills/default"
5
- require "waylon/skills/diagnostics"
6
- require "waylon/skills/fun"
7
- require "waylon/skills/groups"
8
- require "waylon/skills/help"