Sha256: ebb1d1312ee2f7ca7815bfe8b799bd39f3e63e697a370d98c5869000d309e6de

Contents?: true

Size: 520 Bytes

Versions: 2

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

require 'openssl'
require 'pg_export/import'

class PgExport
  module Factories
    class CipherFactory
      include Import['config']

      def encryptor
        build_cipher(:encrypt)
      end

      def decryptor
        build_cipher(:decrypt)
      end

      private

      def build_cipher(type)
        cipher = OpenSSL::Cipher.new(config.encryption_algorithm)
        cipher.public_send(type)
        cipher.key = config.encryption_key
        cipher
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pg_export-1.0.0.rc5 lib/pg_export/lib/pg_export/factories/cipher_factory.rb
pg_export-1.0.0.rc4 lib/pg_export/lib/pg_export/factories/cipher_factory.rb