active_record_encrypted_string 1.0.0 → 1.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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -3
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -0
- data/lib/active_record_encrypted_string/type.rb +5 -1
- data/lib/active_record_encrypted_string/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aac35fe9e40902529d160d7e50a308cf7f3b7a2d6f65c17d71922dfce991d24b
|
4
|
+
data.tar.gz: d45b843f667ec7f0394518f44ce558dcce78b9f66c0a3d96c6e6d4c03d569aa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '007869d2a53cf2ccb75ea1471abad30648e05982f96c25a996344f0ece7937f4e0a770a52937323785d031d481d54e1a0fa61a588f7ede6f696467fc8c6f0dca'
|
7
|
+
data.tar.gz: 0503cd1f5cbff6eef26756bdfdc9b37f967c5c02204a650f21b63e2a024efeec9a77fe1a62ac1b2c6b6597e73dacbc2c98c6d81c1d51d6bbc7b65cbed9204d99
|
data/.circleci/config.yml
CHANGED
@@ -11,7 +11,7 @@ common: &common
|
|
11
11
|
|
12
12
|
- restore_cache:
|
13
13
|
keys:
|
14
|
-
- bundle-v1-{{ checksum "
|
14
|
+
- bundle-v1-{{ checksum "active_record_encrypted_string.gemspec" }}
|
15
15
|
- bundle-v1-
|
16
16
|
|
17
17
|
- run:
|
@@ -26,9 +26,9 @@ common: &common
|
|
26
26
|
bundle exec appraisal ${RAILS_VERSION} bundle clean
|
27
27
|
|
28
28
|
- save_cache:
|
29
|
-
key: bundle-v1-{{ checksum "
|
29
|
+
key: bundle-v1-{{ checksum "active_record_encrypted_string.gemspec" }}
|
30
30
|
paths:
|
31
|
-
-
|
31
|
+
- active_record_encrypted_string/gemfiles/.bundle
|
32
32
|
|
33
33
|
- run:
|
34
34
|
name: Run tests
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 1.1.0
|
2
|
+
|
3
|
+
- Support encrypt with other salts
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
class Sample < ApplicationRecord
|
7
|
+
# encrypt with the salt that set in config/initializers
|
8
|
+
attribute :string_1, :encrypted_string
|
9
|
+
# if you want to encrypt with another salt
|
10
|
+
attribute :string_2, :encrypted_string, salt: ENV['STRING_2_ENCRYPT_SALT']
|
11
|
+
end
|
12
|
+
```
|
13
|
+
|
1
14
|
## 1.0.0
|
2
15
|
|
3
16
|
- Rename gem name to active_record_encrypted_string
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -39,6 +39,17 @@ ActiveRecordEncryptedString.configure do |c|
|
|
39
39
|
end
|
40
40
|
```
|
41
41
|
|
42
|
+
If you want to encrypt values with other salts, try it out!
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
class User < ActiveRecord::Base
|
46
|
+
# encrypt with default salt
|
47
|
+
attribute :name, :encrypted_string
|
48
|
+
# encrypt with another salt
|
49
|
+
attribute :email, :encrypted_string, salt: ENV['EMAIL_ENCRYPTION_SALT']
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
42
53
|
## Development
|
43
54
|
|
44
55
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -8,6 +8,10 @@ module ActiveRecordEncryptedString
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
def initialize(**options)
|
12
|
+
@salt = options[:salt]
|
13
|
+
end
|
14
|
+
|
11
15
|
# ActiveRecord calls `serialize` to convert Ruby objects to a format that can be understood by database
|
12
16
|
def serialize(value)
|
13
17
|
# expects same behavior as ActiveRecord::Type::String other than encryption
|
@@ -40,7 +44,7 @@ module ActiveRecordEncryptedString
|
|
40
44
|
end
|
41
45
|
|
42
46
|
def salt
|
43
|
-
ActiveRecordEncryptedString.configuration.salt
|
47
|
+
@salt || ActiveRecordEncryptedString.configuration.salt
|
44
48
|
end
|
45
49
|
end
|
46
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_encrypted_string
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kamillle
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|