attribute_queryable_encrypted 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,7 @@ require 'active_support/concern'
2
2
  require 'active_support/core_ext/array/extract_options'
3
3
  require 'active_support/core_ext/class/attribute'
4
4
  require 'digest'
5
+ require 'base64'
5
6
  require 'attribute_queryable_encrypted/core_ext/lower_higher'
6
7
  require 'attribute_queryable_encrypted/core_ext/prefix'
7
8
  require 'attribute_queryable_encrypted/core_ext/stretch_digest'
@@ -23,7 +23,7 @@ module AttributeQueryableEncrypted
23
23
 
24
24
  find_by_method = proc do |original_value|
25
25
  send("find_all_by_#{[options[:prefix], attribute].join('_')}", original_value.prefix(options[:length])).detect do |result|
26
- result[attribute] === original_value
26
+ result.send(attribute).match original_value
27
27
  end
28
28
  end
29
29
 
@@ -67,7 +67,8 @@ module AttributeQueryableEncrypted
67
67
 
68
68
  def prefix_encrypt(value, options)
69
69
  prefix_encrypted_value = value.prefix(options[:length]).stretch_digest(options)
70
- prefix_encrypted_value = [prefix_encrypted_value].pack("m*") if options[:encode]
70
+ # prefix_encrypted_value = [prefix_encrypted_value].pack("m*") if options[:encode]
71
+ prefix_encrypted_value = Base64.strict_encode64(prefix_encrypted_value) if options[:encode]
71
72
  prefix_encrypted_value
72
73
  end
73
74
  end
@@ -1,3 +1,3 @@
1
1
  module AttributeQueryableEncrypted
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -6,7 +6,7 @@ ActiveRecord::Base.establish_connection(:adapter => "sqlite3",
6
6
  :database => File.dirname(__FILE__) + "/db/attribute_queryable_encrypted.sqlite3")
7
7
 
8
8
  ActiveRecord::Base.logger = Logger.new(STDOUT)
9
- ActiveRecord::Base.logger.level = 3
9
+ ActiveRecord::Base.logger.level = 1
10
10
 
11
11
  load File.dirname(__FILE__) + '/db/schema.rb'
12
12
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 3
9
- version: 0.0.3
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Scott Burton