Sha256: a9c7c4b11c1e0c5765e1bc4b387bc845011cd0106583ee9f4c037a36a86859ed

Contents?: true

Size: 844 Bytes

Versions: 5

Compression:

Stored size: 844 Bytes

Contents

module CryptKeeper
  module Helper
    module SQL
      private

      # Private: Sanitize an sql query and then execute it
      def escape_and_execute_sql(query)
        query = ::ActiveRecord::Base.send :sanitize_sql_array, query
        ::ActiveRecord::Base.connection.execute(query).first
      end
    end

    module DigestPassphrase
      def digest_passphrase(key, salt)
        raise ArgumentError.new("Missing :key") if key.blank?
        raise ArgumentError.new("Missing :salt") if salt.blank?
        ::Armor.digest(key, salt)
      end
    end

    module Serializer
      def dump(value)
        if value.blank?
          value
        else
          encrypt(value)
        end
      end

      def load(value)
        if value.blank?
          value
        else
          decrypt(value)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
crypt_keeper-0.18.0 lib/crypt_keeper/helper.rb
crypt_keeper-0.17.0 lib/crypt_keeper/helper.rb
crypt_keeper-0.16.1 lib/crypt_keeper/helper.rb
crypt_keeper-0.16.0 lib/crypt_keeper/helper.rb
crypt_keeper-0.16.0.pre lib/crypt_keeper/helper.rb