Class: EJSONWrapper::DecryptPrivateKeyWithKMS
- Inherits:
-
Object
- Object
- EJSONWrapper::DecryptPrivateKeyWithKMS
- Defined in:
- lib/ejson_wrapper/decrypt_private_key_with_kms.rb
Constant Summary collapse
- KEY =
'_private_key_enc'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(*args) ⇒ Object
8 9 10 |
# File 'lib/ejson_wrapper/decrypt_private_key_with_kms.rb', line 8 def self.call(*args) new.call(*args) end |
Instance Method Details
#call(ejson_file_path, region:) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/ejson_wrapper/decrypt_private_key_with_kms.rb', line 14 def call(ejson_file_path, region:) ejson_hash = JSON.parse(File.read(ejson_file_path)) encrypted_private_key = ejson_hash.fetch(KEY) do raise PrivateKeyNotFound, "Private key was not found in ejson file under key #{key}" end decrypt(Base64.decode64(encrypted_private_key), region: region) end |