attr_cipher 1.5.0 → 2.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ed7ac40e52f0199687e0ab1c37631bc1c9e467cb
4
- data.tar.gz: 22672d14a563134ae6f19ad3b1e57e3afc8180a8
2
+ SHA256:
3
+ metadata.gz: a212d3fcf9f7735054f2563181425df265981ebb1e5a943ebca4040f2b51d8ac
4
+ data.tar.gz: 1e4a4d0e5130df90026435218059398fe2db5edcb3dc67eb4fee626208265bac
5
5
  SHA512:
6
- metadata.gz: e5a86beddafd05bb1ecf5b35820f798b8609f32e06fbb97741f74acf7d5a6b00a97459604ecf45cf62e7abd7185552a6a622119343b661fd2e39bcac050f921f
7
- data.tar.gz: 68cdbc62e3b4cb5e4871a715444740a31143129c35e9474a2d9de11c65ab85ac10efc0198f8d3925f2877e047b7b3f3b45d202f046ca5d0f24e66f1050c444ea
6
+ metadata.gz: bfad87fc435b793fd26f8d9d179d8d657b556b15665e1d1be56781171b424ea24f4981bc5029be2831a3ab08968c4de1a80424810ddc61797c6791e5b3c84c67
7
+ data.tar.gz: 6643a44ccead56acaa9db1a61defd994b90f77c25aeeda3e1d040dc9b0211b94fa7ddf2d6a06524ac4c306a734369d0d5534d27a678aad511c16830a75c42ee0
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ##v2.0.0
4
+ - Removed automatic inclusion in ActiveRecord::Base class, now optional.
5
+ - Added Ruby 2.5.3 to Travis CI config.
6
+ - Tested against ActiveRecord 5.2.2.
7
+ - Updated Rspec to 3.7.0 (dev dependency).
8
+ - Updated Sqlite to ~> 1.3.13 (dev dependency).
9
+ - Updated README.
10
+
3
11
  ##v1.5.0
4
12
  - Created `AttrCipher::SecretException` class.
5
13
  - Updated FactoryGirl to FactoryBot (dev dependency).
@@ -1,4 +1,4 @@
1
- Copyright 2017-2018 Brightcommerce, Inc. All rights reserved.
1
+ Copyright 2017-2019 Brightcommerce, Inc. All rights reserved.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -9,12 +9,16 @@
9
9
 
10
10
  Using the same secret for both encryption of plaintext and decryption of ciphertext, **AttrCipher** uses a method that is known as a symmetric-key algorithm, specifically the Advanced Encryption Standard Cipher-Block Chaining algorithm with a 256bit key (AES-256-CBC). However, you can provide your own cipher algorithm to **AttrCipher**, if you prefer. As a side note, 256bit AES is what the United States government uses to encrypt information at the Top Secret level.
11
11
 
12
+ ***Version 2.0.0+ Breaking Changes***
13
+
14
+ _Please note:_ AttrCipher is **no longer automatically included** in models anymore. You will need to either `require attr_cipher/active_record` in an initializer, or `include AttrCipher` in each model using the `attr_cipher` macro. This is to prevent pollution of ActiveRecord::Base. See [usage](#usage) section below for details.
15
+
12
16
  ## Installation
13
17
 
14
18
  To install add the following line to your `Gemfile`:
15
19
 
16
20
  ``` ruby
17
- gem 'attr_cipher'
21
+ gem 'attr_cipher', '~> 2.0'
18
22
  ```
19
23
 
20
24
  And run `bundle install`.
@@ -26,15 +30,15 @@ Runtime:
26
30
  - activesupport (>= 4.2.6)
27
31
 
28
32
  Development/Test:
29
- - rake (~> 10.5)
30
- - rspec (~> 3.4)
31
- - sqlite3 (~> 1.3)
33
+ - rake (~> 10.5.0)
34
+ - rspec (~> 3.7.0)
35
+ - sqlite3 (~> 1.3.13)
32
36
  - simplecov (~> 0.16.1)
33
37
  - factory_bot (~> 4.8.2)
34
38
 
35
39
  ## Compatibility
36
40
 
37
- Tested with Ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16] against ActiveRecord 5.1.4 on macOS Sierra 10.13.4 (17E202).
41
+ Tested with Ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18] against ActiveRecord 5.2.2 on macOS Mojave 10.14 (18A391).
38
42
 
39
43
  **AttrCipher** uses OpenSSL to perform the cipher.
40
44
 
@@ -43,14 +47,17 @@ Tested with Ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16] against
43
47
  **AttrCipher** uses a global secret by default and it must be at least 100 characters or more. You can set the secret by setting `AttrCipher.secret` (e.g. `$ openssl rand -hex 50`).
44
48
 
45
49
  ```ruby
46
- AttrCipher.secret = ENV['SECRET_KEY']
50
+ # config/initializers/attr_cipher.rb
51
+ AttrCipher.secret = Rails.application.secrets.secret_key_base
47
52
  ```
48
53
 
49
54
  You can also set the secret on a per attribute basis.
50
55
 
51
56
  ```ruby
52
57
  class User
53
- attr_cipher :api_key, secret: ENV['USER_API_KEY_SECRET']
58
+ include AttrArray
59
+
60
+ attr_cipher :api_key, secret: Rails.application.secrets.secret_key_base
54
61
  end
55
62
  ```
56
63
 
@@ -64,6 +71,15 @@ ActiveRecord::Schema.define do
64
71
  end
65
72
  ```
66
73
 
74
+ To include AttrCipher in all models, add the following to an initializer:
75
+
76
+ ```ruby
77
+ # config/initializers/attr_cipher.rb
78
+ require 'attr_cipher/active_record'
79
+ ```
80
+
81
+ You then don't need to `include AttrCipher` in any model.
82
+
67
83
  Attributes to be encrypted are declared using the `attr_cipher` class method in your model:
68
84
 
69
85
  ```ruby
@@ -135,4 +151,4 @@ The gem is available as open source under the terms of the [MIT License](http://
135
151
 
136
152
  ## Copyright
137
153
 
138
- Copyright 2017-2018 Brightcommerce, Inc.
154
+ Copyright 2017-2019 Brightcommerce, Inc. All rights reserved.
@@ -0,0 +1 @@
1
+ ActiveRecord::Base.send :include, AttrCipher
@@ -41,5 +41,3 @@ module AttrCipher
41
41
  end
42
42
  end
43
43
  end
44
-
45
- ActiveRecord::Base.send :include, AttrCipher
@@ -1,7 +1,7 @@
1
1
  module AttrCipher
2
2
  module VERSION
3
- MAJOR = 1
4
- MINOR = 5
3
+ MAJOR = 2
4
+ MINOR = 0
5
5
  TINY = 0
6
6
  PRE = nil
7
7
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_cipher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurgen Jocubeit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-16 00:00:00.000000000 Z
11
+ date: 2019-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -120,6 +120,7 @@ files:
120
120
  - MIT-LICENSE
121
121
  - README.md
122
122
  - lib/attr_cipher.rb
123
+ - lib/attr_cipher/active_record.rb
123
124
  - lib/attr_cipher/attr_cipher.rb
124
125
  - lib/attr_cipher/cipher.rb
125
126
  - lib/attr_cipher/secret_exception.rb
@@ -145,8 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  version: '0'
146
147
  requirements: []
147
148
  rubyforge_project:
148
- rubygems_version: 2.6.13
149
+ rubygems_version: 2.7.6
149
150
  signing_key:
150
151
  specification_version: 4
151
- summary: AttrCipher v1.5.0
152
+ summary: AttrCipher v2.0.0
152
153
  test_files: []