Class: SafeDb::Open
Overview
The open use case allows us to add (put), subtract (del)ete, change (update) and list the secrets within an envelope (outer path) at a given position (inner path), whether that envelope exists or not.
Also see the reopen command which only differs from open in that it fails if the path specified does not exist in either the sealed or session envelopes.
The Open Path Parameter
Open must be called with a single path parameter with an optional single colon separating the outer (path to envelope) from the inner (path within envelope).
Open (Path) Pre-Conditions
The domain must have been initialized on this machine stating the path to the base folder that contains the key and crypt material.
To open a path these conditions must be true.
-
the shell session token must have been set at the session beginning
-
a successful
logincommand must have been issued -
the external drive (eg usb key) must be configured and accessible
Observable Value
The observable value delivered by [open] boils down to
-
an openkey (eg asdfx1234) and corresponding open encryption key
-
open encryption key written to
~/.safedb.net/open.keys/asdfx1234.x.txt -
the opened path (ending in filename) written to session.cache base in [safe]
-
the INI string (were the file to be decrypted) would look like the below
[session] base.path = home/wifi
Constant Summary
Constants inherited from UseCase
UseCase::APP_DIR_NAME, UseCase::COMMANDMENT, UseCase::ENV_VAR_KEY_NAME, UseCase::ENV_VAR_PREFIX_A, UseCase::ENV_VAR_PREFIX_B, UseCase::FILE_CONTENT_KEY, UseCase::FILE_KEY_PREFIX, UseCase::FILE_NAME_KEY
Instance Attribute Summary collapse
-
#env_path ⇒ Object
writeonly
The two paths that have been posted to the open command.
-
#key_path ⇒ Object
writeonly
The two paths that have been posted to the open command.
Attributes inherited from UseCase
Instance Method Summary collapse
Methods inherited from UseCase
#check_post_conditions, #check_pre_conditions, #cleanup, #config_directory, #config_file, #flow_of_events, #get_master_database, #initialize, #post_validation, #pre_validation
Constructor Details
This class inherits a constructor from SafeDb::UseCase
Instance Attribute Details
#env_path=(value) ⇒ Object (writeonly)
The two paths that have been posted to the open command. First is a relative path to the obfuscated envelope and then the path in envelope to the point of interest.
47 48 49 |
# File 'lib/usecase/open.rb', line 47 def env_path=(value) @env_path = value end |
#key_path=(value) ⇒ Object (writeonly)
The two paths that have been posted to the open command. First is a relative path to the obfuscated envelope and then the path in envelope to the point of interest.
47 48 49 |
# File 'lib/usecase/open.rb', line 47 def key_path=(value) @key_path = value end |
Instance Method Details
#execute ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/usecase/open.rb', line 49 def execute return unless ops_key_exists? master_db = KeyApi.read_master_db() master_db[ ENV_PATH ] = @env_path master_db[ KEY_PATH ] = @key_path KeyApi.write_master_db( create_header(), master_db ) # Show the mini dictionary at the opened chapter and verse location # More work is needed when for when only the chapter is opened in # which case we should show the list of verses and perhaps the count # of key value pairs each verse contains. Show.new.flow_of_events end |