Module: Legion::Crypt

Extended by:
Cipher
Includes:
Vault
Defined in:
lib/legion/crypt.rb,
lib/legion/crypt/vault.rb,
lib/legion/crypt/cipher.rb,
lib/legion/crypt/version.rb,
lib/legion/crypt/settings.rb,
lib/legion/crypt/vault_renewer.rb,
lib/legion/crypt/cluster_secret.rb

Defined Under Namespace

Modules: Cipher, ClusterSecret, Settings, Vault

Constant Summary collapse

VERSION =
'1.2.0'

Class Attribute Summary collapse

Attributes included from Vault

#sessions

Class Method Summary collapse

Methods included from Cipher

decrypt, decrypt_from_keypair, encrypt, encrypt_from_keypair, private_key, public_key

Methods included from ClusterSecret

#cluster_secret_timeout, #cs, #find_cluster_secret, #force_cluster_secret, #from_settings, #from_transport, #from_vault, #generate_secure_random, #only_member?, #push_cs_to_vault, #secret_length, #set_cluster_secret, #settings_push_vault, #validate_hex

Methods included from Vault

#add_session, #close_session, #close_sessions, #connect_vault, #exist?, #get, #read, #renew_session, #renew_sessions, #settings, #shutdown_renewer, #vault_exists?, #write

Class Attribute Details

.sessionsObject (readonly)

Returns the value of attribute sessions.



10
11
12
# File 'lib/legion/crypt.rb', line 10

def sessions
  @sessions
end

Class Method Details

.settingsObject



26
27
28
29
30
31
32
# File 'lib/legion/crypt.rb', line 26

def settings
  if Legion.const_defined?('Settings')
    Legion::Settings[:crypt]
  else
    Legion::Crypt::Settings.default
  end
end

.shutdownObject



34
35
36
37
# File 'lib/legion/crypt.rb', line 34

def shutdown
  shutdown_renewer
  close_sessions
end

.startObject



19
20
21
22
23
24
# File 'lib/legion/crypt.rb', line 19

def start
  Legion::Logging.debug 'Legion::Crypt is running start'
  ::File.write('./legionio.key', private_key) if settings[:save_private_key]

  connect_vault unless settings[:vault][:token].nil?
end