active_enquo 0.5.0 → 0.5.1

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: 9d538e223b9e7485c4b08cf8ac38f2cc6a08f5d3c3b72426167606fdc7a5fdf5
4
- data.tar.gz: 33e80addf4beb8bbe8f5328cbfd093cb70264ec2804d148026cbdabbd36cd1b8
3
+ metadata.gz: 49718410bbe14df7336b1fea307ee9657b3f30e9285a81402a97e783fd68f7b1
4
+ data.tar.gz: d4686e5fc488f9f5769ae412077e802249017c6f6b0de6639a5652c141392582
5
5
  SHA512:
6
- metadata.gz: af6a5e20a215234ce3bce1656a7e02e94f536bf1a3c8d674732d7d49cd8ab5265fe4c306ea730cfe60bba707df5436cf9048d9ce8b85f021fc92639835a0424d
7
- data.tar.gz: e9f6b9d0f5f5f5fb5b6fdecd8ba7fdcadf5b7be0c363787d78a2a989bb753b506d9d914122041614aad4cb3032803d6f5075ec02019a81457104471decd4fec7
6
+ metadata.gz: 65f06c88ba27143f51ed8c791f5e9e6948fa9a65a1bf7c53ec03131ea736a383569c3e9144cca5269dd6b27ce90132b3219fde1f547846145d5d291e72faffaf
7
+ data.tar.gz: 7b4d316abfb7a49268c1a063f60173307ab7175e2ee1ac3c49e45409ae3f8e2f8b854334455c2b3ae55625a312ef968aa648a452f9ab04b272d4572c6b8b7db0
data/active_enquo.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
 
28
28
  s.required_ruby_version = ">= 2.7.0"
29
29
 
30
- s.add_runtime_dependency "enquo-core", "~> 0.7"
30
+ s.add_runtime_dependency "enquo-core", "~> 0.8"
31
31
  s.add_runtime_dependency "activerecord", ">= 6"
32
32
 
33
33
  s.add_development_dependency "bundler"
data/lib/active_enquo.rb CHANGED
@@ -125,8 +125,8 @@ module ActiveEnquo
125
125
 
126
126
  t = self.attribute_types[attr_name.to_s]
127
127
  if t.is_a?(::ActiveEnquo::Type)
128
- relation = self.arel_table.name
129
- field = ::ActiveEnquo.root.field(relation, attr_name)
128
+ relation = self.arel_table.name.to_s
129
+ field = ::ActiveEnquo.root.field(relation, attr_name.to_s)
130
130
  if meta_id.nil?
131
131
  t.encrypt(value, "", field, enable_reduced_security_operations: true)
132
132
  else
@@ -140,8 +140,8 @@ module ActiveEnquo
140
140
  def unenquo(attr_name, value, ctx)
141
141
  t = self.attribute_types[attr_name.to_s]
142
142
  if t.is_a?(::ActiveEnquo::Type)
143
- relation = self.arel_table.name
144
- field = ::ActiveEnquo.root.field(relation, attr_name)
143
+ relation = self.arel_table.name.to_s
144
+ field = ::ActiveEnquo.root.field(relation, attr_name.to_s)
145
145
  begin
146
146
  t.decrypt(value, ctx, field)
147
147
  rescue Enquo::Error
@@ -270,7 +270,7 @@ module ActiveEnquo
270
270
  if value.nil? || value.is_a?(::ActiveRecord::StatementCache::Substitute)
271
271
  value
272
272
  else
273
- field.encrypt_boolean(value, context, safety: enable_reduced_security_operations ? :unsafe : true, no_query: no_query)
273
+ field.encrypt_boolean(value, context, unsafe: enable_reduced_security_operations, no_query: no_query)
274
274
  end
275
275
  end
276
276
 
@@ -288,7 +288,7 @@ module ActiveEnquo
288
288
  if value.nil? || value.is_a?(::ActiveRecord::StatementCache::Substitute)
289
289
  value
290
290
  else
291
- field.encrypt_i64(value, context, safety: enable_reduced_security_operations ? :unsafe : true, no_query: no_query)
291
+ field.encrypt_i64(value, context, unsafe: enable_reduced_security_operations, no_query: no_query)
292
292
  end
293
293
  end
294
294
 
@@ -307,7 +307,7 @@ module ActiveEnquo
307
307
  if value.nil?
308
308
  value
309
309
  else
310
- field.encrypt_date(value, context, safety: enable_reduced_security_operations ? :unsafe : true, no_query: no_query)
310
+ field.encrypt_date(value, context, unsafe: enable_reduced_security_operations, no_query: no_query)
311
311
  end
312
312
  end
313
313
 
@@ -343,7 +343,15 @@ module ActiveEnquo
343
343
  if value.nil? || value.is_a?(::ActiveRecord::StatementCache::Substitute)
344
344
  value
345
345
  else
346
- field.encrypt_text(value.respond_to?(:encode) ? value.encode("UTF-8") : value, context, safety: enable_reduced_security_operations ? :unsafe : true, no_query: no_query, order_prefix_length: enable_ordering ? 8 : nil)
346
+ opts = {
347
+ unsafe: enable_reduced_security_operations,
348
+ no_query: no_query,
349
+ }
350
+ if enable_ordering
351
+ opts[:order_prefix_length] = 8
352
+ end
353
+
354
+ field.encrypt_text(value.respond_to?(:encode) ? value.encode("UTF-8") : value, context, **opts)
347
355
  end
348
356
  end
349
357
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_enquo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-14 00:00:00.000000000 Z
11
+ date: 2023-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: enquo-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.7'
19
+ version: '0.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.7'
26
+ version: '0.8'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement