The problem with that is that the serializer callbacks do not support
passing any options. It just calls dump and load blindly. The class methods
would need to somehow know what the passphrase is.

It looks like it was designed for class methods but passing an instance to
serialize works great.

Sent from my phone
On Jun 8, 2013 9:17 PM, "Joshua Priddle" <notifications@github.com> wrote:

> In lib/crypt_keeper/model.rb:
>
> >            raise "You must specify a valid encryptor `crypt_keeper :encryptor => :aes`"
> >          end
> >        end
> >
> > -      # Private: Define callbacks for encryption
> > -      def define_crypt_keeper_callbacks
> > -        after_save :decrypt_callback
> > -        after_find :decrypt_callback
> > -        before_save :encrypt_callback
> > -        before_save :enforce_column_types_callback
> > +      # Private: Checks if the encryptor response to dump and load
> > +      def valid_encryptor?
> > +        encryptor_klass.instance_methods.include?(:dump) &&
> > +          encryptor_klass.instance_methods.include?(:load)
> >        end
>
> It just seems weird to support both. If you only support class methods,
> they could initialize themselves if needed.
>
> class Encryptor
>   def self.load(string)
>     new.decrypt(string)
>   endend
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/jmazzi/crypt_keeper/pull/45/files#r4603088>
> .
>