acme-client 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5cf05983ff0530ff6a437895b70d686deb7ffd8
4
- data.tar.gz: 351f8408667c94ff7107f95b48215b589736db34
3
+ metadata.gz: 54ec1f6479ae9ad3e2cbf8c5986a10c320f357c8
4
+ data.tar.gz: df0f59c9c338dc51dc695be84a463af71c839476
5
5
  SHA512:
6
- metadata.gz: 419dde577de805c570f1b502ec660eb7734aba59f8243f7e7febc46a2eacc86e5e93d922bca0085dc5eb3cd783e1ccd1927a8b2844c55ed8d12a717d66603f44
7
- data.tar.gz: d0a6e1682e3d3bbe04f645e1faf5b6ef11675e24cece7475ec42c134a9aa7c15c85c61e1518c5670793b4dfa42a3aad83234627aa249c7e4c74cba3d44669b22
6
+ metadata.gz: d8f1abedad59da56d0703c142db46c87467cda2fe7612c638f83ca9a6b77029b783d8eea8231b04c99094495b70164efda1ca03be08be28eb70cb5ca20b15de2
7
+ data.tar.gz: e6913ac5eda13275adcd2638e04d96c23a6c13083dc4e70c7956236e03a1d7d4aca22c2f388c6fc4917987dfb42ca828c27d605f2cb856ed3117e73d2b25e21d
@@ -1,3 +1,7 @@
1
+ ## `2.0.4`
2
+
3
+ * Add an option to retry bad nonce errors
4
+
1
5
  ## `2.0.3`
2
6
 
3
7
  * Do not try to set the body on GET request
data/README.md CHANGED
@@ -182,7 +182,10 @@ Certificate generation happens asynchronously. You may need to poll.
182
182
  ```ruby
183
183
  csr = Acme::Client::CertificateRequest.new(private_key: a_different_private_key, subject: { common_name: 'example.com' })
184
184
  order.finalize(csr: csr)
185
- sleep(1) while order.status == 'processing'
185
+ while order.status == 'processing'
186
+ sleep(1)
187
+ challenge.reload
188
+ end
186
189
  order.certificate # => PEM-formatted certificate
187
190
  ```
188
191
 
@@ -29,7 +29,7 @@ class Acme::Client
29
29
  pem: 'application/pem-certificate-chain'
30
30
  }
31
31
 
32
- def initialize(jwk: nil, kid: nil, private_key: nil, directory: DEFAULT_DIRECTORY, connection_options: {})
32
+ def initialize(jwk: nil, kid: nil, private_key: nil, directory: DEFAULT_DIRECTORY, connection_options: {}, bad_nonce_retry: 0)
33
33
  if jwk.nil? && private_key.nil?
34
34
  raise ArgumentError, 'must specify jwk or private_key'
35
35
  end
@@ -41,6 +41,7 @@ class Acme::Client
41
41
  end
42
42
 
43
43
  @kid, @connection_options = kid, connection_options
44
+ @bad_nonce_retry = bad_nonce_retry
44
45
  @directory = Acme::Client::Resources::Directory.new(URI(directory), @connection_options)
45
46
  @nonces ||= []
46
47
  end
@@ -280,6 +281,12 @@ class Acme::Client
280
281
 
281
282
  def new_connection(endpoint:)
282
283
  Faraday.new(endpoint, **@connection_options) do |configuration|
284
+ if @bad_nonce_retry > 0
285
+ configuration.request(:retry,
286
+ max: @bad_nonce_retry,
287
+ methods: Faraday::Connection::METHODS,
288
+ exceptions: [Acme::Client::Error::BadNonce])
289
+ end
283
290
  yield(configuration) if block_given?
284
291
  configuration.adapter Faraday.default_adapter
285
292
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Acme
4
4
  class Client
5
- VERSION = '2.0.3'.freeze
5
+ VERSION = '2.0.4'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acme-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Barbier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-24 00:00:00.000000000 Z
11
+ date: 2019-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler