Class: SymmetricEncryption::Keystore::Heroku
- Inherits:
-
Environment
- Object
- Memory
- Environment
- SymmetricEncryption::Keystore::Heroku
- Defined in:
- lib/symmetric_encryption/keystore/heroku.rb
Overview
Heroku uses environment variables too.
Instance Attribute Summary
Attributes inherited from Environment
Attributes inherited from Memory
#encrypted_key, #key_encrypting_key
Class Method Summary collapse
-
.generate_data_key(**args) ⇒ Object
Returns [Hash] a new keystore configuration after generating the data key.
Instance Method Summary collapse
-
#write(key) ⇒ Object
Write the encrypted Encryption key to ‘encrypted_key` attribute.
Methods inherited from Environment
Methods inherited from Memory
Constructor Details
This class inherits a constructor from SymmetricEncryption::Keystore::Environment
Class Method Details
.generate_data_key(**args) ⇒ Object
Returns [Hash] a new keystore configuration after generating the data key.
6 7 8 9 10 |
# File 'lib/symmetric_encryption/keystore/heroku.rb', line 6 def self.generate_data_key(**args) config = super(**args) config[:keystore] = :heroku config end |
Instance Method Details
#write(key) ⇒ Object
Write the encrypted Encryption key to ‘encrypted_key` attribute.
13 14 15 16 17 18 19 |
# File 'lib/symmetric_encryption/keystore/heroku.rb', line 13 def write(key) encrypted_key = key_encrypting_key.encrypt(key) puts "\n\n********************************************************************************" puts "Add the environment key to Heroku:\n\n" puts " heroku config:add #{key_env_var}=#{encoder.encode(encrypted_key)}" puts '********************************************************************************' end |