lockbox 1.1.1 → 1.1.2

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: 1a8a7995008cdd49c48d95e0a968e45666276fb095de76954ef949800080d40b
4
- data.tar.gz: da7d7796776c325ce1871a2755f6cc012c060f16293cbe28a31f2547c92ec0ad
3
+ metadata.gz: 25557e658cab349f0b1e5875b87f3c0a804a5c3aa587171331c5bdbece0ebf2f
4
+ data.tar.gz: 6d9d0e425c3c2107e9cdce85880c9b11db16062c68e1f87706c8f70afac6eef0
5
5
  SHA512:
6
- metadata.gz: d97e45d14fbc7f452eef5e09c2b2d8d3b2c2f5d4b8a42645c0138849b21ef61194f7cf2e36158f4e920b7cc5709cef63a9769310f97cdd40c3f78790415100d0
7
- data.tar.gz: f04c5264be1ec1e69c406593bdc143f10f846776a34744d38a368ba0e0d2662c874315b9387c5e7c53a47621cbabb2da146114008d1b5963dcc3e8b845a86ff2
6
+ metadata.gz: 1df5017733e14858ed3bacb5a480bbe43858974b05a74abe0165d680bb4a6a0e700e49990e5cd8004f8b021c33d6ed0c4edfe3bd5d0e7a02dc114d16894cf02d
7
+ data.tar.gz: 3d51c407d23036699bf2b3a7813eca85c1004e01ba8edda1bc75b5e0e6a1086e3fe1cbd0593f9cab4b0ce7fd16dd1cc320dd6fac8aead84fdfd436530db0ae5a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.1.2 (2023-02-01)
2
+
3
+ - Fixed error when migrating to `array`, `hash`, and `json` types
4
+
1
5
  ## 1.1.1 (2022-12-08)
2
6
 
3
7
  - Fixed error when `StringIO` not loaded
data/lib/lockbox/model.rb CHANGED
@@ -543,8 +543,8 @@ module Lockbox
543
543
  # do nothing
544
544
  # encrypt will convert to binary
545
545
  else
546
- # use original name for serialized attributes
547
- type = (try(:attribute_types) || {})[original_name.to_s]
546
+ # use original name for serialized attributes if no type specified
547
+ type = (try(:attribute_types) || {})[(options[:type] ? name : original_name).to_s]
548
548
  message = type.serialize(message) if type
549
549
  end
550
550
  end
@@ -576,9 +576,9 @@ module Lockbox
576
576
  when :time
577
577
  message = ActiveRecord::Type::Time.new.deserialize(message)
578
578
  when :integer
579
- message = ActiveRecord::Type::Integer.new(limit: 8).deserialize(message.unpack("q>").first)
579
+ message = ActiveRecord::Type::Integer.new(limit: 8).deserialize(message.unpack1("q>"))
580
580
  when :float
581
- message = ActiveRecord::Type::Float.new.deserialize(message.unpack("G").first)
581
+ message = ActiveRecord::Type::Float.new.deserialize(message.unpack1("G"))
582
582
  when :string
583
583
  message.force_encoding(Encoding::UTF_8)
584
584
  when :binary
@@ -590,8 +590,8 @@ module Lockbox
590
590
  message = IPAddr.new_ntoh(addr.first(len))
591
591
  message.prefix = prefix
592
592
  else
593
- # use original name for serialized attributes
594
- type = (try(:attribute_types) || {})[original_name.to_s]
593
+ # use original name for serialized attributes if no type specified
594
+ type = (try(:attribute_types) || {})[(options[:type] ? name : original_name).to_s]
595
595
  message = type.deserialize(message) if type
596
596
  message.force_encoding(Encoding::UTF_8) if !type || type.is_a?(ActiveModel::Type::String)
597
597
  end
@@ -1,3 +1,3 @@
1
1
  module Lockbox
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
data/lib/lockbox.rb CHANGED
@@ -72,7 +72,7 @@ module Lockbox
72
72
  end
73
73
 
74
74
  def self.to_hex(str)
75
- str.unpack("H*").first
75
+ str.unpack1("H*")
76
76
  end
77
77
 
78
78
  def self.new(**options)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-08 00:00:00.000000000 Z
11
+ date: 2023-02-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: andrew@ankane.org
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  - !ruby/object:Gem::Version
59
59
  version: '0'
60
60
  requirements: []
61
- rubygems_version: 3.3.7
61
+ rubygems_version: 3.4.1
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: Modern encryption for Ruby and Rails