attr_cipher 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -9
  3. data/lib/attr_cipher/version.rb +2 -2
  4. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00b32ff728220c366f964a0305a33a5b1c8216e1
4
- data.tar.gz: fcf407ad3d80e9533649b0910147d7d5ea8c5d1d
3
+ metadata.gz: '028e1e05b611dc3e8076d5c4df72906eaeb140f7'
4
+ data.tar.gz: 79154ae0e9ae0d7fd2ea7e9fed7cd0de31d6347b
5
5
  SHA512:
6
- metadata.gz: 516fc8a442a58f34795447dd56f3f01cc8eed3d4bd7cf5cec96331de37f3b63eaeeac34bd6851fc1a51e20c34700478628a94538660d64e834fc36e6617c8ed9
7
- data.tar.gz: 1a6437ac77c47f4a991d7c237cf04c86faaa9b61b726426dcf9728b47839c633ddf6edcfa5a9f9f77feac60c8c8f267e3e2e08196d1dde642172f825258761e3
6
+ metadata.gz: fceb794e899feeaf99ca4aeefcdc9709541425d6b4852c9b1d674cbca82c2a667370321264e109477bb49d2f3ab05dc89f78e8e07b00c04588d83cbe7ade5d2c
7
+ data.tar.gz: b11e01c3de37fd7f23b455fe9af84aeb8d0055d94c06bfc294072cb1ba7ea218d0cf7b8d3d36f7210c14a09b10dee51247886964087c602cfead72a43e167f26
data/README.md CHANGED
@@ -54,24 +54,27 @@ class User
54
54
  end
55
55
  ```
56
56
 
57
- Attributes to be encrypted are declared using the `attr_cipher` class method in your model:
57
+ Add the attribute as a column to your ActiveRecord migration with `_cipher` appended to the attribute name:
58
58
 
59
59
  ```ruby
60
60
  ActiveRecord::Schema.define do
61
61
  create_table :users do |t|
62
- t.text :security_question
63
- t.text :security_answer_cipher
62
+ t.text :api_key_cipher
64
63
  end
65
64
  end
65
+ ```
66
+
67
+ Attributes to be encrypted are declared using the `attr_cipher` class method in your model:
66
68
 
69
+ ```ruby
67
70
  class User < ActiveRecord::Base
68
- attr_cipher :security_answer
71
+ attr_cipher :api_key
69
72
  end
70
73
  ```
71
74
 
72
- **AttrCipher** automatically creates the `#security_answer` getter and `#security_answer=` setter. The getter authomatically decrypts the return value. The setter encrypts the value provided and stores it in the `security_answer_cipher` column.
73
- CustomCipher
74
- If you don't want to use the AES-256-CBC cipher, you can provide your own cipher module. Define an object that responds to `encrypt(secret, value)` and `decrypt(secret, value)`:
75
+ In the above example, **AttrCipher** automatically creates the `#api_key` getter and `#api_key=` setter. The getter automatically decrypts the return value. The setter encrypts the value provided and stores it in the `api_key_cipher` column.
76
+
77
+ If you don't want to use the AES-256-CBC cipher, you can provide your own cipher object. Define an object that responds to `encrypt(secret, value)` and `decrypt(secret, value)` class methods:
75
78
 
76
79
  ```ruby
77
80
  module CustomCipher
@@ -84,7 +87,7 @@ module CustomCipher
84
87
  end
85
88
  ```
86
89
 
87
- Then pass the custom cipher module to the `cipher` option of the `attr_cipher` class method:
90
+ Then pass the custom cipher object to the `cipher` option of the `attr_cipher` class method:
88
91
 
89
92
  ```ruby
90
93
  class User < ActiveRecord::Base
@@ -112,7 +115,7 @@ bundle exec rake
112
115
 
113
116
  ## Credit
114
117
 
115
- I would like to thank [Nando Vieira](http://nandovieira.com/) for his [encrypt_attr](https://github.com/fnando/encrypt_attr) gem which provided a lot of the inspiration and framework for **AttrCipher**.
118
+ I would like to thank [Nando Vieira](http://nandovieira.com/) for his [encrypt_attr](https://github.com/fnando/encrypt_attr) gem from which some of the code was derived.
116
119
 
117
120
  This gem was written and is maintained by [Jurgen Jocubeit](https://github.com/JurgenJocubeit), CEO and President Brightcommerce, Inc.
118
121
 
@@ -1,11 +1,11 @@
1
1
  module AttrCipher
2
2
  module VERSION
3
3
  MAJOR = 1
4
- MINOR = 1
4
+ MINOR = 2
5
5
  TINY = 0
6
6
  PRE = nil
7
7
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
8
8
  SUMMARY = "AttrCipher v#{STRING}"
9
- DESCRIPTION = "Provides functionality to store encrypted attributes using AES-256-CBC."
9
+ DESCRIPTION = "Provides functionality to transparently store and retrieve encrypted attributes in ActiveRecord models."
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_cipher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurgen Jocubeit
@@ -120,7 +120,8 @@ dependencies:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
122
  version: 0.11.2
123
- description: Provides functionality to store encrypted attributes using AES-256-CBC.
123
+ description: Provides functionality to transparently store and retrieve encrypted
124
+ attributes in ActiveRecord models.
124
125
  email:
125
126
  - support@brightcommerce.com
126
127
  executables: []
@@ -158,5 +159,5 @@ rubyforge_project:
158
159
  rubygems_version: 2.5.1
159
160
  signing_key:
160
161
  specification_version: 4
161
- summary: AttrCipher v1.1.0
162
+ summary: AttrCipher v1.2.0
162
163
  test_files: []