crypt_keeper 1.0.0.beta1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crypt_keeper/model.rb +3 -2
- data/lib/crypt_keeper/version.rb +1 -1
- data/spec/crypt_keeper/model_spec.rb +8 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8256a26cb233344e7a8e71791aa528d931657317
|
4
|
+
data.tar.gz: 1ac4af01a5fee7957b611d967c6991bdab5a73d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9e9eecfd9eb95129d439624c4664890474fe9360b2a5097beb66f60b1e05f479192b9300530a703c0d38d6945c56c4def5c1a108b5d79099abba7fa5fd6dc35
|
7
|
+
data.tar.gz: c41b3baa8a72c0114702162fcdb857b145bdd668b7139cb391d600f48fa0888fa9a152b190815a00526b7a093ac636366df657b38b371e47893c7c85804ffb36
|
data/lib/crypt_keeper/model.rb
CHANGED
@@ -10,8 +10,9 @@ module CryptKeeper
|
|
10
10
|
def ensure_valid_field!(field)
|
11
11
|
if self.class.columns_hash["#{field}"].nil?
|
12
12
|
raise ArgumentError, "Column :#{field} does not exist"
|
13
|
-
elsif self.class.columns_hash["#{field}"].type
|
14
|
-
raise ArgumentError, "Column :#{field} must be of type 'text'
|
13
|
+
elsif !%i(text binary).include?(self.class.columns_hash["#{field}"].type)
|
14
|
+
raise ArgumentError, "Column :#{field} must be of type 'text' or 'binary' \
|
15
|
+
to be used for encryption"
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
data/lib/crypt_keeper/version.rb
CHANGED
@@ -24,8 +24,14 @@ describe CryptKeeper::Model do
|
|
24
24
|
expect { subject.new.save }.to raise_error(ArgumentError, msg)
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
28
|
-
|
27
|
+
it "allows binary as a valid type" do
|
28
|
+
subject.crypt_keeper :storage, encryptor: :fake_encryptor
|
29
|
+
allow(subject.columns_hash['storage']).to receive(:type).and_return(:binary)
|
30
|
+
expect(subject.new.save).to be_truthy
|
31
|
+
end
|
32
|
+
|
33
|
+
it "raises an exception for non text or binary fields" do
|
34
|
+
msg = "Column :name must be of type 'text' or 'binary' to be used for encryption"
|
29
35
|
subject.crypt_keeper :name, encryptor: :fake_encryptor
|
30
36
|
expect { subject.new.save }.to raise_error(ArgumentError, msg)
|
31
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crypt_keeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Mazzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -277,12 +277,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
277
277
|
version: '0'
|
278
278
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
279
279
|
requirements:
|
280
|
-
- - "
|
280
|
+
- - ">="
|
281
281
|
- !ruby/object:Gem::Version
|
282
|
-
version:
|
282
|
+
version: '0'
|
283
283
|
requirements: []
|
284
284
|
rubyforge_project:
|
285
|
-
rubygems_version: 2.
|
285
|
+
rubygems_version: 2.6.11
|
286
286
|
signing_key:
|
287
287
|
specification_version: 4
|
288
288
|
summary: Transparent ActiveRecord encryption
|