bullion 0.3.3 → 0.4.1

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: eeb140b2f96dc4b7a1b90dd67def6ea51aa6cafe95d539802ff08d5051215944
4
- data.tar.gz: ebadc84892a2cd895d1d5c89491df517b2a5e71a59aa245211a0e603d43a3fb5
3
+ metadata.gz: da2051eea8f881ee3e56d351b6bee7494fb7de959eba77aae739328edffd5e0f
4
+ data.tar.gz: ad9035c201b16287f3ddc77819d5305d59fe35fda7f7c38ef5a10478ac399fd4
5
5
  SHA512:
6
- metadata.gz: 37844c15c8c40d311f1dd8bbc31661b8810af1af7641ff799509a27b9bf325780a7c8c15f307efc59de9065c9c430e674f198bd67b5a8cf54e0a2a096ac4cb4f
7
- data.tar.gz: 88bb5cb35c0cdf2c857538a631fa8ac681a70b56df56ec7d6bf6843597c778ddc07fa3cae54dc90a6585727b87a32bc76bad3942b850f2544b86feff03d1b91e
6
+ metadata.gz: 6ddacf95015d6d107ee32641dceb3eadde5239c74969ce1ce5d3853f3a65012c702054cb89d7926f3309635126e609dee49001a6da90755c400a81c483eb076d
7
+ data.tar.gz: 933fa8702de9730366cae2e62ab4c8087bcdb7e846efef4ef54be39a1e6b242c19f77dc947ffa7717a018ae9d123ca750e23aa81db8d60853842513a470d5e7a
data/.roxanne.yml CHANGED
@@ -5,10 +5,16 @@ stages:
5
5
  scripts:
6
6
  - ./scripts/build.sh
7
7
  test:
8
- image: ruby:3.1
8
+ image: ruby:3.2
9
9
  scripts:
10
10
  - ./scripts/test.sh
11
11
  release:
12
- image: ruby:3.1
12
+ image: ruby:3.2
13
+ only:
14
+ - main
15
+ publish:
16
+ image: docker:latest
17
+ scripts:
18
+ - ./scripts/publish.sh
13
19
  only:
14
20
  - main
data/.rubocop.yml CHANGED
@@ -1,3 +1,8 @@
1
+
2
+ require:
3
+ - rubocop-rake
4
+ - rubocop-rspec
5
+
1
6
  Layout/LineLength:
2
7
  Max: 100
3
8
 
@@ -22,7 +27,7 @@ Metrics/MethodLength:
22
27
  Max: 20
23
28
 
24
29
  Metrics/ModuleLength:
25
- Max: 160
30
+ Max: 165
26
31
  Exclude:
27
32
  - 'spec/**/*_spec.rb'
28
33
 
@@ -49,3 +54,29 @@ Style/StringLiteralsInInterpolation:
49
54
  Style/StringConcatenation:
50
55
  Exclude:
51
56
  - 'Rakefile'
57
+
58
+ RSpec/NamedSubject:
59
+ Enabled: false
60
+
61
+ RSpec/BeforeAfterAll:
62
+ Enabled: false
63
+
64
+ RSpec/FilePath:
65
+ Exclude:
66
+ - "spec/integration/**/*_spec.rb"
67
+
68
+ RSpec/InstanceVariable:
69
+ Enabled: false
70
+
71
+ RSpec/MultipleMemoizedHelpers:
72
+ Max: 12
73
+
74
+ # For now, this is disabled until I can go through all the specs and fix them
75
+ RSpec/MultipleExpectations:
76
+ Max: 13
77
+
78
+ RSpec/ExampleLength:
79
+ Max: 34
80
+
81
+ Gemspec/DevelopmentDependencies:
82
+ Enabled: false
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.2
1
+ 3.2.2
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ruby:3.1 AS build
1
+ FROM ruby:3.2 AS build
2
2
 
3
3
  ENV RACK_ENV=development
4
4
 
@@ -12,7 +12,7 @@ RUN cd /build \
12
12
 
13
13
  WORKDIR /build
14
14
 
15
- FROM ruby:3.1
15
+ FROM ruby:3.2
16
16
  LABEL maintainer="Jonathan Gnagy <jonathan.gnagy@gmail.com>"
17
17
 
18
18
  ENV BULLION_PORT=9292
data/Gemfile.lock CHANGED
@@ -1,125 +1,147 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bullion (0.3.3)
5
- httparty (~> 0.18)
4
+ bullion (0.4.1)
5
+ httparty (~> 0.21)
6
6
  json (~> 2.6)
7
- jwt (~> 2.4)
7
+ jwt (~> 2.7)
8
8
  mysql2 (~> 0.5)
9
9
  openssl (~> 3.0)
10
- prometheus-client (~> 4.0)
11
- puma (~> 5.6)
12
- sinatra (~> 2.2)
10
+ prometheus-client (~> 4.2)
11
+ puma (~> 6.4)
12
+ sinatra (~> 3.1)
13
13
  sinatra-activerecord (~> 2.0)
14
- sinatra-contrib (~> 2.2)
15
- sqlite3 (~> 1.4)
14
+ sinatra-contrib (~> 3.1)
15
+ sqlite3 (~> 1.6)
16
16
 
17
17
  GEM
18
18
  remote: https://rubygems.org/
19
19
  specs:
20
- acme-client (2.0.11)
20
+ acme-client (2.0.15)
21
21
  faraday (>= 1.0, < 3.0.0)
22
- faraday-retry (~> 1.0)
23
- activemodel (7.0.3.1)
24
- activesupport (= 7.0.3.1)
25
- activerecord (7.0.3.1)
26
- activemodel (= 7.0.3.1)
27
- activesupport (= 7.0.3.1)
28
- activesupport (7.0.3.1)
22
+ faraday-retry (>= 1.0, < 3.0.0)
23
+ activemodel (7.1.2)
24
+ activesupport (= 7.1.2)
25
+ activerecord (7.1.2)
26
+ activemodel (= 7.1.2)
27
+ activesupport (= 7.1.2)
28
+ timeout (>= 0.4.0)
29
+ activesupport (7.1.2)
30
+ base64
31
+ bigdecimal
29
32
  concurrent-ruby (~> 1.0, >= 1.0.2)
33
+ connection_pool (>= 2.2.5)
34
+ drb
30
35
  i18n (>= 1.6, < 2)
31
36
  minitest (>= 5.1)
37
+ mutex_m
32
38
  tzinfo (~> 2.0)
33
39
  ast (2.4.2)
34
40
  backport (1.2.0)
35
- benchmark (0.2.0)
41
+ base64 (0.2.0)
42
+ benchmark (0.3.0)
43
+ bigdecimal (3.1.4)
36
44
  byebug (11.1.3)
37
- concurrent-ruby (1.1.10)
45
+ concurrent-ruby (1.2.2)
46
+ connection_pool (2.4.1)
38
47
  diff-lcs (1.5.0)
39
48
  docile (1.4.0)
49
+ drb (2.2.0)
50
+ ruby2_keywords
40
51
  e2mmap (0.1.0)
41
- faraday (2.3.0)
42
- faraday-net_http (~> 2.0)
52
+ faraday (2.7.12)
53
+ base64
54
+ faraday-net_http (>= 2.0, < 3.1)
43
55
  ruby2_keywords (>= 0.0.4)
44
- faraday-net_http (2.0.3)
45
- faraday-retry (1.0.3)
46
- httparty (0.20.0)
47
- mime-types (~> 3.0)
56
+ faraday-net_http (3.0.2)
57
+ faraday-retry (2.2.0)
58
+ faraday (~> 2.0)
59
+ httparty (0.21.0)
60
+ mini_mime (>= 1.0.0)
48
61
  multi_xml (>= 0.5.2)
49
- i18n (1.12.0)
62
+ i18n (1.14.1)
50
63
  concurrent-ruby (~> 1.0)
51
- jaro_winkler (1.5.4)
52
- json (2.6.2)
53
- jwt (2.4.1)
64
+ jaro_winkler (1.5.6)
65
+ json (2.6.3)
66
+ jwt (2.7.1)
54
67
  kramdown (2.4.0)
55
68
  rexml
56
69
  kramdown-parser-gfm (1.1.0)
57
70
  kramdown (~> 2.0)
58
- mime-types (3.4.1)
59
- mime-types-data (~> 3.2015)
60
- mime-types-data (3.2022.0105)
61
- mini_portile2 (2.8.0)
62
- minitest (5.16.2)
71
+ language_server-protocol (3.17.0.3)
72
+ mini_mime (1.1.5)
73
+ mini_portile2 (2.8.5)
74
+ minitest (5.20.0)
63
75
  multi_json (1.15.0)
64
76
  multi_xml (0.6.0)
65
- mustermann (1.1.2)
77
+ mustermann (3.0.0)
66
78
  ruby2_keywords (~> 0.0.1)
67
- mysql2 (0.5.4)
68
- nio4r (2.5.8)
69
- nokogiri (1.13.7)
70
- mini_portile2 (~> 2.8.0)
79
+ mutex_m (0.2.0)
80
+ mysql2 (0.5.5)
81
+ nio4r (2.6.1)
82
+ nokogiri (1.15.5)
83
+ mini_portile2 (~> 2.8.2)
71
84
  racc (~> 1.4)
72
- openssl (3.0.0)
73
- parallel (1.22.1)
74
- parser (3.1.2.0)
85
+ openssl (3.2.0)
86
+ parallel (1.23.0)
87
+ parser (3.2.2.4)
75
88
  ast (~> 2.4.1)
76
- prometheus-client (4.0.0)
77
- puma (5.6.4)
89
+ racc
90
+ prometheus-client (4.2.2)
91
+ puma (6.4.0)
78
92
  nio4r (~> 2.0)
79
- racc (1.6.0)
80
- rack (2.2.4)
81
- rack-protection (2.2.1)
82
- rack
83
- rack-test (2.0.2)
93
+ racc (1.7.3)
94
+ rack (2.2.8)
95
+ rack-protection (3.1.0)
96
+ rack (~> 2.2, >= 2.2.4)
97
+ rack-test (2.1.0)
84
98
  rack (>= 1.3)
85
99
  rainbow (3.1.1)
86
- rake (12.3.3)
87
- regexp_parser (2.5.0)
100
+ rake (13.1.0)
101
+ rbs (2.8.4)
102
+ regexp_parser (2.8.2)
88
103
  reverse_markdown (2.1.1)
89
104
  nokogiri
90
- rexml (3.2.5)
91
- rspec (3.11.0)
92
- rspec-core (~> 3.11.0)
93
- rspec-expectations (~> 3.11.0)
94
- rspec-mocks (~> 3.11.0)
95
- rspec-core (3.11.0)
96
- rspec-support (~> 3.11.0)
97
- rspec-expectations (3.11.0)
105
+ rexml (3.2.6)
106
+ rspec (3.12.0)
107
+ rspec-core (~> 3.12.0)
108
+ rspec-expectations (~> 3.12.0)
109
+ rspec-mocks (~> 3.12.0)
110
+ rspec-core (3.12.2)
111
+ rspec-support (~> 3.12.0)
112
+ rspec-expectations (3.12.3)
98
113
  diff-lcs (>= 1.2.0, < 2.0)
99
- rspec-support (~> 3.11.0)
100
- rspec-mocks (3.11.1)
114
+ rspec-support (~> 3.12.0)
115
+ rspec-mocks (3.12.6)
101
116
  diff-lcs (>= 1.2.0, < 2.0)
102
- rspec-support (~> 3.11.0)
103
- rspec-support (3.11.0)
104
- rubocop (1.32.0)
117
+ rspec-support (~> 3.12.0)
118
+ rspec-support (3.12.1)
119
+ rubocop (1.57.2)
105
120
  json (~> 2.3)
121
+ language_server-protocol (>= 3.17.0)
106
122
  parallel (~> 1.10)
107
- parser (>= 3.1.0.0)
123
+ parser (>= 3.2.2.4)
108
124
  rainbow (>= 2.2.2, < 4.0)
109
125
  regexp_parser (>= 1.8, < 3.0)
110
126
  rexml (>= 3.2.5, < 4.0)
111
- rubocop-ast (>= 1.19.1, < 2.0)
127
+ rubocop-ast (>= 1.28.1, < 2.0)
112
128
  ruby-progressbar (~> 1.7)
113
- unicode-display_width (>= 1.4.0, < 3.0)
114
- rubocop-ast (1.19.1)
115
- parser (>= 3.1.1.0)
129
+ unicode-display_width (>= 2.4.0, < 3.0)
130
+ rubocop-ast (1.30.0)
131
+ parser (>= 3.2.1.0)
132
+ rubocop-capybara (2.19.0)
133
+ rubocop (~> 1.41)
134
+ rubocop-factory_bot (2.24.0)
135
+ rubocop (~> 1.33)
116
136
  rubocop-rake (0.6.0)
117
137
  rubocop (~> 1.0)
118
- rubocop-rspec (2.12.1)
119
- rubocop (~> 1.31)
120
- ruby-progressbar (1.11.0)
138
+ rubocop-rspec (2.25.0)
139
+ rubocop (~> 1.40)
140
+ rubocop-capybara (~> 2.17)
141
+ rubocop-factory_bot (~> 2.22)
142
+ ruby-progressbar (1.13.0)
121
143
  ruby2_keywords (0.0.5)
122
- simplecov (0.21.2)
144
+ simplecov (0.22.0)
123
145
  docile (~> 1.1)
124
146
  simplecov-html (~> 0.11)
125
147
  simplecov_json_formatter (~> 0.1)
@@ -128,44 +150,45 @@ GEM
128
150
  simplecov (~> 0.19)
129
151
  simplecov-html (0.12.3)
130
152
  simplecov_json_formatter (0.1.4)
131
- sinatra (2.2.1)
132
- mustermann (~> 1.0)
133
- rack (~> 2.2)
134
- rack-protection (= 2.2.1)
153
+ sinatra (3.1.0)
154
+ mustermann (~> 3.0)
155
+ rack (~> 2.2, >= 2.2.4)
156
+ rack-protection (= 3.1.0)
135
157
  tilt (~> 2.0)
136
- sinatra-activerecord (2.0.25)
158
+ sinatra-activerecord (2.0.27)
137
159
  activerecord (>= 4.1)
138
160
  sinatra (>= 1.0)
139
- sinatra-contrib (2.2.1)
161
+ sinatra-contrib (3.1.0)
140
162
  multi_json
141
- mustermann (~> 1.0)
142
- rack-protection (= 2.2.1)
143
- sinatra (= 2.2.1)
163
+ mustermann (~> 3.0)
164
+ rack-protection (= 3.1.0)
165
+ sinatra (= 3.1.0)
144
166
  tilt (~> 2.0)
145
- solargraph (0.45.0)
167
+ solargraph (0.49.0)
146
168
  backport (~> 1.2)
147
169
  benchmark
148
- bundler (>= 1.17.2)
170
+ bundler (~> 2.0)
149
171
  diff-lcs (~> 1.4)
150
172
  e2mmap
151
173
  jaro_winkler (~> 1.5)
152
174
  kramdown (~> 2.3)
153
175
  kramdown-parser-gfm (~> 1.1)
154
176
  parser (~> 3.0)
155
- reverse_markdown (>= 1.0.5, < 3)
156
- rubocop (>= 0.52)
177
+ rbs (~> 2.0)
178
+ reverse_markdown (~> 2.0)
179
+ rubocop (~> 1.38)
157
180
  thor (~> 1.0)
158
181
  tilt (~> 2.0)
159
182
  yard (~> 0.9, >= 0.9.24)
160
- sqlite3 (1.4.4)
161
- thor (1.2.1)
162
- tilt (2.0.11)
163
- tzinfo (2.0.5)
183
+ sqlite3 (1.6.9)
184
+ mini_portile2 (~> 2.8.0)
185
+ thor (1.3.0)
186
+ tilt (2.3.0)
187
+ timeout (0.4.1)
188
+ tzinfo (2.0.6)
164
189
  concurrent-ruby (~> 1.0)
165
- unicode-display_width (2.2.0)
166
- webrick (1.7.0)
167
- yard (0.9.28)
168
- webrick (~> 1.7.0)
190
+ unicode-display_width (2.5.0)
191
+ yard (0.9.34)
169
192
 
170
193
  PLATFORMS
171
194
  ruby
@@ -173,18 +196,18 @@ PLATFORMS
173
196
  DEPENDENCIES
174
197
  acme-client (~> 2.0)
175
198
  bullion!
176
- bundler (~> 2.3)
199
+ bundler (~> 2.4)
177
200
  byebug (~> 11)
178
- rack-test (~> 2.0)
179
- rake (~> 12.3)
180
- rspec (~> 3.10)
181
- rubocop (~> 1.31)
201
+ rack-test (~> 2.1)
202
+ rake (~> 13.1)
203
+ rspec (~> 3.12)
204
+ rubocop (~> 1.57)
182
205
  rubocop-rake (~> 0.6)
183
- rubocop-rspec (~> 2.11)
184
- simplecov (~> 0.21)
206
+ rubocop-rspec (~> 2.25)
207
+ simplecov (~> 0.22)
185
208
  simplecov-cobertura (~> 2.1)
186
- solargraph (~> 0.45)
209
+ solargraph (~> 0.49)
187
210
  yard (~> 0.9)
188
211
 
189
212
  BUNDLED WITH
190
- 2.3.10
213
+ 2.4.13
data/Rakefile CHANGED
@@ -15,6 +15,8 @@ require "sqlite3"
15
15
  require "sinatra/activerecord/rake"
16
16
 
17
17
  namespace :db do
18
+ # A hack to connect to the DB for testing
19
+ desc "Establishes a required connection to the DB for testing and demos"
18
20
  task :load_config do
19
21
  ActiveRecord::Base.establish_connection(url: ENV.fetch("DATABASE_URL", nil))
20
22
  end
@@ -31,6 +33,7 @@ end
31
33
  RuboCop::RakeTask.new(:rubocop)
32
34
  YARD::Rake::YardocTask.new
33
35
 
36
+ desc "Prepares a demo or test environment"
34
37
  task :prep do
35
38
  FileUtils.mkdir_p(File.join(File.expand_path("."), "tmp"))
36
39
  ENV["CA_DIR"] = File.join(File.expand_path("."), "tmp").to_s
@@ -70,6 +73,7 @@ task :prep do
70
73
  File.write(File.join(File.expand_path("."), "tmp", "tls.crt"), root_ca.to_pem)
71
74
  end
72
75
 
76
+ desc "Runs a backgrounded demo environment"
73
77
  task :demo do
74
78
  rack_env = "test"
75
79
  database_url = "sqlite3:#{File.expand_path(".")}/tmp/db/#{rack_env}.sqlite3"
@@ -81,10 +85,12 @@ task :demo do
81
85
  )
82
86
  end
83
87
 
88
+ desc "Runs a foregrounded demo environment"
84
89
  task :foreground_demo do
85
90
  system("rackup -P #{File.expand_path(".")}/tmp/daemon.pid")
86
91
  end
87
92
 
93
+ desc "Cleans up test or demo environment"
88
94
  task :cleanup do
89
95
  at_exit do
90
96
  if File.exist?("#{File.expand_path(".")}/tmp/daemon.pid")
data/bullion.gemspec CHANGED
@@ -26,29 +26,29 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.required_ruby_version = "~> 3.1"
28
28
 
29
- spec.add_runtime_dependency "httparty", "~> 0.18"
29
+ spec.add_runtime_dependency "httparty", "~> 0.21"
30
30
  spec.add_runtime_dependency "json", "~> 2.6"
31
- spec.add_runtime_dependency "jwt", "~> 2.4"
31
+ spec.add_runtime_dependency "jwt", "~> 2.7"
32
32
  spec.add_runtime_dependency "mysql2", "~> 0.5"
33
33
  spec.add_runtime_dependency "openssl", "~> 3.0"
34
- spec.add_runtime_dependency "prometheus-client", "~> 4.0"
35
- spec.add_runtime_dependency "puma", "~> 5.6"
36
- spec.add_runtime_dependency "sinatra", "~> 2.2"
34
+ spec.add_runtime_dependency "prometheus-client", "~> 4.2"
35
+ spec.add_runtime_dependency "puma", "~> 6.4"
36
+ spec.add_runtime_dependency "sinatra", "~> 3.1"
37
37
  spec.add_runtime_dependency "sinatra-activerecord", "~> 2.0"
38
- spec.add_runtime_dependency "sinatra-contrib", "~> 2.2"
39
- spec.add_runtime_dependency "sqlite3", "~> 1.4"
38
+ spec.add_runtime_dependency "sinatra-contrib", "~> 3.1"
39
+ spec.add_runtime_dependency "sqlite3", "~> 1.6"
40
40
 
41
41
  spec.add_development_dependency "acme-client", "~> 2.0"
42
- spec.add_development_dependency "bundler", "~> 2.3"
42
+ spec.add_development_dependency "bundler", "~> 2.4"
43
43
  spec.add_development_dependency "byebug", "~> 11"
44
- spec.add_development_dependency "rack-test", "~> 2.0"
45
- spec.add_development_dependency "rake", "~> 12.3"
46
- spec.add_development_dependency "rspec", "~> 3.10"
47
- spec.add_development_dependency "rubocop", "~> 1.31"
44
+ spec.add_development_dependency "rack-test", "~> 2.1"
45
+ spec.add_development_dependency "rake", "~> 13.1"
46
+ spec.add_development_dependency "rspec", "~> 3.12"
47
+ spec.add_development_dependency "rubocop", "~> 1.57"
48
48
  spec.add_development_dependency "rubocop-rake", "~> 0.6"
49
- spec.add_development_dependency "rubocop-rspec", "~> 2.11"
50
- spec.add_development_dependency "simplecov", "~> 0.21"
49
+ spec.add_development_dependency "rubocop-rspec", "~> 2.25"
50
+ spec.add_development_dependency "simplecov", "~> 0.22"
51
51
  spec.add_development_dependency "simplecov-cobertura", "~> 2.1"
52
- spec.add_development_dependency "solargraph", "~> 0.45"
52
+ spec.add_development_dependency "solargraph", "~> 0.49"
53
53
  spec.add_development_dependency "yard", "~> 0.9"
54
54
  end
data/db/schema.rb CHANGED
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema[7.0].define(version: 2021_01_06_060335) do
13
+ ActiveRecord::Schema[7.1].define(version: 2021_01_06_060335) do
14
14
  create_table "accounts", force: :cascade do |t|
15
15
  t.boolean "tos_agreed", default: true, null: false
16
16
  t.text "public_key", null: false
@@ -21,32 +21,46 @@ module Bullion
21
21
 
22
22
  # @see https://tools.ietf.org/html/rfc7518#page-30
23
23
  def key_data_to_rsa(key_data)
24
- key = OpenSSL::PKey::RSA.new
25
- exponent = key_data["e"]
26
- modulus = key_data["n"]
27
-
28
- key.set_key(
29
- base64_to_long(modulus),
30
- base64_to_long(exponent),
31
- nil
24
+ exponent = base64_to_long(key_data["e"])
25
+ modulus = base64_to_long(key_data["n"])
26
+
27
+ data_sequence = OpenSSL::ASN1::Sequence.new(
28
+ [
29
+ OpenSSL::ASN1::Integer.new(modulus),
30
+ OpenSSL::ASN1::Integer.new(exponent)
31
+ ]
32
32
  )
33
- key
33
+
34
+ outer_sequence = OpenSSL::ASN1::Sequence.new(data_sequence)
35
+
36
+ OpenSSL::PKey::RSA.new(outer_sequence.to_der)
34
37
  end
35
38
 
36
39
  def key_data_to_ecdsa(key_data)
37
40
  crv_mapping = {
38
41
  "P-256" => "prime256v1",
42
+ "secp256k1" => "secp256k1",
39
43
  "P-384" => "secp384r1",
40
44
  "P-521" => "secp521r1"
41
45
  }
42
46
 
43
- key = OpenSSL::PKey::EC.new(crv_mapping[key_data["crv"]])
44
47
  x = base64_to_octet(key_data["x"])
45
48
  y = base64_to_octet(key_data["y"])
49
+ curve_name = crv_mapping[key_data["crv"]]
50
+ raise "Unknown curve" unless curve_name
46
51
 
52
+ key_group = OpenSSL::PKey::EC::Group.new(curve_name)
47
53
  key_bn = OpenSSL::BN.new("\x04#{x}#{y}", 2)
48
- key.public_key = OpenSSL::PKey::EC::Point.new(key.group, key_bn)
49
- key
54
+ key_point = OpenSSL::PKey::EC::Point.new(key_group, key_bn)
55
+
56
+ pk_sequence = OpenSSL::ASN1::Sequence.new(
57
+ [OpenSSL::ASN1::ObjectId("id-ecPublicKey"), OpenSSL::ASN1::ObjectId(curve_name)]
58
+ )
59
+ bitstring = OpenSSL::ASN1::BitString.new(key_point.to_octet_string(:uncompressed))
60
+
61
+ outer_sequence = OpenSSL::ASN1::Sequence.new([pk_sequence, bitstring])
62
+
63
+ OpenSSL::PKey::EC.new(outer_sequence.to_der)
50
64
  end
51
65
 
52
66
  def base64_to_long(data)
@@ -4,8 +4,8 @@ module Bullion
4
4
  module Models
5
5
  # ACMEv2 Account model
6
6
  class Account < ActiveRecord::Base
7
- serialize :contacts, JSON
8
- serialize :public_key, JSON
7
+ serialize :contacts, coder: JSON
8
+ serialize :public_key, coder: JSON
9
9
 
10
10
  validates_uniqueness_of :public_key
11
11
 
@@ -4,7 +4,7 @@ module Bullion
4
4
  module Models
5
5
  # ACMEv2 Authorization model
6
6
  class Authorization < ActiveRecord::Base
7
- serialize :identifier, JSON
7
+ serialize :identifier, coder: JSON
8
8
 
9
9
  after_initialize :init_values, unless: :persisted?
10
10
 
@@ -4,7 +4,7 @@ module Bullion
4
4
  module Models
5
5
  # SSL Certificate model
6
6
  class Certificate < ActiveRecord::Base
7
- serialize :alternate_names, JSON
7
+ serialize :alternate_names, coder: JSON
8
8
 
9
9
  after_initialize :init_values, unless: :persisted?
10
10
 
@@ -4,7 +4,7 @@ module Bullion
4
4
  module Models
5
5
  # ACMEv2 Order model
6
6
  class Order < ActiveRecord::Base
7
- serialize :identifiers, JSON
7
+ serialize :identifiers, coder: JSON
8
8
 
9
9
  after_initialize :init_values, unless: :persisted?
10
10
 
@@ -3,7 +3,7 @@
3
3
  module Bullion
4
4
  VERSION = [
5
5
  0, # major
6
- 3, # minor
7
- 3 # patch
6
+ 4, # minor
7
+ 1 # patch
8
8
  ].join(".")
9
9
  end
data/lib/bullion.rb CHANGED
@@ -10,6 +10,7 @@ require "openssl"
10
10
 
11
11
  # External requirements
12
12
  require "sinatra/base"
13
+ require "sinatra/contrib"
13
14
  require "sinatra/custom_logger"
14
15
  require "mysql2"
15
16
  require "sinatra/activerecord"
@@ -79,8 +80,8 @@ module Bullion
79
80
  raise ConfigError, "Invalid Key Passphrase" unless CA_SECRET.is_a?(String)
80
81
  raise ConfigError, "Invalid Key Path: #{CA_KEY_PATH}" unless File.readable?(CA_KEY_PATH)
81
82
  raise ConfigError, "Invalid Cert Path: #{CA_CERT_PATH}" unless File.readable?(CA_CERT_PATH)
82
- raise ConfigError, "Cert Validity Too Long" if CERT_VALIDITY_DURATION > 60 * 60 * 24 * 397
83
- raise ConfigError, "Cert Validity Too Short" if CERT_VALIDITY_DURATION < 60 * 60 * 24 * 2
83
+ raise ConfigError, "Cert Validity Too Long" if 60 * 60 * 24 * 397 < CERT_VALIDITY_DURATION
84
+ raise ConfigError, "Cert Validity Too Short" if 60 * 60 * 24 * 2 > CERT_VALIDITY_DURATION
84
85
  end
85
86
  end
86
87
 
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ VERSION_TAG=`grep bullion Gemfile.lock | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'`
4
+ docker tag bullion:local jgnagy/bullion:$VERSION_TAG
5
+ docker tag bullion:local jgnagy/bullion:latest
6
+ docker push jgnagy/bullion:$VERSION_TAG
7
+ docker push jgnagy/bullion:latest
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.1
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-08-07 00:00:00.000000000 Z
11
+ date: 2023-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.18'
19
+ version: '0.21'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.18'
26
+ version: '0.21'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.4'
47
+ version: '2.7'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.4'
54
+ version: '2.7'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mysql2
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,42 +86,42 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '4.0'
89
+ version: '4.2'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '4.0'
96
+ version: '4.2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: puma
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '5.6'
103
+ version: '6.4'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '5.6'
110
+ version: '6.4'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: sinatra
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.2'
117
+ version: '3.1'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.2'
124
+ version: '3.1'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sinatra-activerecord
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,28 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '2.2'
145
+ version: '3.1'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '2.2'
152
+ version: '3.1'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: sqlite3
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.4'
159
+ version: '1.6'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '1.4'
166
+ version: '1.6'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: acme-client
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '2.3'
187
+ version: '2.4'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '2.3'
194
+ version: '2.4'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: byebug
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -212,56 +212,56 @@ dependencies:
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: '2.0'
215
+ version: '2.1'
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: '2.0'
222
+ version: '2.1'
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: rake
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: '12.3'
229
+ version: '13.1'
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
- version: '12.3'
236
+ version: '13.1'
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: rspec
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: '3.10'
243
+ version: '3.12'
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: '3.10'
250
+ version: '3.12'
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: rubocop
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - "~>"
256
256
  - !ruby/object:Gem::Version
257
- version: '1.31'
257
+ version: '1.57'
258
258
  type: :development
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - "~>"
263
263
  - !ruby/object:Gem::Version
264
- version: '1.31'
264
+ version: '1.57'
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: rubocop-rake
267
267
  requirement: !ruby/object:Gem::Requirement
@@ -282,28 +282,28 @@ dependencies:
282
282
  requirements:
283
283
  - - "~>"
284
284
  - !ruby/object:Gem::Version
285
- version: '2.11'
285
+ version: '2.25'
286
286
  type: :development
287
287
  prerelease: false
288
288
  version_requirements: !ruby/object:Gem::Requirement
289
289
  requirements:
290
290
  - - "~>"
291
291
  - !ruby/object:Gem::Version
292
- version: '2.11'
292
+ version: '2.25'
293
293
  - !ruby/object:Gem::Dependency
294
294
  name: simplecov
295
295
  requirement: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - "~>"
298
298
  - !ruby/object:Gem::Version
299
- version: '0.21'
299
+ version: '0.22'
300
300
  type: :development
301
301
  prerelease: false
302
302
  version_requirements: !ruby/object:Gem::Requirement
303
303
  requirements:
304
304
  - - "~>"
305
305
  - !ruby/object:Gem::Version
306
- version: '0.21'
306
+ version: '0.22'
307
307
  - !ruby/object:Gem::Dependency
308
308
  name: simplecov-cobertura
309
309
  requirement: !ruby/object:Gem::Requirement
@@ -324,14 +324,14 @@ dependencies:
324
324
  requirements:
325
325
  - - "~>"
326
326
  - !ruby/object:Gem::Version
327
- version: '0.45'
327
+ version: '0.49'
328
328
  type: :development
329
329
  prerelease: false
330
330
  version_requirements: !ruby/object:Gem::Requirement
331
331
  requirements:
332
332
  - - "~>"
333
333
  - !ruby/object:Gem::Version
334
- version: '0.45'
334
+ version: '0.49'
335
335
  - !ruby/object:Gem::Dependency
336
336
  name: yard
337
337
  requirement: !ruby/object:Gem::Requirement
@@ -401,6 +401,7 @@ files:
401
401
  - lib/bullion/version.rb
402
402
  - scripts/build.sh
403
403
  - scripts/docker-entrypoint.sh
404
+ - scripts/publish.sh
404
405
  - scripts/release.sh
405
406
  - scripts/test.sh
406
407
  homepage: https://github.com/jgnagy/bullion
@@ -424,7 +425,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
424
425
  - !ruby/object:Gem::Version
425
426
  version: '0'
426
427
  requirements: []
427
- rubygems_version: 3.3.7
428
+ rubygems_version: 3.4.10
428
429
  signing_key:
429
430
  specification_version: 4
430
431
  summary: Ruby ACME v2 Certificate Authority