lib/legion/crypt.rb in legion-crypt-0.1.0 vs lib/legion/crypt.rb in legion-crypt-0.2.0
- old
+ new
@@ -1,31 +1,29 @@
# frozen_string_literal: true
+require 'openssl'
require 'legion/crypt/version'
require 'legion/crypt/settings'
require 'rbnacl'
require 'base64'
require 'legion/crypt/box'
+require 'legion/crypt/cipher'
require 'legion/crypt/vault'
module Legion
module Crypt
class << self
- attr_reader :public_key, :sessions
- include Legion::Crypt::Box
+ attr_reader :sessions
+
+ include Legion::Crypt::Cipher
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
+ # load_keys if Dir.exist?('./settings') && File.exist?('./settings/private.key') && File.exist?('./settings/public.key')
- connect_vault
+ # connect_vault unless Legion::Settings[:crypt][:vault][:token].nil?
end
def shutdown
shutdown_renewer
close_sessions