lockbox 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/LICENSE.txt +1 -1
- data/lib/lockbox/active_storage_extensions.rb +18 -4
- data/lib/lockbox/model.rb +7 -18
- data/lib/lockbox/version.rb +1 -1
- data/lib/lockbox.rb +4 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 732b29630e94d7e05292a10ff4106f05152418a335fb7a5e7da9b5a632c05856
|
4
|
+
data.tar.gz: 8d7d40d7d4f8bb5ecc4737c4664a87bfc33d1f331b0a46d36ebc6a3ce5573ee2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11ba243e0e997a3140a5f3682f38023b9dcf29fdd9c181ea9f693404b4204bd7e83a4caef669126ff9fe432882773ff8f52e129117c201f0dc6eae7de9539849
|
7
|
+
data.tar.gz: 206197fbff415597cb816f77d9354fc8b2ee0c60ceccfb1b5414a44cf19a14b1b9224e09d1c7b0148a9ecb4b0d6673f70f2f35008b6a105bab8e02a55fdf81ce
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
@@ -80,7 +80,7 @@ module Lockbox
|
|
80
80
|
|
81
81
|
module Attachment
|
82
82
|
def download
|
83
|
-
result = super
|
83
|
+
result = super(&nil)
|
84
84
|
|
85
85
|
options = Utils.encrypted_options(record, name)
|
86
86
|
# only trust the metadata when migrating
|
@@ -91,15 +91,29 @@ module Lockbox
|
|
91
91
|
result = Utils.decrypt_result(record, name, options, result)
|
92
92
|
end
|
93
93
|
|
94
|
-
|
94
|
+
if block_given?
|
95
|
+
io = StringIO.new(result)
|
96
|
+
chunk_size = 5.megabytes
|
97
|
+
while (chunk = io.read(chunk_size))
|
98
|
+
yield chunk
|
99
|
+
end
|
100
|
+
else
|
101
|
+
result
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def download_chunk(...)
|
106
|
+
# TODO raise error in 3.0
|
107
|
+
warn "[lockbox] WARNING: download_chunk not supported for encrypted files" if Utils.encrypted_options(record, name)
|
108
|
+
super
|
95
109
|
end
|
96
110
|
|
97
|
-
def variant(
|
111
|
+
def variant(...)
|
98
112
|
raise Lockbox::Error, "Variant not supported for encrypted files" if Utils.encrypted_options(record, name)
|
99
113
|
super
|
100
114
|
end
|
101
115
|
|
102
|
-
def preview(
|
116
|
+
def preview(...)
|
103
117
|
raise Lockbox::Error, "Preview not supported for encrypted files" if Utils.encrypted_options(record, name)
|
104
118
|
super
|
105
119
|
end
|
data/lib/lockbox/model.rb
CHANGED
@@ -377,24 +377,13 @@ module Lockbox
|
|
377
377
|
|
378
378
|
attribute name, attribute_type
|
379
379
|
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
serialize name, type: Array, coder: default_column_serializer || YAML
|
388
|
-
end
|
389
|
-
else
|
390
|
-
case options[:type]
|
391
|
-
when :json
|
392
|
-
serialize name, JSON
|
393
|
-
when :hash
|
394
|
-
serialize name, Hash
|
395
|
-
when :array
|
396
|
-
serialize name, Array
|
397
|
-
end
|
380
|
+
case options[:type]
|
381
|
+
when :json
|
382
|
+
serialize name, coder: JSON
|
383
|
+
when :hash
|
384
|
+
serialize name, type: Hash, coder: default_column_serializer || YAML
|
385
|
+
when :array
|
386
|
+
serialize name, type: Array, coder: default_column_serializer || YAML
|
398
387
|
end
|
399
388
|
elsif ActiveRecord::VERSION::STRING.to_f >= 7.2
|
400
389
|
decorate_attributes([name]) do |attr_name, cast_type|
|
data/lib/lockbox/version.rb
CHANGED
data/lib/lockbox.rb
CHANGED
@@ -98,8 +98,10 @@ end
|
|
98
98
|
if defined?(ActiveSupport.on_load)
|
99
99
|
ActiveSupport.on_load(:active_record) do
|
100
100
|
ar_version = ActiveRecord::VERSION::STRING.to_f
|
101
|
-
if ar_version < 7
|
102
|
-
if ar_version >=
|
101
|
+
if ar_version < 7.1
|
102
|
+
if ar_version >= 7.0
|
103
|
+
raise Lockbox::Error, "Active Record #{ActiveRecord::VERSION::STRING} requires Lockbox < 2.1"
|
104
|
+
elsif ar_version >= 5.2
|
103
105
|
raise Lockbox::Error, "Active Record #{ActiveRecord::VERSION::STRING} requires Lockbox < 2"
|
104
106
|
elsif ar_version >= 5
|
105
107
|
raise Lockbox::Error, "Active Record #{ActiveRecord::VERSION::STRING} requires Lockbox < 0.7"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lockbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
email: andrew@ankane.org
|
13
13
|
executables: []
|
@@ -48,14 +48,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
48
|
requirements:
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: '3.
|
51
|
+
version: '3.2'
|
52
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
requirements: []
|
58
|
-
rubygems_version: 3.6.
|
58
|
+
rubygems_version: 3.6.9
|
59
59
|
specification_version: 4
|
60
60
|
summary: Modern encryption for Ruby and Rails
|
61
61
|
test_files: []
|