kms_rails 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/kms_rails/active_record.rb +4 -3
- data/lib/kms_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2259bfaae2b2ec8806502f90301a83669ecb3ac1
|
4
|
+
data.tar.gz: 5e8e6a38a4c5bdcc707f3e793a4ca596d5ad910f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60537ee80c93810d3286fe73d312382d6d4b5f21c92793e215b76d72b50104277050b6e73d80118aef73d0f3b1a5ae68d3f3facd1105db504c0eb1659ebef414
|
7
|
+
data.tar.gz: 1e4cfe01b9ed84cd44560e1d7b27110ad5ec7c097be408d5e46f22aedd32aeb37b17a883851df3a9656c6f3cff4164bd271130ae70e8b7f03d4eb03bd747ce8b
|
data/README.md
CHANGED
@@ -117,7 +117,7 @@ or by using the documented AWS environmental variables.
|
|
117
117
|
|
118
118
|
## Test Mode
|
119
119
|
|
120
|
-
A basic fake implementation of `Aws::KMS::Client` has been written, allowing kms_rails functionality to be used in test environments without making any web requests. The fake implementation emulates the functionality of the two API calls kms_rails issues to AWS and performs fake encryption (the key is 'encrypted' by reversing it).
|
120
|
+
A basic fake implementation of `Aws::KMS::Client` has been written, allowing kms_rails functionality to be used in test environments without making any web requests. The fake implementation emulates the functionality of the two API calls kms_rails issues to AWS and performs fake encryption (the key is 'encrypted' by reversing it).
|
121
121
|
|
122
122
|
You can enable it in your Rails initializers with the following
|
123
123
|
```ruby
|
@@ -14,11 +14,10 @@ module KmsRails
|
|
14
14
|
include InstanceMethods
|
15
15
|
|
16
16
|
real_field = "#{field}_enc"
|
17
|
-
|
18
|
-
|
19
|
-
enc = Core.new(key_id: key_id, msgpack: msgpack, context_key: context_key, context_value: context_value)
|
17
|
+
enc = Core.new(key_id: key_id, msgpack: msgpack, context_key: context_key, context_value: context_value)
|
20
18
|
|
21
19
|
define_method "#{field}=" do |data|
|
20
|
+
raise RuntimeError, "Field '#{field}' must not be a real column, '#{real_field}' is the real column" if self.class.column_names.include?(field.to_s)
|
22
21
|
raise RuntimeError, "Field '#{real_field}' must exist to store encrypted data" unless self.class.column_names.include?(real_field)
|
23
22
|
|
24
23
|
if data.blank? # Just set to nil if nil
|
@@ -35,11 +34,13 @@ module KmsRails
|
|
35
34
|
end
|
36
35
|
|
37
36
|
define_method "#{real_field}" do
|
37
|
+
raise RuntimeError, "Field '#{field}' must not be a real column, '#{real_field}' is the real column" if self.class.column_names.include?(field.to_s)
|
38
38
|
raise RuntimeError, "Field '#{real_field}' must exist to retrieve encrypted data" unless self.class.column_names.include?(real_field)
|
39
39
|
Core.to64( get_hash(field) )
|
40
40
|
end
|
41
41
|
|
42
42
|
define_method "#{field}" do
|
43
|
+
raise RuntimeError, "Field '#{field}' must not be a real column, '#{real_field}' is the real column" if self.class.column_names.include?(field.to_s)
|
43
44
|
raise RuntimeError, "Field '#{real_field}' must exist to retrieve decrypted data" unless self.class.column_names.include?(real_field)
|
44
45
|
|
45
46
|
hash = get_hash(field)
|
data/lib/kms_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kms_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ash Tyndall
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|