mongoid-encrypted_string 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,85 @@
1
+ # mongoid-encrypted_string
2
+
3
+ `Mongoid::EncryptedString` defines an encrypted string type for your Mongoid apps, which provides you a simple way to store encrypted information in your database.
4
+
5
+ `Mongoid::EncryptedString` uses `Gibberish::AES` internally to encrypt your data.
6
+
7
+ ## Installation
8
+
9
+ In your Gemfile:
10
+
11
+ ```ruby
12
+ gem 'mongoid-encrypted_string'
13
+ ```
14
+
15
+ Add an initializer:
16
+
17
+ ```ruby
18
+ Mongoid::EncryptedString.config.key = 'random'
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ class Document
25
+ include Mongoid::Document
26
+
27
+ field :string, type: Mongoid::EncryptedString
28
+ ends
29
+ ```
30
+
31
+ ```ruby
32
+ document = Document.create string: 'secret'
33
+ document.attributes => {"_id"=>"50e92506372fa248a6000002",
34
+ "string"=>
35
+ "U2FsdGVkX19oLIvsPM0WtUiqyFwp/TPOk5x5t/5S5q4qDkGqcoWy7FKtkxvj\nicT5\n" }
36
+ ```
37
+
38
+ If you want to use `EncryptedString` directly instead of `Mongoid::EncryptedString`:
39
+
40
+ ```ruby
41
+ class Document
42
+ include Mongoid::Document
43
+
44
+ field :string, type: EncryptedString
45
+ end
46
+ ```
47
+
48
+ … your Gemfile must include a additional require statement:
49
+
50
+ ```ruby
51
+ gem 'mongoid-encrypted_string', require: 'mongoid/encrypted_string/global'
52
+ ```
53
+
54
+ ## Contributing
55
+
56
+ 1. Fork it
57
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
58
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
59
+ 4. Push to the branch (`git push origin my-new-feature`)
60
+ 5. Create new Pull Request
61
+
62
+ ## Copyright
63
+
64
+ (The MIT license)
65
+
66
+ Copyright (c) 2013 Mario Uher
67
+
68
+ Permission is hereby granted, free of charge, to any person obtaining
69
+ a copy of this software and associated documentation files (the
70
+ "Software"), to deal in the Software without restriction, including
71
+ without limitation the rights to use, copy, modify, merge, publish,
72
+ distribute, sublicense, and/or sell copies of the Software, and to
73
+ permit persons to whom the Software is furnished to do so, subject to
74
+ the following conditions:
75
+
76
+ The above copyright notice and this permission notice shall be
77
+ included in all copies or substantial portions of the Software.
78
+
79
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
80
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
81
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
82
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
83
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
84
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
85
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -26,7 +26,7 @@ module Mongoid
26
26
  end
27
27
 
28
28
  private
29
- def aes
29
+ def aes
30
30
  @aes ||= Gibberish::AES.new(key || raise(StandardError, "Mongoid::EncryptedString.config.key is not set"))
31
31
  end
32
32
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  class EncryptedString < String
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: mongoid-encrypted_string
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mario Uher
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-05 00:00:00.000000000 Z
12
+ date: 2013-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +52,7 @@ extra_rdoc_files: []
52
52
  files:
53
53
  - .gitignore
54
54
  - Gemfile
55
+ - README.md
55
56
  - Rakefile
56
57
  - lib/mongoid/encrypted_string.rb
57
58
  - lib/mongoid/encrypted_string/global.rb