Class: Auther::Cipher
- Inherits:
-
Object
- Object
- Auther::Cipher
- Defined in:
- lib/auther/cipher.rb
Instance Method Summary collapse
- #decrypt(data) ⇒ Object
- #encrypt(data) ⇒ Object
-
#initialize(secret) ⇒ Cipher
constructor
A new instance of Cipher.
Constructor Details
#initialize(secret) ⇒ Cipher
Returns a new instance of Cipher.
3 4 5 |
# File 'lib/auther/cipher.rb', line 3 def initialize secret @encryptor = ActiveSupport::MessageEncryptor.new secret end |
Instance Method Details
#decrypt(data) ⇒ Object
11 12 13 |
# File 'lib/auther/cipher.rb', line 11 def decrypt data encryptor.decrypt_and_verify data end |
#encrypt(data) ⇒ Object
7 8 9 |
# File 'lib/auther/cipher.rb', line 7 def encrypt data encryptor.encrypt_and_sign data end |