summaryrefslogtreecommitdiff
path: root/lib/nickserver/hkp/fetch_key_info.rb
blob: b23af1590f550ec565b3d1a0b28c4c522e17229b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
# used to fetch an array of KeyInfo objects that match the given uid.
#

module Nickserver; module Hkp
  class FetchKeyInfo

    def initialize(adapter)
      @adapter = adapter
    end

    def search(uid, &block)
      # in practice, exact=on seems to have no effect
      params = {op: 'vindex', search: uid, exact: 'on', options: 'mr', fingerprint: 'on'}
      adapter.get(Config.hkp_url, query: params) do |status, response|
        parser = ParseKeyInfo.new status, response
        yield parser.status_for(uid), parser.response_for(uid)
      end
    end

    protected
    attr_reader :adapter

  end

end; end