Class: SafeDb::Branch

Inherits:
Object
  • Object
show all
Defined in:
lib/model/branch.rb

Overview

The shell can access the 152 characters of crypt and salt text that was set (exported) at the beginning when the shell woke up and typically executed its .bash_aliases script.

Class Method Summary collapse

Class Method Details

.to_tokenObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/model/branch.rb', line 10

def self.to_token()

  raw_env_var_value = ENV[Indices::TOKEN_VARIABLE_NAME]
  raise_token_error( Indices::TOKEN_VARIABLE_NAME, "not present") unless raw_env_var_value

  env_var_value = raw_env_var_value.strip
  raise_token_error( Indices::TOKEN_VARIABLE_NAME, "consists only of whitespace") if raw_env_var_value.empty?

  size_msg = "length should contain exactly #{Indices::TOKEN_VARIABLE_SIZE} characters"
  raise_token_error( Indices::TOKEN_VARIABLE_NAME, size_msg ) unless env_var_value.length == Indices::TOKEN_VARIABLE_SIZE

  return env_var_value

end