kms_rails 0.0.4 → 0.0.5

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: cac0957a6a31fda032ccba360d3bf44fba646bc9
4
- data.tar.gz: 722181fc0cd93bc5eeea994b95f569cf15823597
3
+ metadata.gz: 59b22bd75675cc0973d37c1d05cc270ad708e856
4
+ data.tar.gz: f1d5963c493dde234bfe4da707c169f40bd3960b
5
5
  SHA512:
6
- metadata.gz: 794526a33a35314c2dc76c82b7c3349d20593988e37ad83f15de924bc34cb29d99ebf469b3983d12c80bfd9f4fcc3b4516097c96391d4dc15c6262d52ee8ccdb
7
- data.tar.gz: 4ab31886dceec3369c723ed4e28f7bfdc2d64ab95cf82bb03322cee11fd4f83a7008deb46b0c4228998381d6561ce442773ff90e04c6188009ef61d49a85387a
6
+ metadata.gz: c44f8efcaf9d0a5bff949cbd7ae94521a2d2e962008c27c3e491cda9273a7653a9e8489d4c3c6d19cf28729a196c2a540a4e7e93f9816572a1a6efa029afd1c9
7
+ data.tar.gz: edb200a86655ac83d9d05f1c485d5cdef3c58250e9092a231d18098a127a6a8a06369751b41c2f25f76cc2705c7f6c80741a8e5ddad936f5a55c1aeb67c4cc96
data/README.md CHANGED
@@ -76,7 +76,7 @@ The encryption is automatically reversed when the job is deserialized.
76
76
 
77
77
  ### Already encrypted parameters
78
78
 
79
- You also have the option of passing the value from your ActiveRecord encrypted field directly into the ActiveJob. If you do this, the value will not be encrypted twice.
79
+ You also have the option of passing the value from your ActiveRecord encrypted field directly into the ActiveJob. If you do this, the value will not be encrypted twice. However, if you do this, you must ensure that the encryption key ID is the same for both the ActiveRecord attribute and ActiveJob parameter.
80
80
 
81
81
  For instance, if you want to enqueue an encrypted value into a job on a node that cannot decrypt that value, you could do something like this;
82
82
 
@@ -30,10 +30,12 @@ module KmsRails
30
30
  end
31
31
 
32
32
  def encrypt64(data)
33
+ return nil if data.nil?
33
34
  self.class.to64(encrypt(data))
34
35
  end
35
36
 
36
37
  def decrypt(data_obj)
38
+ return nil if data_obj.nil?
37
39
  decrypt_attr(
38
40
  data_obj['blob'],
39
41
  aws_decrypt_key(data_obj['key']),
@@ -42,6 +44,7 @@ module KmsRails
42
44
  end
43
45
 
44
46
  def decrypt64(data_obj)
47
+ return nil if data_obj.nil?
45
48
  decrypt( self.class.from64(data_obj) )
46
49
  end
47
50
 
@@ -66,10 +69,12 @@ module KmsRails
66
69
  end
67
70
 
68
71
  def self.to64(data_obj)
72
+ return nil if data_obj.nil?
69
73
  data_obj.map { |k,v| [k, Base64.strict_encode64(v)] }.to_h
70
74
  end
71
75
 
72
76
  def self.from64(data_obj)
77
+ return nil if data_obj.nil?
73
78
  data_obj.map { |k,v| [k, Base64.strict_decode64(v)] }.to_h
74
79
  end
75
80
 
@@ -1,3 +1,3 @@
1
1
  module KmsRails
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
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.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Tyndall