Sha256: de8177d65e5f3e5483a49206b314e7333ada6f0b963c0752fb3f36698352b71b

Contents?: true

Size: 516 Bytes

Versions: 3

Compression:

Stored size: 516 Bytes

Contents

module Minke
  module Encryption
    class KeyLocator
      def initialize(key_store_path)
        @key_store_path = key_store_path
      end

      def locate_key fingerprint
        Dir.entries(@key_store_path).each do |f|
          begin
            full_path = "#{@key_store_path}/#{f}"
            key = SSHKey.new(File.read(full_path))

            return full_path if key.fingerprint == fingerprint
          rescue
            puts "failed to read #{f}"
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minke-1.5.2 lib/minke/encryption/key_locator.rb
minke-1.5.1 lib/minke/encryption/key_locator.rb
minke-1.5.0 lib/minke/encryption/key_locator.rb