Class: Nyauth::Encryptor
- Inherits:
-
Object
- Object
- Nyauth::Encryptor
- Includes:
- Singleton
- Defined in:
- lib/nyauth/encryptor.rb
Instance Attribute Summary collapse
-
#encryptor ⇒ Object
readonly
Returns the value of attribute encryptor.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Encryptor
constructor
A new instance of Encryptor.
Constructor Details
#initialize ⇒ Encryptor
Returns a new instance of Encryptor.
11 12 13 |
# File 'lib/nyauth/encryptor.rb', line 11 def initialize @encryptor = ::ActiveSupport::MessageEncryptor.new(Nyauth.configuration.encryption_secret, cipher: @@cipher, digest: @@digest) end |
Instance Attribute Details
#encryptor ⇒ Object (readonly)
Returns the value of attribute encryptor.
9 10 11 |
# File 'lib/nyauth/encryptor.rb', line 9 def encryptor @encryptor end |
Class Method Details
.decrypt(encrypted_message) ⇒ Object
20 21 22 |
# File 'lib/nyauth/encryptor.rb', line 20 def decrypt() instance.encryptor.decrypt_and_verify() end |
.encrypt(message) ⇒ Object
16 17 18 |
# File 'lib/nyauth/encryptor.rb', line 16 def encrypt() instance.encryptor.encrypt_and_sign() end |