Sha256: 44deec52f6f4746fed1bd01a0926660d8b65f0159575bb9e99ba863b9aa6b661

Contents?: true

Size: 642 Bytes

Versions: 1

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true

require 'pg_export'
require 'pg_export/lib/pg_export/value_objects/result'

class PgExport
  module Operations
    class DecryptDump
      def initialize(cipher_factory:)
        @cipher_factory = cipher_factory
      end

      def name
        :decrypt_dump
      end

      def call(dump:)
        dump.decrypt(cipher_factory: cipher_factory)

        ValueObjects::Success.new(dump: dump)
      rescue OpenSSL::Cipher::CipherError => e
        ValueObjects::Failure.new(message: "Problem decrypting dump file: #{e}. Try again.")
      end

      private

      attr_reader :cipher_factory
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pg_export-1.0.0.rc6 lib/pg_export/lib/pg_export/operations/decrypt_dump.rb