Sha256: 5590d8867db9acb5fe26856f3ec6c22fb7a36c282c208093874a812a390d8864
Contents?: true
Size: 1014 Bytes
Versions: 9
Compression:
Stored size: 1014 Bytes
Contents
class Acme::Client::Resources::Challenges::Base attr_reader :client, :status, :uri, :token, :error def initialize(client, attributes) @client = client assign_attributes(attributes) end def verify_status response = @client.connection.get(@uri) assign_attributes(response.body) @error = response.body['error'] status end def request_verification response = @client.connection.post(@uri, resource: 'challenge', type: challenge_type, keyAuthorization: authorization_key) response.success? end def to_h { 'token' => token, 'uri' => uri, 'type' => challenge_type } end private def challenge_type self.class::CHALLENGE_TYPE end def authorization_key "#{token}.#{crypto.thumbprint}" end def assign_attributes(attributes) @status = attributes.fetch('status', 'pending') @uri = attributes.fetch('uri') @token = attributes.fetch('token') end def crypto @crypto ||= Acme::Client::Crypto.new(@client.private_key) end end
Version data entries
9 entries across 9 versions & 1 rubygems