# frozen_string_literal: true require 'legion/crypt/version' require 'legion/crypt/settings' require 'rbnacl' require 'base64' require 'legion/crypt/box' require 'legion/crypt/vault' module Legion module Crypt class << self attr_reader :public_key, :sessions include Legion::Crypt::Box include Legion::Crypt::Vault if Legion::Settings[:crypt][:vault][:enabled] def start Legion::Logging.debug 'Legion::Crypt is running start' if Dir.exist?('./settings') && File.exist?('./settings/private.key') && File.exist?('./settings/public.key') load_keys else delete_keys if Dir.exist? './settings' create_keys end connect_vault end def shutdown shutdown_renewer close_sessions end end end end