daffy_lib 0.1.0 → 0.1.1

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
2
  SHA256:
3
- metadata.gz: bfb79b6e65591c6715f7080e01034c9e1fed2badbe039916fe841c588cafb066
4
- data.tar.gz: c61a0784c8affbfc901ad7f150916409ab4d86d922c356ae854799a886d0940b
3
+ metadata.gz: 83018eb7ecab966f8b2735dfdf734799b847e275b53c0c744cf11ea3cbb090f9
4
+ data.tar.gz: b7d09dad2fb06cd398ac783b7dec39b6fa0891098691a5c95d41efbd459e4848
5
5
  SHA512:
6
- metadata.gz: 0b551da929e73c9e5cbf5a86ffbad67f872b23a8b58d3746095ce327bfa30d2cb5961dde8c20ad61a6100373c674adaa8bfb692c434f70261b77689a8ae10e1e
7
- data.tar.gz: b448bcdf31e40c3a1169725a9a0b0cb553601191323118dfb67df9ba92e592f7dee0481e0d1c1d5c67c3663ab72dc73fb56130e6c02b645fd6c44f83cad04fdd
6
+ metadata.gz: 1a2708f077f87e1d3b316449b387114f82315ab4983e733bcda749c2b59cf8cd9fc9c4d0a9956b68f4f7b67e7c3ad40777869ecca58a80645502715c279050d2
7
+ data.tar.gz: bf09073a430ad69567c4069727d5d9f3fab1cf8afa01f8de7cc8cdd205f21cf757cc8e39914aad7b6cc0ad22ba7c0484fc91907152c9c3cc99ad386c77007506
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- daffy_lib (0.1.0)
4
+ daffy_lib (0.1.1)
5
5
  porky_lib
6
6
  rails
7
7
  redis
@@ -69,7 +69,7 @@ GEM
69
69
  encryptor (~> 3.0.0)
70
70
  aws-eventstream (1.0.3)
71
71
  aws-partitions (1.263.0)
72
- aws-sdk-core (3.89.0)
72
+ aws-sdk-core (3.89.1)
73
73
  aws-eventstream (~> 1.0, >= 1.0.2)
74
74
  aws-partitions (~> 1, >= 1.239.0)
75
75
  aws-sigv4 (~> 1.1)
@@ -244,7 +244,6 @@ DEPENDENCIES
244
244
  codecov
245
245
  daffy_lib!
246
246
  factory_bot_rails
247
- porky_lib
248
247
  rake
249
248
  rspec
250
249
  rspec-collection_matchers
data/README.md CHANGED
@@ -27,7 +27,7 @@ The `User` class will need to `include DaffyLib::PartitionProvider` and implemen
27
27
 
28
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
- It then needs to implement a `generate_partition_guid` which returns the linked `User`'s `guid`, as well as a `generate_encryption_epoch` method which defines the encryption epoch. The suggested implementations are:
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
 
32
32
  ```
33
33
  def generate_partition_guid
@@ -42,6 +42,8 @@ It then needs to implement a `generate_partition_guid` which returns the linked
42
42
  self.encryption_epoch = DaffyLib::KeyManagementService.encryption_key_epoch(Time.now)
43
43
  end
44
44
  ```
45
+
46
+ These work for the general case of a model with encrypted attributes that has a partition provider other than itself, and for an encryption epoch period of 1 year. They can be overriden if necessary.
45
47
 
46
48
  Now suppose the `User::Attributes` has a `values` field to be encrypted. One declares
47
49
 
Binary file
@@ -10,11 +10,15 @@ module DaffyLib::HasEncryptedAttributes
10
10
  end
11
11
 
12
12
  def generate_partition_guid
13
- raise NoMethodError
13
+ return partition_guid if partition_guid.present?
14
+
15
+ self.partition_guid = provider_partition_guid
14
16
  end
15
17
 
16
18
  def generate_encryption_epoch
17
- raise NoMethodError
19
+ return encryption_epoch if encryption_epoch.present?
20
+
21
+ self.encryption_epoch = DaffyLib::KeyManagementService.encryption_key_epoch(Time.now)
18
22
  end
19
23
 
20
24
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DaffyLib
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
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.0
4
+ version: 0.1.1
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-01-15 00:00:00.000000000 Z
11
+ date: 2020-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attr_encrypted
@@ -324,6 +324,7 @@ files:
324
324
  - SECURITY.MD
325
325
  - bin/console
326
326
  - bin/setup
327
+ - daffy_lib-0.1.0.gem
327
328
  - daffy_lib.gemspec
328
329
  - lib/daffy_lib.rb
329
330
  - lib/daffy_lib/caching_encryptor.rb