bullion 0.4.3 → 0.5.0
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/Gemfile.lock +1 -1
- data/lib/bullion/helpers/service.rb +28 -1
- data/lib/bullion/services/ca.rb +5 -1
- data/lib/bullion/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 164cf3dcab36d3365270c3e7bbfb47af7daf559d6b1d1d22764d5eb5e31d3e9d
|
4
|
+
data.tar.gz: dd530b27db7e32e710a6eb8c32728d153ab53da0443cfa3a786336ce8aef96ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da0d24140bb16c16d440848f6dff64a8b73c846f01c882924cdffb96c16874ed2b81ad4204ee83ece321f0c9d5e449c4b22013724f9454fc37691adf2ef1ca8
|
7
|
+
data.tar.gz: a8aff288e4ba92cea77f7cbb3d07613564a59e5e525ed991581e3c51701923d6a7f04501d1582554cefcd2bd8e3081f122413ee0f302f4ee36603eb54b536ec1
|
data/Gemfile.lock
CHANGED
@@ -6,12 +6,39 @@ module Bullion
|
|
6
6
|
module Service
|
7
7
|
def add_acme_headers(nonce, additional: {})
|
8
8
|
headers["Replay-Nonce"] = nonce
|
9
|
-
|
9
|
+
add_link_relation("index", uri("/directory"))
|
10
10
|
|
11
11
|
additional.each do |name, value|
|
12
12
|
headers[name.to_s] = value.to_s
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
def add_link_relation(type, value)
|
17
|
+
cur = link_headers_to_hash(headers["Link"])
|
18
|
+
cur[type] = value
|
19
|
+
headers["Link"] = hashed_links_to_link_headers(cur)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def link_headers_to_hash(values_string)
|
25
|
+
return {} unless values_string&.length&.positive?
|
26
|
+
|
27
|
+
values_string.split(",").to_h do |relation|
|
28
|
+
raw_value, raw_name = relation.split(";")
|
29
|
+
value = /^<(.+)>$/.match(raw_value)[1]
|
30
|
+
name = /^rel="(.+)"$/.match(raw_name)[1]
|
31
|
+
[name, value]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def hashed_links_to_link_headers(hash)
|
36
|
+
hash.reduce([]) do |acc, data|
|
37
|
+
name = "rel=\"#{data[0]}\""
|
38
|
+
value = "<#{data[1]}>"
|
39
|
+
acc << [value, name].join(";")
|
40
|
+
end.join(",")
|
41
|
+
end
|
15
42
|
end
|
16
43
|
end
|
17
44
|
end
|
data/lib/bullion/services/ca.rb
CHANGED
@@ -355,8 +355,11 @@ module Bullion
|
|
355
355
|
|
356
356
|
if challenge.status == "valid"
|
357
357
|
data[:validated] = challenge.validated
|
358
|
-
|
358
|
+
authorization = challenge.authorization
|
359
|
+
authorization.update!(status: "valid") unless authorization.status == "valid"
|
360
|
+
order = authorization.order
|
359
361
|
order.update!(status: "ready") unless order.status == "ready"
|
362
|
+
add_link_relation("up", uri("/authorizations/#{challenge.authorization.id}"))
|
360
363
|
end
|
361
364
|
|
362
365
|
data.to_json
|
@@ -369,6 +372,7 @@ module Bullion
|
|
369
372
|
# @see https://tools.ietf.org/html/rfc8555#section-7.4.2
|
370
373
|
post "/certificates/:id" do
|
371
374
|
parse_acme_jwt
|
375
|
+
add_acme_headers @new_nonce
|
372
376
|
|
373
377
|
order = Models::Order.where(certificate_id: params[:id]).first
|
374
378
|
if order && order.status == "valid"
|
data/lib/bullion/version.rb
CHANGED
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Gnagy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|