public
Description: An INCOMPLETE ActiveRecord plugin that encrypts/decrypts attributes transparently for secure database storage
Clone URL: git://github.com/shuber/attr_encrypted.git
Added test helpers and initializer and converted README to markdown
Sean Huber (author)
Fri Jun 06 11:29:32 -0700 2008
commit  7dae4ba574d4014589a3764ca657d76c82a993b6
tree    551af0a87d4144911f2002aa4bfb746094ac07b3
parent  772b45fc4e914c131f2fb74c92bde296acb758bb
...
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
0
@@ -1,3 +1,7 @@
0
+2008-06-06 - Sean Huber (shuber@huberry.com)
0
+ * README now uses markdown formatting
0
+ * Added test helpers and initializer
0
+
0
 2008-05-29 - Sean Huber (shuber@huberry.com)
0
   * Added missing exceptions.rb file - forgot to commit
0
   * Removed TextMate load paths from $: to avoid builder conflict errors
...
1
2
3
4
5
6
7
 
 
 
8
...
1
2
3
 
4
 
5
6
7
8
9
0
@@ -1,6 +1,7 @@
0
 require 'huberry/eigen'
0
 require 'huberry/attr_encrypted'
0
 require 'huberry/attr_encrypted/default_encryptor'
0
-require 'huberry/attr_encrypted/exceptions'
0
 
0
-ActiveRecord::Base.extend(Huberry::AttrEncrypted)
0
\ No newline at end of file
0
+ActiveRecord::Base.extend Huberry::AttrEncrypted
0
+
0
+$:.unshift File.dirname(__FILE__) + '/lib'
0
\ No newline at end of file
...
11
12
13
 
 
14
15
16
...
11
12
13
14
15
16
17
18
0
@@ -11,6 +11,8 @@ require 'base64'
0
 
0
 module Huberry
0
   module AttrEncrypted
0
+ class AttributeAlreadyEncrypted < StandardError; end
0
+ class KeyNotSpecified < StandardError; end
0
     
0
     include Huberry::Eigen
0
     
...
1
2
3
4
5
6
7
8
9
10
11
 
12
13
14
...
50
51
52
53
54
55
56
57
58
59
60
61
 
62
63
64
...
66
67
68
69
70
71
 
72
73
74
...
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
...
40
41
42
 
 
 
 
 
 
 
 
 
43
44
45
46
...
48
49
50
 
 
 
51
52
53
54
0
@@ -1,14 +1,4 @@
0
-$:.reject!{ |path| path.include?('TextMate') }
0
-require 'test/unit'
0
-
0
-# Load ActiveRecord
0
-require 'rubygems'
0
-gem 'activerecord', '>= 1.15.4.7794'
0
-require 'active_record'
0
-ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :dbfile => ':memory:'
0
-
0
-# Initialize plugin
0
-require "#{File.dirname(__FILE__)}/../init"
0
+require File.dirname(__FILE__) + '/init'
0
 
0
 # Alternate encryptor class
0
 class SillyEncryptor
0
@@ -50,15 +40,7 @@ end
0
 class AttrEncryptedTest < Test::Unit::TestCase
0
   
0
   def setup
0
- silence_stream(STDOUT) do
0
- ActiveRecord::Schema.define(:version => 1) do
0
- create_table :users do |t|
0
- t.binary :encrypted_email
0
- t.string :username
0
- t.binary :encrypted_credit_card
0
- end
0
- end
0
- end
0
+ create_users_table
0
     
0
     @email = 'test@test.com'
0
     @username = 'test'
0
@@ -66,9 +48,7 @@ class AttrEncryptedTest < Test::Unit::TestCase
0
   end
0
   
0
   def teardown
0
- ActiveRecord::Base.connection.tables.each do |table|
0
- ActiveRecord::Base.connection.drop_table(table)
0
- end
0
+ drop_all_tables
0
   end
0
   
0
   def test_should_encrypt

Comments

    No one has commented yet.