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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c32a6946896948a35897141c29535c1138a5a788
4
- data.tar.gz: 72b96ea275fc245e92b9a0ad2c18bb332e669689
3
+ metadata.gz: 2259bfaae2b2ec8806502f90301a83669ecb3ac1
4
+ data.tar.gz: 5e8e6a38a4c5bdcc707f3e793a4ca596d5ad910f
5
5
  SHA512:
6
- metadata.gz: f6708eb1f9ef4d19312eee938c41367d55d1e6cc5239dcac3912f696166c6d4c4e08fcfe374fabe47b41623965692b49755479fd5c06dc2114a3322e2d8de889
7
- data.tar.gz: 8632b1a8e2d59e4b62768a823a409eb2cfff9914fadc8013fa078009c30c17e34b3b9551da1a2c6d90d2ac8275149526e1f858fd044bc7e7b95fbee858888c08
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). At this time, the fake implementation does not support contexts.
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
- raise RuntimeError, "Field '#{field}' must not be a real column, '#{real_field}' is the real column" if self.column_names.include?(field.to_s)
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)
@@ -1,3 +1,3 @@
1
1
  module KmsRails
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
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.9
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-01-30 00:00:00.000000000 Z
12
+ date: 2018-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord