bullion 0.4.3 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bullion/helpers/service.rb +28 -1
- data/lib/bullion/services/ca.rb +6 -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: 56d18291c0ea53bad26341c758991fc355fd502dff0af9f63228b898581ec22e
|
4
|
+
data.tar.gz: 3cca92ceecec74f0571a84a9295ebd062baa7f8b607c45b0bca7d85032681067
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c597fba5cdec355e16599e7dce74cc388cc48bf52afee1f756d3cefd930131a359e097fb4094f7f599c99d3f0e9d62a9b6b6700ba4c458e0ada75acc239179b9
|
7
|
+
data.tar.gz: cd59c5e385d342823ddb57bffe8fdc958c158738ca61cc1d63431ed06c23819d59b1b8e16e812172dcefc43d2710fe10877004cd4b7dc1fe66ae71324eb36386
|
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,10 +355,14 @@ 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"
|
360
362
|
end
|
361
363
|
|
364
|
+
add_link_relation("up", uri("/authorizations/#{challenge.authorization.id}"))
|
365
|
+
|
362
366
|
data.to_json
|
363
367
|
rescue Bullion::Acme::Error => e
|
364
368
|
content_type "application/problem+json"
|
@@ -369,6 +373,7 @@ module Bullion
|
|
369
373
|
# @see https://tools.ietf.org/html/rfc8555#section-7.4.2
|
370
374
|
post "/certificates/:id" do
|
371
375
|
parse_acme_jwt
|
376
|
+
add_acme_headers @new_nonce
|
372
377
|
|
373
378
|
order = Models::Order.where(certificate_id: params[:id]).first
|
374
379
|
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.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:
|
11
|
+
date: 2024-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|