While upgrading a Rails app, I've stumbled over a potential regression.
In 0.3.1, this works:
class UserMailer < ApplicationMailer
def confirm(user)
mail to: user.email, gpg: {
encrypt: true,
sign_as: GPG_SIGN_EMAIL,
keys: { user.email => user.gpg_key },
}
end
end
In 0.3.3, this fails with
NoMethodError: undefined method `empty?' for #<GPGME::Key:0x000055b0630c1548>
mail-gpg (0.3.3) lib/mail/gpg/gpgme_helper.rb:128:in `block in keys_for_data'
mail-gpg (0.3.3) lib/mail/gpg/gpgme_helper.rb:120:in `map'
mail-gpg (0.3.3) lib/mail/gpg/gpgme_helper.rb:120:in `keys_for_data'
mail-gpg (0.3.3) lib/mail/gpg/gpgme_helper.rb:14:in `encrypt'
mail-gpg (0.3.3) lib/mail/gpg/encrypted_part.rb:20:in `initialize'
mail-gpg (0.3.3) lib/mail/gpg.rb:43:in `new'
mail-gpg (0.3.3) lib/mail/gpg.rb:43:in `block in encrypt'
mail-gpg (0.3.3) lib/mail/gpg.rb:113:in `instance_eval'
mail-gpg (0.3.3) lib/mail/gpg.rb:113:in `block in construct_mail'
mail (2.7.0) lib/mail/message.rb:153:in `instance_eval'
mail (2.7.0) lib/mail/message.rb:153:in `initialize'
mail (2.7.0) lib/mail/mail.rb:51:in `new'
mail (2.7.0) lib/mail/mail.rb:51:in `new'
mail-gpg (0.3.3) lib/mail/gpg.rb:106:in `construct_mail'
mail-gpg (0.3.3) lib/mail/gpg.rb:29:in `encrypt'
mail-gpg (0.3.3) lib/mail/gpg/delivery_handler.rb:11:in `deliver_mail'
mail-gpg (0.3.3) lib/mail/gpg/rails/action_mailer_base_patch.rb:31:in `block in deliver_mail'
actionmailer (4.2.10) lib/action_mailer/base.rb:543:in `block in deliver_mail'
activesupport (4.2.10) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.10) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.10) lib/active_support/notifications.rb:164:in `instrument'
actionmailer (4.2.10) lib/action_mailer/base.rb:541:in `deliver_mail'
mail-gpg (0.3.3) lib/mail/gpg/rails/action_mailer_base_patch.rb:30:in `deliver_mail'
mail (2.7.0) lib/mail/message.rb:260:in `deliver'
actionmailer (4.2.10) lib/action_mailer/message_delivery.rb:85:in `deliver_now'
The user.gpg_key basically performs a GPGME::Ctx#get_key (+lazy import if it doesn't exist locally), and returns a GPGME::Key instance. It also stores the import time in the database, and does some validation. Originally it was the only way to prevent a double-lookup of the key (which #55 tries to remedy?), but it's broken now.
While upgrading a Rails app, I've stumbled over a potential regression.
In 0.3.1, this works:
In 0.3.3, this fails with
The
user.gpg_key
basically performs aGPGME::Ctx#get_key
(+lazy import if it doesn't exist locally), and returns aGPGME::Key
instance. It also stores the import time in the database, and does some validation. Originally it was the only way to prevent a double-lookup of the key (which #55 tries to remedy?), but it's broken now.