Sha256: a322c9a5b1312f7e14aed84dc7c31584dfc2cec0587d96596f523cad1a99eb01

Contents?: true

Size: 652 Bytes

Versions: 1

Compression:

Stored size: 652 Bytes

Contents

module LetsCert

  # Chain file plugin
  # @author Sylvain Daubert
  class ChainFile < OpenSSLIOPlugin
    include FileIOPluginMixin

    # @return [Hash] always get +true+ for +:chain+ key
    def persisted
      @persisted ||= { chain: true }
    end

    # @return [Hash]
    def load_from_content(content)
      chain = []
      split_pems(content) do |pem|
        chain << load_cert(pem)
      end
      { chain: chain }
    end

    # Save chain.
    # @param [Hash] data
    # @return [void]
    def save(data)
      save_to_file(data[:chain].map { |c| dump_cert(c) }.join)
    end

  end

  IOPlugin.register(ChainFile, 'chain.pem', :pem)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
letscert-0.4.2 lib/letscert/io_plugins/chain_file.rb