class Snowden::EncryptedSearcher

Attributes

crypto[R]
index[R]
padding_size[R]
wildcard_generator[R]

Public Class Methods

new(args) click to toggle source

Creates a new search index

@param args [Hash]
  A hash that must contain the following keys:
    * :crypto - an instance of Snowden::Crypto primed with some key and
                iv. Note: the key and iv this crypto uses must match the
                ones used by the index
    * :index - a Snowden::EncryptedSearchIndex instance .
    * :wildcard_generator - an instance of Snowden::WildcardGenerator
# File lib/snowden/encrypted_searcher.rb, line 12
def initialize(args)
  @crypto             = args.fetch(:crypto)
  @index              = args.fetch(:index)
  @wildcard_generator = args.fetch(:wildcard_generator)
end

Public Instance Methods

Private Instance Methods

encrypted_values_for_key(key) click to toggle source
# File lib/snowden/encrypted_searcher.rb, line 35
def encrypted_values_for_key(key)
  encrypted_key = crypto.encrypt(key)
  index.search(encrypted_key)
end