G5 / storext

Add type-casting and other features on top of ActiveRecord::Store.store_accessor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Encrypt stored data

russellseymour opened this issue · comments

I have successfully implemented Storext in my application and it is working well.

However now I want to encrypt the data in the :data column to which Storext writes. I tried to use the serialize function on the column using information in this post http://iempire.ru/2015/12/18/simple-rails-encryption/. but the data is not encrypted.

I am assuming that the serialize is being overloaded somewhere by Storext to ensure that the data is stored as a JSON object.

Is there a way that I am missing that would allow me to incorporate encryption and Storext?

In fact, the serialize method is not overwritten in storext. It just calls it internally. It should work then!

My bad -- we don't call serialize but store_accessor instead (https://github.com/G5/storext/blob/master/lib/storext/class_methods.rb#L39).

What you need figure out is how to encrypt if you use store_accessor.

Will close this - please reopen if you feel the need.