Class: ConfidentialInfoManager::JSON
- Defined in:
- lib/confidential_info_manager/json.rb
Constant Summary
Constants inherited from Core
Core::ITERATOR_COUNT, Core::RANDOM_BYTES
Instance Method Summary collapse
-
#load(file_path) ⇒ Hash
JSON file load.
-
#save(secret_data, file_path) ⇒ Object
JSON file save.
Methods inherited from Core
#decrypt, #decrypt_only_value, #encrypt, #encrypt_only_value, generate_salt, #initialize
Constructor Details
This class inherits a constructor from ConfidentialInfoManager::Core
Instance Method Details
#load(file_path) ⇒ Hash
JSON file load
20 21 22 |
# File 'lib/confidential_info_manager/json.rb', line 20 def load(file_path) decrypt_only_value(::JSON.parse(File.read(file_path), { symbolize_names: true })) end |
#save(secret_data, file_path) ⇒ Object
JSON file save
12 13 14 |
# File 'lib/confidential_info_manager/json.rb', line 12 def save(secret_data, file_path) File.open(file_path, "w") { |file| file.write(::JSON.pretty_generate(encrypt_only_value(secret_data))) } end |