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 +4 -4
- data/README.md +1 -1
- data/lib/kms_rails/core.rb +5 -0
- data/lib/kms_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59b22bd75675cc0973d37c1d05cc270ad708e856
|
4
|
+
data.tar.gz: f1d5963c493dde234bfe4da707c169f40bd3960b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/kms_rails/core.rb
CHANGED
@@ -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
|
|
data/lib/kms_rails/version.rb
CHANGED