event_store_client 2.0.3 → 2.0.5

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: 1e15535ef466d6cd12c499c9bc20877f9496689cc872e4fa668ba18dd3797093
4
- data.tar.gz: 820a5b5e437f2c4b5493f80ba1382388fea97864f1f135ba403c80a8da69666d
3
+ metadata.gz: 4fb2aa608fd561e6504dcf828cf7f79bbbec475a68f73e97a28075548036f2fd
4
+ data.tar.gz: 96e18fab23a42511ac7d9460ee770dcf07cab910fbdd88dbf26b77d7870f8024
5
5
  SHA512:
6
- metadata.gz: c0618d7e6c28b8457c98aaaf3016c1e4e6fd9d46ad6bfe54d0191f8a25dfc0d096a9d9e917dee8dcfda60aa8ca522fb00d714a4c7921e45b8385185c07d2b412
7
- data.tar.gz: 2a0e15686834a505580994c2b382ef52ca19cf3b087828cfd84ee1682083305ec7765d93ce714ccb279b1569da202431212641fe2ff2c94a3501947ca82a363f
6
+ metadata.gz: c21debe01e60efa49f91b850e13ed594d6eca83ca0e96be2844b389f1d02c612a068d7c356565e064eade560dc44aff436fcf66308ff6159d35692bddba89797
7
+ data.tar.gz: c44edabff17c8a6d8321d3c536ffabfd7a22b935847bc0847b64e7ec97b5500d41d89624c6330f780bbaba12b5bfa7339f00934c1be4b2aab6553082c6725a3a
@@ -10,9 +10,11 @@ module EventStoreClient
10
10
 
11
11
  def call
12
12
  return encrypted_data if encryption_metadata.empty?
13
+ result = find_key(encryption_metadata['key'])
14
+ return encrypted_data unless result.success?
13
15
 
14
16
  decrypt_attributes(
15
- key: find_key(encryption_metadata['key']),
17
+ key: result.value!,
16
18
  data: encrypted_data,
17
19
  attributes: encryption_metadata['attributes']
18
20
  )
@@ -49,8 +51,9 @@ module EventStoreClient
49
51
  dupl
50
52
  end
51
53
 
54
+ # @return [Dry::Monads::Result]
52
55
  def find_key(identifier)
53
- key_repository.find(identifier).value!
56
+ key_repository.find(identifier)
54
57
  end
55
58
  end
56
59
  end
@@ -32,6 +32,9 @@ module EventStoreClient
32
32
  # which key should be used as an identifier.
33
33
  # *Returns*: General +Event+ instance with encrypted data
34
34
  def serialize(event)
35
+ # Links does not need to be encrypted
36
+ return Default.new(serializer: serializer).serialize(event) if event.type == '$>'
37
+
35
38
  encryption_schema = (
36
39
  event.class.respond_to?(:encryption_schema) &&
37
40
  event.class.encryption_schema
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EventStoreClient
4
- VERSION = '2.0.3'
4
+ VERSION = '2.0.5'
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: 2.0.3
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Wilgosz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-26 00:00:00.000000000 Z
11
+ date: 2022-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable