Last active
November 7, 2019 10:11
-
-
Save shmdt/1889d769b90f38bbc07fdab6599f20dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Encryptable | |
def encrypt(key) | |
crypt.encrypt_and_sign(key) | |
end | |
def decrypt(key) | |
crypt.decrypt_and_verify(key) | |
end | |
private | |
def crypt | |
ActiveSupport::MessageEncryptor.new(Rails.application.credentials[:encryption_key]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment