diff --git a/README.md b/README.md index 7f5a0ff..6e02f42 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ end ## Converting between ciphers -Sometimes you may want to rotate the cipher used on a file. You cab do this rogramtically using the ruby code above, or you can also chain the CLI commands like so: +Sometimes you may want to rotate the cipher used on a file. You can do this programmatically using the ruby code above, or you can also chain the CLI commands like so: ```shell diffcrypt decrypt -k $(cat test/fixtures/aes-128-gcm.key) test/fixtures/example.yml.enc > test/fixtures/example.128.yml \ diff --git a/lib/diffcrypt/rails/encrypted_configuration.rb b/lib/diffcrypt/rails/encrypted_configuration.rb index 41c304f..b880efc 100644 --- a/lib/diffcrypt/rails/encrypted_configuration.rb +++ b/lib/diffcrypt/rails/encrypted_configuration.rb @@ -99,7 +99,7 @@ def encrypt(contents, original_encrypted_contents = nil) # @return [String] def decrypt(contents) if contents.index('---').nil? - @active_support_encryptor.decrypt_and_verify contents + active_support_encryptor.decrypt_and_verify contents else encryptor.decrypt contents end @@ -108,7 +108,7 @@ def decrypt(contents) # Rails applications with an existing credentials file, the inbuilt active support encryptor should be used # @return [ActiveSupport::MessageEncryptor] def active_support_encryptor - @active_support_encryptor = ActiveSupport::MessageEncryptor.new( + @active_support_encryptor ||= ActiveSupport::MessageEncryptor.new( [key].pack('H*'), cipher: @diffcrypt_file.cipher, )