active_record_encrypted_string 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16c12340eda2ad6a628bba3c2e453644a10c5349d5cee8480f72db277adc7e1a
4
- data.tar.gz: '051916ef47c8e2eda8c9876e4228bacd7158468cf19da289d4391cdbaa1046d9'
3
+ metadata.gz: aac35fe9e40902529d160d7e50a308cf7f3b7a2d6f65c17d71922dfce991d24b
4
+ data.tar.gz: d45b843f667ec7f0394518f44ce558dcce78b9f66c0a3d96c6e6d4c03d569aa5
5
5
  SHA512:
6
- metadata.gz: ba98ac182ebc1a15e1dea5276840dd14f7b9ab9ba947b96e8f90c177d601a3c5dc98508773e78e20cde778d2faeb24fcb8049b7bb910e1a24e54b579ec28fbe0
7
- data.tar.gz: dba1ae39f9afad1a82c263728b62e24432dad543a7ef0723df02a6f66af74bef5b1d7b36200a392d112a74ea4634a5cab6e2f802da65e7974a4bbc4daad0ca0b
6
+ metadata.gz: '007869d2a53cf2ccb75ea1471abad30648e05982f96c25a996344f0ece7937f4e0a770a52937323785d031d481d54e1a0fa61a588f7ede6f696467fc8c6f0dca'
7
+ data.tar.gz: 0503cd1f5cbff6eef26756bdfdc9b37f967c5c02204a650f21b63e2a024efeec9a77fe1a62ac1b2c6b6597e73dacbc2c98c6d81c1d51d6bbc7b65cbed9204d99
@@ -11,7 +11,7 @@ common: &common
11
11
 
12
12
  - restore_cache:
13
13
  keys:
14
- - bundle-v1-{{ checksum "active_record_string_encryption.gemspec" }}
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 "active_record_string_encryption.gemspec" }}
29
+ key: bundle-v1-{{ checksum "active_record_encrypted_string.gemspec" }}
30
30
  paths:
31
- - active_record_string_encryption/gemfiles/.bundle
31
+ - active_record_encrypted_string/gemfiles/.bundle
32
32
 
33
33
  - run:
34
34
  name: Run tests
@@ -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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_record_encrypted_string (1.0.0)
4
+ active_record_encrypted_string (1.1.0)
5
5
  activerecord (>= 5.0, < 7)
6
6
  activesupport (< 7)
7
7
 
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordEncryptedString
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  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.0.0
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-13 00:00:00.000000000 Z
11
+ date: 2020-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord