Sha256: 3acc8f21c22f8e59bb0efa01569e724828ae0e405c33b3bc2348b438dcecbfa6

Contents?: true

Size: 962 Bytes

Versions: 8

Compression:

Stored size: 962 Bytes

Contents

module Mack
  module Utils # :nodoc:
    module Crypt # :nodoc:
      # 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 
      # it's secret key from configatron.default_secret_key
      class DefaultWorker
        
        def initialize
          @aes_key = EzCrypto::Key.with_password(configatron.retrieve(:default_secret_key, String.randomize(40)), '_mackery_')
        end
        
        # Encrypts a string using the EzCrypto library and the secret key found in
        # configatron.default_secret_key
        def encrypt(x)
          @aes_key.encrypt(x)
        end
        
        # Decrypts a string using the EzCrypto library and the secret key found in
        # configatron.default_secret_key
        def decrypt(x)
          @aes_key.decrypt(x)
        end
        
      end # DefaultWorker
    end # Crypt
  end # Utils
end # Mack

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mack-encryption-0.8.3 lib/mack-encryption/default_worker.rb
mack-encryption-0.8.2 lib/mack-encryption/default_worker.rb
mack-encryption-0.8.0 lib/mack-encryption/default_worker.rb
mack-encryption-0.8.0.1 lib/mack-encryption/default_worker.rb
mack-encryption-0.8.0.101 lib/mack-encryption/default_worker.rb
mack-encryption-0.8.0.2 lib/mack-encryption/default_worker.rb
mack-encryption-0.8.1 lib/mack-encryption/default_worker.rb
mack-encryption-0.8.3.1 lib/mack-encryption/default_worker.rb