spikex / strongbox

Secures ActiveRecord attributes with public key encryption
http://stuff-things.net/2009/04/17/introducing-strongbox/
MIT License
397 stars 43 forks source link

Make validations well-behaved with :deferred_encryption #45

Closed ghost closed 9 years ago

ghost commented 9 years ago

Currently the following doesn't work:

  validates :name, presence: true
  encrypt_with_public_key :name,
    :symmetric => :never,
    :public_key => Rails.root.join('config','public.pem'),
    :deferred_encryption => true

As :deferred_encryption will initially result in the raw content being kept in the model instance and blank? and nil? were only well-defined for when it's kept encrypted.

spikex commented 9 years ago

Thank you!