module Snowden

Constants

VERSION

Public Class Methods

configuration() click to toggle source

A handle to the Snowden configuration object used elsewhere in the gem

@return [Snowden::Configuration] the configuration object

# File lib/snowden.rb, line 13
def self.configuration
  @configuration ||= Snowden::Configuration.new
end
new_encrypted_index(key, iv, backend) click to toggle source

Creates a new index that will encrypt keys and values stored within it

@param key [String]

a bytestring key for the underlying encryption algorithm.

@param iv [String]

a bytestring iv for the underlying encryption algorithm.

@param backend [Snowden::Backend]

an object that implements the snowden backend protocol.

@return [Snowden::EncryptedSearchIndex]

a snowden index to store values in.
# File lib/snowden.rb, line 31
def self.new_encrypted_index(key, iv, backend)
  EncryptedSearchIndex.new(
    :crypto             => crypto_for(key, iv),
    :backend            => backend,
    :wildcard_generator => wildcard_generator,
  )
end
new_encrypted_searcher(key, iv, index) click to toggle source

Creates a new searcher for a snowden index

@param key [String]

a bytestring key for the underlying encryption algorithm.
Note: the key and iv must match the ones passed to create the index

@param iv [String]

a bytestring iv for the underlying encryption algorithm.
Note: the key and iv must match the ones passed to create the index

@param index [Snowden::EncryptedSearchIndex]

the index to search.

@return [Snowden::EncryptedSearcher]

a searcher for the index.
# File lib/snowden.rb, line 54
def self.new_encrypted_searcher(key, iv, index)
  EncryptedSearcher.new(
    :crypto             => crypto_for(key, iv),
    :index              => index,
    :wildcard_generator => wildcard_generator,
  )
end

Private Class Methods

crypto_for(key, iv) click to toggle source
# File lib/snowden.rb, line 68
def self.crypto_for(key, iv)
  Crypto.new(
    :key          => key,
    :iv           => iv,
    :cipher_spec  => configuration.cipher_spec,
    :padding_size => configuration.padding_byte_size
  )
end
wildcard_generator() click to toggle source
# File lib/snowden.rb, line 64
def self.wildcard_generator
  WildcardGenerator.new(:edit_distance => configuration.edit_distance)
end