event_store_client 0.1.21 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/event_store_client/data_decryptor.rb +6 -6
- data/lib/event_store_client/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: 721e082b623b85e16696eb5844e8684757e31f10bf067b264fab176439a8b13f
|
4
|
+
data.tar.gz: 00bed48b77fe8ea55edcb25840b4f111758efca348507a5395970b6cfecffe00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b882a2aa01f9d40debf44418c2e232307c414ec77688822615e7aaa911586523700286d1581c68b3916246ccff8cd098a8211646910d5d995e9bc71306fd852f
|
7
|
+
data.tar.gz: 6f3f2d4dc03dcfdfc7355bd9a4bbf1bb519b6dfc14b33feff7cc285facaf4f28977ed3ff119a3b55e51dfeb1201aaca29b2341b64fa52570e8528a9ba49e5e70
|
@@ -8,9 +8,9 @@ module EventStoreClient
|
|
8
8
|
return decrypted_data if encryption_metadata.empty?
|
9
9
|
|
10
10
|
decrypt_attributes(
|
11
|
-
key: find_key(encryption_metadata[
|
11
|
+
key: find_key(encryption_metadata['key']),
|
12
12
|
data: decrypted_data,
|
13
|
-
attributes: encryption_metadata[
|
13
|
+
attributes: encryption_metadata['attributes']
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
@@ -21,18 +21,18 @@ module EventStoreClient
|
|
21
21
|
attr_reader :key_repository
|
22
22
|
|
23
23
|
def initialize(data:, schema:, repository:)
|
24
|
-
@decrypted_data = deep_dup(data).transform_keys!(&:
|
24
|
+
@decrypted_data = deep_dup(data).transform_keys!(&:to_s)
|
25
25
|
@key_repository = repository
|
26
|
-
@encryption_metadata = schema&.transform_keys(&:
|
26
|
+
@encryption_metadata = schema&.transform_keys(&:to_s) || {}
|
27
27
|
end
|
28
28
|
|
29
29
|
def decrypt_attributes(key:, data:, attributes:)
|
30
30
|
decrypted_text = key_repository.decrypt(
|
31
31
|
key_id: key.id, text: data[:es_encrypted], cipher: key.cipher, iv: key.iv
|
32
32
|
)
|
33
|
-
decrypted = JSON.parse(decrypted_text).transform_keys(&:
|
33
|
+
decrypted = JSON.parse(decrypted_text).transform_keys(&:to_s)
|
34
34
|
decrypted.each { |key, value| data[key] = value if data.key?(key) }
|
35
|
-
data.delete(
|
35
|
+
data.delete('es_encrypted')
|
36
36
|
data
|
37
37
|
end
|
38
38
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_store_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Wilgosz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-schema
|