test/active_crypto_test.rb in ezcrypto-0.7 vs test/active_crypto_test.rb in ezcrypto-0.7.2
- old
+ new
@@ -9,22 +9,22 @@
has_many :groups
keyholder
end
class Secret < ActiveRecord::Base
- encrypt :name,:email, :key=>:user
+ encrypt :name,:email, :key=>:user, :base64=>true
belongs_to :user
has_many :children
end
class Child < ActiveRecord::Base
- encrypt :email, :key=>:secret
+ encrypt :email, :key=>:secret, :base64=>true
belongs_to :secret
end
class Asset<ActiveRecord::Base
- encrypt :title
+ encrypt :title, :base64=>true
has_many :caps,:dependent=>:destroy
def self.create(title,email)
asset=Asset.new
asset.set_session_key(EzCrypto::Key.generate)
@@ -46,11 +46,11 @@
set_table_name "assets"
end
class Cap < ActiveRecord::Base
belongs_to :asset
- encrypt :shared_key
+ encrypt :shared_key, :base64=>true
def self.find_by_key(cap_key)
cap_key.chop
hash=Digest::SHA1.hexdigest(cap_key)
if (cap_key.length>=20) # Sanity check
@@ -85,16 +85,16 @@
class Group < ActiveRecord::Base
belongs_to :user
has_many :group_secrets
- encrypt :name,:group_key, :key=>:user
+ encrypt :name,:group_key, :key=>:user , :base64=>true
end
class GroupSecret < ActiveRecord::Base
belongs_to :group
- encrypt :title,:body, :key=>:group
+ encrypt :title,:body, :key=>:group, :base64=>true
end
class ActiveCryptoTest < Test::Unit::TestCase