README.md in crypt_keeper-0.0.4 vs README.md in crypt_keeper-0.1.0

- old
+ new

@@ -1,7 +1,11 @@ -# CryptKeeper +[![Build Status](https://secure.travis-ci.org/jmazzi/crypt_keeper.png?branch=master)](http://travis-ci.org/jmazzi/crypt_keeper) +![CryptKeeper](http://i.imgur.com/qf0aD.jpg) + +# CryptKeeper + Provides transparent encryption for ActiveRecord. It is encryption agnostic. You can guard your data with any encryption algorithm you want. All you need is a simple class that does 3 things. 1. Takes a hash argument for `initialize` @@ -20,23 +24,51 @@ simple that *just works*. ## Usage ```ruby - class MyModel < ActiveRecord::Base - crypt_keeper :field, :other_field, encryptor: CryptKeeperProviders::Aes, - passphrase: 'super_good_password' + crypt_keeper :field, :other_field, :encryptor => :aes, :passphrase => 'super_good_password' end model = MyModel.new(field: 'sometext') model.save! #=> Your data is now encrypted model.field #=> 'sometext' - ``` It works with all persistences methods: `update_attribute`, `update_attributes`, and save. + +## Creating your own encryptor + +Creating your own encryptor is easy. All you have to do is create a class +under the `CryptKeeperProviders` namespace, like this: + +```ruby +module CryptKeeperProviders + class MyEncryptor + def initialize(options ={}) + end + + def encrypt(value) + end + + def decrypt(value) + end + end +end + +``` + +Just require your code and setup your model to use it. Just pass the class name +as an underscored symbol + + +```ruby +class MyModel < ActiveRecord::Base + crypt_keeper :field, :other_field, :encryptor => :my_encryptor, :passphrase => 'super_good_password' +end +``` ## Installation Add this line to your application's Gemfile: