Class: Bullion::Models::Challenge
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Bullion::Models::Challenge
- Defined in:
- lib/bullion/models/challenge.rb
Overview
ACMEv2 Challenge model
Instance Method Summary collapse
Instance Method Details
#client ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bullion/models/challenge.rb', line 31 def client challenge_class = Bullion.acme.challenge_clients.find { _1.acme_type == acme_type } unless challenge_class raise Bullion::Acme::Errors::UnsupportedChallengeType, "Challenge type '#{acme_type}' is not supported by Bullion." end challenge_class.new(self) end |
#identifier ⇒ Object
16 17 18 |
# File 'lib/bullion/models/challenge.rb', line 16 def identifier .identifier["value"] end |
#init_values ⇒ Object
20 21 22 23 |
# File 'lib/bullion/models/challenge.rb', line 20 def init_values self.expires ||= Time.now + (60 * 60) self.token ||= SecureRandom.alphanumeric(48) end |
#thumbprint ⇒ Object
25 26 27 28 29 |
# File 'lib/bullion/models/challenge.rb', line 25 def thumbprint cipher = OpenSSL::Digest.new("SHA256") digest = cipher.digest(lexicographically_ordered_public_key.to_json) Base64.urlsafe_encode64(digest).sub(/[\s=]*\z/, "") end |