Class: Gitlab::LetsEncrypt::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/lets_encrypt/order.rb

Instance Method Summary collapse

Constructor Details

#initialize(acme_order) ⇒ Order

Returns a new instance of Order.


6
7
8
# File 'lib/gitlab/lets_encrypt/order.rb', line 6

def initialize(acme_order)
  @acme_order = acme_order
end

Instance Method Details

#challenge_errorObject


24
25
26
# File 'lib/gitlab/lets_encrypt/order.rb', line 24

def challenge_error
  authorization.challenges.first&.error
end

#new_challengeObject


10
11
12
13
# File 'lib/gitlab/lets_encrypt/order.rb', line 10

def new_challenge
  challenge = authorization.http
  ::Gitlab::LetsEncrypt::Challenge.new(challenge)
end

#request_certificate(domain:, private_key:) ⇒ Object


15
16
17
18
19
20
21
22
# File 'lib/gitlab/lets_encrypt/order.rb', line 15

def request_certificate(domain:, private_key:)
  csr = ::Acme::Client::CertificateRequest.new(
    private_key: OpenSSL::PKey.read(private_key),
    subject: { common_name: domain }
  )

  acme_order.finalize(csr: csr)
end