daffy_lib 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/.rubocop.yml +10 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +13 -11
- data/README.md +30 -4
- data/lib/daffy_lib/version.rb +1 -1
- data/lib/tasks/db_tasks.rake +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adf0390e240f1f5b14fffb3ee34fae133d4a5ebf20349cb55c044f9ba8cf8280
|
4
|
+
data.tar.gz: 6de10a901c852196f5882f98c6537613b4e7cf44baec34a3394b29f109f7478c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e077042dd373b2f5b7d439661916d15c7302b89a2bd49dbf7a21d3e114eafea3c038cfdf07bd40d3af04aa3ed329b1d1713bb27ac1e314740704799ba119593e
|
7
|
+
data.tar.gz: 615f0873b10e714069f7169e8c63e4af0efebbb0a61678bcfe843df9f98da98179e42379dcc1109ad6180342cc70bceedf60e9b7347ba20431fc2235869777b8
|
data/.circleci/config.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -9,7 +9,7 @@ AllCops:
|
|
9
9
|
- node_modules/**/*
|
10
10
|
- output/**/*
|
11
11
|
- vendor/**/*
|
12
|
-
TargetRubyVersion: 2.
|
12
|
+
TargetRubyVersion: 2.7.0
|
13
13
|
RSpec:
|
14
14
|
Patterns:
|
15
15
|
- _spec.rb
|
@@ -58,3 +58,12 @@ RSpec/MultipleExpectations:
|
|
58
58
|
|
59
59
|
RSpec/ExampleLength:
|
60
60
|
Max: 10
|
61
|
+
|
62
|
+
Style/HashEachMethods:
|
63
|
+
Enabled: true
|
64
|
+
|
65
|
+
Style/HashTransformKeys:
|
66
|
+
Enabled: true
|
67
|
+
|
68
|
+
Style/HashTransformValues:
|
69
|
+
Enabled: true
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
daffy_lib (0.1.
|
4
|
+
daffy_lib (0.1.5)
|
5
5
|
porky_lib
|
6
6
|
rails
|
7
7
|
redis
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
attr_encrypted (3.1.0)
|
69
69
|
encryptor (~> 3.0.0)
|
70
70
|
aws-eventstream (1.0.3)
|
71
|
-
aws-partitions (1.
|
71
|
+
aws-partitions (1.275.0)
|
72
72
|
aws-sdk-core (3.90.1)
|
73
73
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
74
74
|
aws-partitions (~> 1, >= 1.239.0)
|
@@ -91,8 +91,8 @@ GEM
|
|
91
91
|
json
|
92
92
|
simplecov
|
93
93
|
url
|
94
|
-
concurrent-ruby (1.1.
|
95
|
-
crass (1.0.
|
94
|
+
concurrent-ruby (1.1.6)
|
95
|
+
crass (1.0.6)
|
96
96
|
diff-lcs (1.3)
|
97
97
|
docile (1.3.2)
|
98
98
|
encryptor (3.0.0)
|
@@ -105,7 +105,7 @@ GEM
|
|
105
105
|
ffi (1.12.2)
|
106
106
|
globalid (0.4.2)
|
107
107
|
activesupport (>= 4.2.0)
|
108
|
-
i18n (1.
|
108
|
+
i18n (1.8.2)
|
109
109
|
concurrent-ruby (~> 1.0)
|
110
110
|
jaro_winkler (1.5.4)
|
111
111
|
jmespath (1.4.0)
|
@@ -121,7 +121,7 @@ GEM
|
|
121
121
|
mimemagic (0.3.4)
|
122
122
|
mini_mime (1.0.2)
|
123
123
|
mini_portile2 (2.4.0)
|
124
|
-
minitest (5.
|
124
|
+
minitest (5.14.0)
|
125
125
|
msgpack (1.3.3)
|
126
126
|
nio4r (2.5.2)
|
127
127
|
nokogiri (1.10.8)
|
@@ -135,7 +135,7 @@ GEM
|
|
135
135
|
msgpack
|
136
136
|
rbnacl (= 5.0.0)
|
137
137
|
rbnacl-libsodium
|
138
|
-
rack (2.
|
138
|
+
rack (2.2.2)
|
139
139
|
rack-test (1.1.0)
|
140
140
|
rack (>= 1.0, < 3)
|
141
141
|
rails (6.0.2.1)
|
@@ -171,6 +171,7 @@ GEM
|
|
171
171
|
rbnacl-libsodium (1.0.16)
|
172
172
|
rbnacl (>= 3.0.1)
|
173
173
|
redis (4.1.3)
|
174
|
+
rexml (3.2.4)
|
174
175
|
rspec (3.9.0)
|
175
176
|
rspec-core (~> 3.9.0)
|
176
177
|
rspec-expectations (~> 3.9.0)
|
@@ -196,16 +197,17 @@ GEM
|
|
196
197
|
rspec-support (3.9.2)
|
197
198
|
rspec_junit_formatter (0.4.1)
|
198
199
|
rspec-core (>= 2, < 4, != 2.12.0)
|
199
|
-
rubocop (0.
|
200
|
+
rubocop (0.80.0)
|
200
201
|
jaro_winkler (~> 1.5.1)
|
201
202
|
parallel (~> 1.10)
|
202
203
|
parser (>= 2.7.0.1)
|
203
204
|
rainbow (>= 2.2.2, < 4.0)
|
205
|
+
rexml
|
204
206
|
ruby-progressbar (~> 1.7)
|
205
207
|
unicode-display_width (>= 1.4.0, < 1.7)
|
206
208
|
rubocop-performance (1.5.2)
|
207
209
|
rubocop (>= 0.71.0)
|
208
|
-
rubocop-rspec (1.38.
|
210
|
+
rubocop-rspec (1.38.1)
|
209
211
|
rubocop (>= 0.68.1)
|
210
212
|
rubocop_runner (2.2.0)
|
211
213
|
ruby-progressbar (1.10.1)
|
@@ -258,7 +260,7 @@ DEPENDENCIES
|
|
258
260
|
timecop
|
259
261
|
|
260
262
|
RUBY VERSION
|
261
|
-
ruby 2.
|
263
|
+
ruby 2.7.0p0
|
262
264
|
|
263
265
|
BUNDLED WITH
|
264
|
-
2.
|
266
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![CircleCI](https://circleci.com/gh/Zetatango/daffy_lib.svg?style=svg)](https://circleci.com/gh/Zetatango/daffy_lib) [![codecov](https://codecov.io/gh/Zetatango/daffy_lib/branch/master/graph/badge.svg?token=WxED9350q4)](https://codecov.io/gh/Zetatango/daffy_lib) [![Gem Version](https://badge.fury.io/rb/daffy_lib.svg)](https://badge.fury.io/rb/daffy_lib)
|
1
|
+
[![CircleCI](https://circleci.com/gh/Zetatango/daffy_lib.svg?style=svg)](https://circleci.com/gh/Zetatango/daffy_lib) [![codecov](https://codecov.io/gh/Zetatango/daffy_lib/branch/master/graph/badge.svg?token=WxED9350q4)](https://codecov.io/gh/Zetatango/daffy_lib) [![Gem Version](https://badge.fury.io/rb/daffy_lib.svg)](https://badge.fury.io/rb/daffy_lib)
|
2
2
|
# DaffyLib
|
3
3
|
|
4
4
|
This gem is a caching encryptor which improves performance when encrypting/decrypting large amounts of data. It will keep a plaintext key cached for a given amount of time, as well as provide partitioning to allow entire rows to be encrypted with the same key. Keys are uniquely identified by a pair of a partition guid and an encryption epoch.
|
@@ -25,7 +25,7 @@ We illustrate usage of this library with an example. Suppose we have classes `U
|
|
25
25
|
|
26
26
|
The `User` class will need to `include DaffyLib::PartitionProvider` and implement the method `provider_partition_guid` which returns an identifier, for instance a user's `guid`.
|
27
27
|
|
28
|
-
The `User::Attribute` class will need to `include DaffyLib::PartitionProvider` as well as `include DaffyLib::HasEncryptedAttributes`. It will need to declare `partition_provider :user`.
|
28
|
+
The `User::Attribute` class will need to `include DaffyLib::PartitionProvider` as well as `include DaffyLib::HasEncryptedAttributes`. It will need to declare `partition_provider :user`.
|
29
29
|
|
30
30
|
There are default implementations of `generate_partition_guid` which returns the linked `User`'s `guid`, as well as a `generate_encryption_epoch` method which defines the encryption epoch, which are the following.
|
31
31
|
|
@@ -52,7 +52,7 @@ attr_encrypted :values, encryptor: ZtCachingEncryptor, encrypt_method: :zt_encry
|
|
52
52
|
encode: true, partition_guid: proc { |object| object.generate_partition_guid },
|
53
53
|
encryption_epoch: proc { |object| object.generate_encryption_epoch }, expires_in: 5.minutes
|
54
54
|
```
|
55
|
-
|
55
|
+
|
56
56
|
where the `expires_in` field denotes how long a plaintext key should be kept in cache.
|
57
57
|
|
58
58
|
Note further that a class can be its own partition provider; i.e. if `User` itself had encrypted attributes, all the steps above for `User::Attributes` apply, except there is no need to declare `partition_provider`, and the recommended implementation for `generate_partition_guid` is to return (or create) the `guid` of the `User`.
|
@@ -77,7 +77,33 @@ Finally, once existing records have been populated, it is advisable to perform a
|
|
77
77
|
|
78
78
|
Development on this project should occur on separate feature branches and pull requests should be submitted. When submitting a pull request, the pull request comment template should be filled out as much as possible to ensure a quick review and increase the likelihood of the pull request being accepted.
|
79
79
|
|
80
|
+
### Ruby
|
81
|
+
|
82
|
+
This application requires:
|
83
|
+
|
84
|
+
* Ruby version: 2.7.0
|
85
|
+
|
86
|
+
If you do not have Ruby installed, it is recommended you use ruby-install and chruby to manage Ruby versions.
|
87
|
+
|
88
|
+
```bash
|
89
|
+
brew install ruby-install chruby
|
90
|
+
ruby-install ruby 2.7.0
|
91
|
+
```
|
92
|
+
|
93
|
+
Add the following lines to ~/.bash_profile:
|
94
|
+
|
95
|
+
```bash
|
96
|
+
source /usr/local/opt/chruby/share/chruby/chruby.sh
|
97
|
+
source /usr/local/opt/chruby/share/chruby/auto.sh
|
98
|
+
```
|
99
|
+
|
100
|
+
Set Ruby version to 2.7.0:
|
101
|
+
|
102
|
+
```bash
|
103
|
+
source ~/.bash_profile
|
104
|
+
chruby 2.7.0
|
105
|
+
```
|
106
|
+
|
80
107
|
## Contributing
|
81
108
|
|
82
109
|
Bug reports and pull requests are welcome on GitHub at https://github.com/Zetatango/daffy_lib.
|
83
|
-
|
data/lib/daffy_lib/version.rb
CHANGED
data/lib/tasks/db_tasks.rake
CHANGED
@@ -64,7 +64,7 @@ namespace :db do
|
|
64
64
|
|
65
65
|
model_classname.all.each do |record|
|
66
66
|
encrypted_attributes.each do |attribute|
|
67
|
-
value = record.
|
67
|
+
value = record.send(attribute)
|
68
68
|
record.send("#{attribute}=", value) unless value.blank?
|
69
69
|
end
|
70
70
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daffy_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoît Jeaurond, Weiyun Lu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: attr_encrypted
|
@@ -355,7 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
355
|
- !ruby/object:Gem::Version
|
356
356
|
version: '0'
|
357
357
|
requirements: []
|
358
|
-
rubygems_version: 3.
|
358
|
+
rubygems_version: 3.1.2
|
359
359
|
signing_key:
|
360
360
|
specification_version: 4
|
361
361
|
summary: A library for caching encryptor
|