acme-client 2.0.34 → 2.0.35

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: 89c12bcb307e446e08b101e2ceade09f0edb11bbdbac66406706bf3cc5235f2d
4
- data.tar.gz: cf2b1335b4e3080c344fd685731d41d15340265e152037ac9fe4c8e362f8199b
3
+ metadata.gz: f38120a91d760cdaf3a37defaf5c100da771a656655bb9cf26276901371e89f3
4
+ data.tar.gz: 712b061ca7d441c0fcbb5554a21a44c1495bf0fa5a7b21010942f644f79d353b
5
5
  SHA512:
6
- metadata.gz: b0a658e05c3d12188e8615cc0bad63b23649b0839fe96352cc3362be6a567e5b05527f94b645bbee093830a8f2f8e12ca39ca422f44bfa6f479e50e1740d1035
7
- data.tar.gz: 00b4f8042dbae77cd3ae156b650f7a63927c6628142ba4b65831892937b237b096b4f00f944436444d3078afc7b2c36f50cef5a17f392a48e2de43b6a656d75b
6
+ metadata.gz: d830b1206e60ae98a031de5237618c3a526fdd2f29ebaed5aa018352c15c3838e30015a104de622a850846ac56e5bbe94c06b94378bab854adb961031c8548ef
7
+ data.tar.gz: 741e5e8b735527b1f95b630564ce0cf1729880323cb3eae7696ce7a7738570de73ab2ce0aaf3bb0bf53c2b7418d3ad56240e2373f55414bf2e112f7802443dc2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## `2.0.35`
2
+
3
+ * Expose the RFC 8555 order `error` field on `Resources::Order#error` and add `Order#typed_error`
4
+
1
5
  ## `2.0.34`
2
6
 
3
7
  * Add badAttestationStatement error
data/README.md CHANGED
@@ -224,6 +224,15 @@ end
224
224
  order.certificate # => PEM-formatted certificate
225
225
  ```
226
226
 
227
+ When the server fails issuance after accepting the finalize request, the order moves to `invalid` and carries a problem document explaining why.
228
+
229
+ ```ruby
230
+ if order.status == 'invalid'
231
+ order.error # => { "type" => "urn:ietf:params:acme:error:rateLimited", "detail" => "..." }
232
+ order.typed_error # => Acme::Client::Error::RateLimited
233
+ end
234
+ ```
235
+
227
236
  ### Ordering an alternative certificate
228
237
 
229
238
  The provider may provide alternate certificate with different certificate chain. You can specify the required chain and the client will automatically download alternate certificate and match the chain by name.
data/Rakefile CHANGED
@@ -3,4 +3,9 @@ require 'bundler/gem_tasks'
3
3
  require 'rspec/core/rake_task'
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
+ desc 'Check the gem against the live IANA ACME error registry'
7
+ task :spec_iana_registry do
8
+ sh({ 'RUN_IANA_REGISTRY_SPEC' => '1' }, 'bundle exec rspec spec/iana_registry_spec.rb')
9
+ end
10
+
6
11
  task default: [:spec]
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Acme::Client::Resources::Order
4
- attr_reader :url, :status, :contact, :finalize_url, :identifiers, :authorization_urls, :expires, :certificate_url, :profile, :replaces, :retry_after, :retry_after_time
4
+ attr_reader :url, :status, :contact, :finalize_url, :identifiers, :authorization_urls, :expires, :certificate_url, :profile, :replaces, :error, :retry_after, :retry_after_time
5
5
 
6
6
  def initialize(client, **arguments)
7
7
  @client = client
@@ -46,6 +46,16 @@ class Acme::Client::Resources::Order
46
46
  @client.renewal_info(certificate:, ari_id:)
47
47
  end
48
48
 
49
+ def typed_error
50
+ return nil unless error
51
+
52
+ problem = Acme::Client::Problem.from(error)
53
+ error_type = problem&.type
54
+ error_detail = problem&.detail || 'Unknown error'
55
+ error_class = Acme::Client::Error::ACME_ERRORS.fetch(error_type, Acme::Client::Error)
56
+ error_class.new(error_detail, problem: problem)
57
+ end
58
+
49
59
  def to_h
50
60
  {
51
61
  url: url,
@@ -57,13 +67,14 @@ class Acme::Client::Resources::Order
57
67
  certificate_url: certificate_url,
58
68
  profile: profile,
59
69
  replaces: replaces,
70
+ error: error,
60
71
  retry_after: retry_after
61
72
  }
62
73
  end
63
74
 
64
75
  private
65
76
 
66
- def assign_attributes(url: nil, status:, expires:, finalize_url:, authorization_urls:, identifiers:, certificate_url: nil, profile: nil, replaces: nil, retry_after: nil) # rubocop:disable Layout/LineLength,Metrics/ParameterLists
77
+ def assign_attributes(url: nil, status:, expires:, finalize_url:, authorization_urls:, identifiers:, certificate_url: nil, profile: nil, replaces: nil, error: nil, retry_after: nil) # rubocop:disable Layout/LineLength,Metrics/ParameterLists
67
78
  @url = url unless url.nil?
68
79
  @status = status
69
80
  @expires = expires
@@ -73,6 +84,7 @@ class Acme::Client::Resources::Order
73
84
  @certificate_url = certificate_url
74
85
  @profile = profile
75
86
  @replaces = replaces
87
+ @error = error
76
88
  @retry_after = retry_after
77
89
  @retry_after_time = Acme::Client::Util.parse_retry_after(retry_after)
78
90
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Acme
4
4
  class Client
5
- VERSION = '2.0.34'.freeze
5
+ VERSION = '2.0.35'.freeze
6
6
  end
7
7
  end
data/lib/acme/client.rb CHANGED
@@ -323,7 +323,8 @@ class Acme::Client
323
323
  [:certificate_url, 'certificate'],
324
324
  :identifiers,
325
325
  :profile,
326
- :replaces
326
+ :replaces,
327
+ :error
327
328
  )
328
329
 
329
330
  attributes[:url] = response.headers[:location] if response.headers[:location]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acme-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.34
4
+ version: 2.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Barbier