Class: EzCrypter::DefaultWorker
- Inherits:
-
Object
- Object
- EzCrypter::DefaultWorker
- Defined in:
- lib/ezcrypter/default_worker.rb
Overview
The default worker is one that is used when no other worker is specified or the specified worker does not exist. It uses the EzCrypto library and get’s its secret key from configatron.default_secret_key
Instance Method Summary collapse
-
#ez_decrypt(x) ⇒ Object
Decrypts a string using the EzCrypto library and the secret key found in configatron.default_secret_key.
-
#ez_decrypt64(x) ⇒ Object
Decrypts a string using the EzCrypto library and the secret key found in configatron.default_secret_key.
-
#ez_encrypt(x) ⇒ Object
Encrypts a string using the EzCrypto library and the secret key found in configatron.default_secret_key.
-
#ez_encrypt64(x) ⇒ Object
Encrypts a string using the EzCrypto library and the secret key found in configatron.default_secret_key.
-
#initialize(options = {}) ⇒ DefaultWorker
constructor
A new instance of DefaultWorker.
Constructor Details
#initialize(options = {}) ⇒ DefaultWorker
Returns a new instance of DefaultWorker.
7 8 9 10 |
# File 'lib/ezcrypter/default_worker.rb', line 7 def initialize( = {}) = {:secret_key => String.randomize_full_ascii(40), :salt => "_eat_oreos_and_be_happy"}.merge() @aes_key = EzCrypto::Key.with_password([:secret_key], [:salt]) end |
Instance Method Details
#ez_decrypt(x) ⇒ Object
Decrypts a string using the EzCrypto library and the secret key found in configatron.default_secret_key
20 21 22 |
# File 'lib/ezcrypter/default_worker.rb', line 20 def ez_decrypt(x) @aes_key.decrypt(x) end |
#ez_decrypt64(x) ⇒ Object
Decrypts a string using the EzCrypto library and the secret key found in configatron.default_secret_key
32 33 34 |
# File 'lib/ezcrypter/default_worker.rb', line 32 def ez_decrypt64(x) @aes_key.decrypt64(x) end |
#ez_encrypt(x) ⇒ Object
Encrypts a string using the EzCrypto library and the secret key found in configatron.default_secret_key
14 15 16 |
# File 'lib/ezcrypter/default_worker.rb', line 14 def ez_encrypt(x) @aes_key.encrypt(x) end |
#ez_encrypt64(x) ⇒ Object
Encrypts a string using the EzCrypto library and the secret key found in configatron.default_secret_key
26 27 28 |
# File 'lib/ezcrypter/default_worker.rb', line 26 def ez_encrypt64(x) @aes_key.encrypt64(x) end |