diffcrypt / diffcrypt-ruby

Diffable encrypted files that can be committed into a git repo
MIT License
8 stars 3 forks source link

Fix undefined instance var AS encryptor #31

Closed swiknaba closed 4 years ago

swiknaba commented 4 years ago

creating new credentials fails with

0.4.0/lib/diffcrypt/rails/encrypted_configuration.rb:102:in `decrypt': undefined method `decrypt_and_verify' for nil:NilClass (NoMethodError)

it seems decrypt_and_verify is never called, thus @decrypt_and_verify is not populated and hence results in this error.

Not sure if

      def active_support_encryptor
        @active_support_encryptor = ActiveSupport::MessageEncryptor.new(
          [key].pack('H*'),
          cipher: @diffcrypt_file.cipher,
        )
      end

was intended to memorize the AS Message Encryptor instance, if so, we can drop in @active_support_encryptor ||= ....

marcqualie commented 4 years ago

Related to: https://github.com/marcqualie/diffcrypt/issues/29