attr_keyring 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/attr_keyring.rb +9 -2
- data/lib/attr_keyring/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf52bc4c9faa76f061e0023bf8bf21cfe9de59a5ff1ce608392b388957be85db
|
4
|
+
data.tar.gz: 3b5e4145a2704b00b5784b49fd949172e66629499d0eccaaf5f237b8a1828b70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf408bfc13aa86d353d345c47a08a40d04113408f3a7d20c9a7ba0e6cc347c12b5adf533fe0c250764cc0df330b283a96ee2a6db4cacff7ce61b20c07614772d
|
7
|
+
data.tar.gz: 4a38d54dbf79ad34a9b9a54bbdbc655382e4ab128209ec4f73fbcb62df46b0040519a47c394dffabc4b567e5c852a89c91ee6bfe5d35c8ed4b10dfbe1943b270
|
data/lib/attr_keyring.rb
CHANGED
@@ -68,7 +68,7 @@ module AttrKeyring
|
|
68
68
|
module InstanceMethods
|
69
69
|
private def attr_encrypt_column(attribute, value)
|
70
70
|
clear_decrypted_column_cache(attribute)
|
71
|
-
return reset_encrypted_column(attribute) unless value
|
71
|
+
return reset_encrypted_column(attribute) unless encryptable_value?(value)
|
72
72
|
|
73
73
|
value = value.to_s
|
74
74
|
|
@@ -108,7 +108,7 @@ module AttrKeyring
|
|
108
108
|
|
109
109
|
self.class.encrypted_attributes.each do |attribute|
|
110
110
|
value = public_send(attribute)
|
111
|
-
next
|
111
|
+
next unless encryptable_value?(value)
|
112
112
|
|
113
113
|
encrypted_value, _, digest = self.class.keyring.encrypt(value)
|
114
114
|
|
@@ -118,5 +118,12 @@ module AttrKeyring
|
|
118
118
|
|
119
119
|
public_send("#{self.class.keyring_column_name}=", keyring_id)
|
120
120
|
end
|
121
|
+
|
122
|
+
private def encryptable_value?(value)
|
123
|
+
return false if value.nil?
|
124
|
+
return false if value.is_a?(String) && value.empty?
|
125
|
+
|
126
|
+
true
|
127
|
+
end
|
121
128
|
end
|
122
129
|
end
|
data/lib/attr_keyring/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_keyring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
213
|
- !ruby/object:Gem::Version
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|
216
|
-
rubygems_version: 3.0.
|
216
|
+
rubygems_version: 3.0.3
|
217
217
|
signing_key:
|
218
218
|
specification_version: 4
|
219
219
|
summary: Simple encryption-at-rest plugin for ActiveRecord.
|