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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e63a5d88b91862505ce054c8fc0f4f1de5d278eed17a5801d6c82802b5726beb
4
- data.tar.gz: 84d01e2aa79b63f629896141d0943a4b7e3417fe819d0c79cd79f2b2b3efe659
3
+ metadata.gz: 721e082b623b85e16696eb5844e8684757e31f10bf067b264fab176439a8b13f
4
+ data.tar.gz: 00bed48b77fe8ea55edcb25840b4f111758efca348507a5395970b6cfecffe00
5
5
  SHA512:
6
- metadata.gz: b712980458d8f5d48b74917a27dbe33a45e3fc720849985fc10265ef1b4395e64ed750bfe33f8f963d8a5169080c7d4c3e9fae8acba13839f5b3cf3a59153ffa
7
- data.tar.gz: 77cf61b14fe014e4acd42a296f505985f11ab9d44f431e031e9442c793e47e103f43b8563e6f5ceb815e97112d10782174ae1c6edb5ce2172f9193c14a12b86a
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[:key]),
11
+ key: find_key(encryption_metadata['key']),
12
12
  data: decrypted_data,
13
- attributes: encryption_metadata[:attributes]
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!(&:to_sym)
24
+ @decrypted_data = deep_dup(data).transform_keys!(&:to_s)
25
25
  @key_repository = repository
26
- @encryption_metadata = schema&.transform_keys(&:to_sym) || {}
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(&:to_sym)
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(:es_encrypted)
35
+ data.delete('es_encrypted')
36
36
  data
37
37
  end
38
38
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EventStoreClient
4
- VERSION = '0.1.21'
4
+ VERSION = '0.2.0'
5
5
  end
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.1.21
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-22 00:00:00.000000000 Z
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-schema