class Localhost::Authority

def self.list(path = State.path)

@yields [Authority] Each certificate authority in the directory.
@parameter path [String] The path to the directory containing the certificate authorities.

List all certificate authorities in the given directory.
def self.list(path = State.path)
	return to_enum(:list, path) unless block_given?
	
	Dir.glob("*.crt", base: path) do |certificate_path|
		hostname = File.basename(certificate_path, ".crt")
		
		authority = self.new(hostname, path: path)
		
		if authority.load
			yield authority
		end
	end
end