encrypt_column 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/encrypt_column/decrypt.rb +2 -2
- data/lib/encrypt_column/encrypt.rb +2 -2
- data/lib/encrypt_column/hashed.rb +2 -2
- data/lib/encrypt_column/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: 6526d7cdcee7b1990853ae5eac6e332b50b1c4a1
|
4
|
+
data.tar.gz: a7bbbfcaf6587c768d2f9f29cdeb4ab68939f885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac1cb1754f319e1b9fcf5ee5f411280f3e0a135729f263094a1717ba2bfb13cc1ab5613b7243510d7190fddfc3d8506b83ed298fbb79aa7fe7c7c35188355088
|
7
|
+
data.tar.gz: df8415142ff9134cc9a0daa062508ec7a7b6d51bfa33a113a31c849b4960573d2cd9974f5740a8e20023451a195668270117ec5f414146c7b564cd0033857cb1
|
data/.gitignore
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Decrypt
|
2
2
|
def self.cipher(ciphertext)
|
3
|
-
raise 'Encryption Key Config Missing' unless ENV['
|
4
|
-
ActiveSupport::MessageEncryptor.new(ENV['
|
3
|
+
raise 'Encryption Key Config Missing' unless ENV['ENCRYPTION_KEY'].present?
|
4
|
+
ActiveSupport::MessageEncryptor.new(ENV['ENCRYPTION_KEY']).decrypt_and_verify(ciphertext)
|
5
5
|
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
6
6
|
return ciphertext
|
7
7
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Encrypt
|
2
2
|
def self.text(plaintext)
|
3
|
-
return raise 'Missing Encryption Key Config' if ENV['
|
4
|
-
ActiveSupport::MessageEncryptor.new(ENV['
|
3
|
+
return raise 'Missing Encryption Key Config' if ENV['ENCRYPTION_KEY'].nil?
|
4
|
+
ActiveSupport::MessageEncryptor.new(ENV['ENCRYPTION_KEY']).encrypt_and_sign(plaintext)
|
5
5
|
end
|
6
6
|
end
|
@@ -3,7 +3,7 @@ require 'digest'
|
|
3
3
|
class Hashed
|
4
4
|
def self.val(plaintext)
|
5
5
|
return nil if plaintext.nil?
|
6
|
-
return raise 'Missing Hash Salt Config' if ENV['
|
7
|
-
Digest::SHA2.hexdigest(ENV['
|
6
|
+
return raise 'Missing Hash Salt Config' if ENV['HASH_SALT'].nil?
|
7
|
+
Digest::SHA2.hexdigest(ENV['HASH_SALT'] + plaintext.to_s)
|
8
8
|
end
|
9
9
|
end
|