attr_encrypted 3.1.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/CI.yml +43 -0
- data/CHANGELOG.md +47 -18
- data/README.md +16 -10
- data/Rakefile +2 -0
- data/attr_encrypted.gemspec +8 -21
- data/checksum/attr_encrypted-3.1.0.gem.sha256 +1 -0
- data/checksum/attr_encrypted-3.1.0.gem.sha512 +1 -0
- data/lib/attr_encrypted/adapters/active_record.rb +31 -18
- data/lib/attr_encrypted/adapters/sequel.rb +3 -1
- data/lib/attr_encrypted/version.rb +3 -1
- data/lib/attr_encrypted.rb +42 -30
- data/test/active_record_test.rb +55 -56
- data/test/attr_encrypted_test.rb +31 -10
- data/test/compatibility_test.rb +2 -0
- data/test/legacy_active_record_test.rb +11 -3
- data/test/legacy_attr_encrypted_test.rb +8 -6
- data/test/legacy_compatibility_test.rb +2 -0
- data/test/legacy_sequel_test.rb +2 -0
- data/test/run.sh +15 -7
- data/test/sequel_test.rb +2 -0
- data/test/test_helper.rb +10 -13
- metadata +35 -80
- checksums.yaml.gz.sig +0 -1
- data/.travis.yml +0 -60
- data/certs/saghaulor.pem +0 -21
- data/lib/attr_encrypted/adapters/data_mapper.rb +0 -22
- data/test/data_mapper_test.rb +0 -57
- data/test/legacy_data_mapper_test.rb +0 -55
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
metadata
CHANGED
@@ -1,39 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_encrypted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Huber
|
8
8
|
- S. Brent Faulkner
|
9
9
|
- William Monk
|
10
10
|
- Stephen Aghaulor
|
11
|
-
|
11
|
+
- Josh Branham
|
12
|
+
- Mike Vastola
|
13
|
+
autorequire:
|
12
14
|
bindir: bin
|
13
|
-
cert_chain:
|
14
|
-
-
|
15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m6zahYQ/L1/HFztLoMBMkm8EIfPxH0PDrP4aWl0oyWxmU
|
31
|
-
OLm0/t9icSWRPPJ1tLJvuAaDdVpY5dEHd6VdnNJGQC5vHKRInt1kEyqEttIJ/xmJ
|
32
|
-
leSEFyMeoFsR+C/WPG9WSC+xN0eXqakCu6YUJoQzCn/7znv8WxpHEbeZjNIHq0qb
|
33
|
-
nbqZ/ZW1bwzj1T/NIbnMr37wqV29XwkI4+LbewMkb6/bDPYl0qZpAkCxKtGYCCJp
|
34
|
-
l6KPs9K/72yH00dxuAhiTXikTkcLXeQJ
|
35
|
-
-----END CERTIFICATE-----
|
36
|
-
date: 2018-02-11 00:00:00.000000000 Z
|
15
|
+
cert_chain: []
|
16
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
37
17
|
dependencies:
|
38
18
|
- !ruby/object:Gem::Dependency
|
39
19
|
name: encryptor
|
@@ -53,44 +33,30 @@ dependencies:
|
|
53
33
|
name: activerecord
|
54
34
|
requirement: !ruby/object:Gem::Requirement
|
55
35
|
requirements:
|
56
|
-
- - "
|
36
|
+
- - ">="
|
57
37
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
38
|
+
version: 2.0.0
|
59
39
|
type: :development
|
60
40
|
prerelease: false
|
61
41
|
version_requirements: !ruby/object:Gem::Requirement
|
62
42
|
requirements:
|
63
|
-
- - "
|
43
|
+
- - ">="
|
64
44
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
45
|
+
version: 2.0.0
|
66
46
|
- !ruby/object:Gem::Dependency
|
67
47
|
name: actionpack
|
68
|
-
requirement: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
70
|
-
- - "~>"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: 4.1.16
|
73
|
-
type: :development
|
74
|
-
prerelease: false
|
75
|
-
version_requirements: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - "~>"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 4.1.16
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: datamapper
|
82
48
|
requirement: !ruby/object:Gem::Requirement
|
83
49
|
requirements:
|
84
50
|
- - ">="
|
85
51
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
52
|
+
version: 2.0.0
|
87
53
|
type: :development
|
88
54
|
prerelease: false
|
89
55
|
version_requirements: !ruby/object:Gem::Requirement
|
90
56
|
requirements:
|
91
57
|
- - ">="
|
92
58
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
59
|
+
version: 2.0.0
|
94
60
|
- !ruby/object:Gem::Dependency
|
95
61
|
name: rake
|
96
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,16 +103,16 @@ dependencies:
|
|
137
103
|
name: sqlite3
|
138
104
|
requirement: !ruby/object:Gem::Requirement
|
139
105
|
requirements:
|
140
|
-
- -
|
106
|
+
- - '='
|
141
107
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
108
|
+
version: 1.5.4
|
143
109
|
type: :development
|
144
110
|
prerelease: false
|
145
111
|
version_requirements: !ruby/object:Gem::Requirement
|
146
112
|
requirements:
|
147
|
-
- -
|
113
|
+
- - '='
|
148
114
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
115
|
+
version: 1.5.4
|
150
116
|
- !ruby/object:Gem::Dependency
|
151
117
|
name: dm-sqlite-adapter
|
152
118
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +128,7 @@ dependencies:
|
|
162
128
|
- !ruby/object:Gem::Version
|
163
129
|
version: '0'
|
164
130
|
- !ruby/object:Gem::Dependency
|
165
|
-
name:
|
131
|
+
name: pry
|
166
132
|
requirement: !ruby/object:Gem::Requirement
|
167
133
|
requirements:
|
168
134
|
- - ">="
|
@@ -176,7 +142,7 @@ dependencies:
|
|
176
142
|
- !ruby/object:Gem::Version
|
177
143
|
version: '0'
|
178
144
|
- !ruby/object:Gem::Dependency
|
179
|
-
name: simplecov
|
145
|
+
name: simplecov
|
180
146
|
requirement: !ruby/object:Gem::Requirement
|
181
147
|
requirements:
|
182
148
|
- - ">="
|
@@ -190,38 +156,39 @@ dependencies:
|
|
190
156
|
- !ruby/object:Gem::Version
|
191
157
|
version: '0'
|
192
158
|
- !ruby/object:Gem::Dependency
|
193
|
-
name:
|
159
|
+
name: simplecov-rcov
|
194
160
|
requirement: !ruby/object:Gem::Requirement
|
195
161
|
requirements:
|
196
|
-
- - "
|
162
|
+
- - ">="
|
197
163
|
- !ruby/object:Gem::Version
|
198
|
-
version: 0
|
164
|
+
version: '0'
|
199
165
|
type: :development
|
200
166
|
prerelease: false
|
201
167
|
version_requirements: !ruby/object:Gem::Requirement
|
202
168
|
requirements:
|
203
|
-
- - "
|
169
|
+
- - ">="
|
204
170
|
- !ruby/object:Gem::Version
|
205
|
-
version: 0
|
171
|
+
version: '0'
|
206
172
|
description: Generates attr_accessors that encrypt and decrypt attributes transparently
|
207
173
|
email:
|
208
174
|
- seah@shuber.io
|
209
175
|
- sbfaulkner@gmail.com
|
210
176
|
- billy.monk@gmail.com
|
211
177
|
- saghaulor@gmail.com
|
178
|
+
- josh.php@gmail.com
|
179
|
+
- Mike@Vasto.la
|
212
180
|
executables: []
|
213
181
|
extensions: []
|
214
182
|
extra_rdoc_files: []
|
215
183
|
files:
|
184
|
+
- ".github/workflows/CI.yml"
|
216
185
|
- ".gitignore"
|
217
|
-
- ".travis.yml"
|
218
186
|
- CHANGELOG.md
|
219
187
|
- Gemfile
|
220
188
|
- MIT-LICENSE
|
221
189
|
- README.md
|
222
190
|
- Rakefile
|
223
191
|
- attr_encrypted.gemspec
|
224
|
-
- certs/saghaulor.pem
|
225
192
|
- checksum/attr_encrypted-3.0.0.gem.sha256
|
226
193
|
- checksum/attr_encrypted-3.0.0.gem.sha512
|
227
194
|
- checksum/attr_encrypted-3.0.1.gem.sha256
|
@@ -230,19 +197,18 @@ files:
|
|
230
197
|
- checksum/attr_encrypted-3.0.2.gem.sha512
|
231
198
|
- checksum/attr_encrypted-3.0.3.gem.sha256
|
232
199
|
- checksum/attr_encrypted-3.0.3.gem.sha512
|
200
|
+
- checksum/attr_encrypted-3.1.0.gem.sha256
|
201
|
+
- checksum/attr_encrypted-3.1.0.gem.sha512
|
233
202
|
- lib/attr_encrypted.rb
|
234
203
|
- lib/attr_encrypted/adapters/active_record.rb
|
235
|
-
- lib/attr_encrypted/adapters/data_mapper.rb
|
236
204
|
- lib/attr_encrypted/adapters/sequel.rb
|
237
205
|
- lib/attr_encrypted/version.rb
|
238
206
|
- test/active_record_test.rb
|
239
207
|
- test/attr_encrypted_test.rb
|
240
208
|
- test/compatibility_test.rb
|
241
|
-
- test/data_mapper_test.rb
|
242
209
|
- test/legacy_active_record_test.rb
|
243
210
|
- test/legacy_attr_encrypted_test.rb
|
244
211
|
- test/legacy_compatibility_test.rb
|
245
|
-
- test/legacy_data_mapper_test.rb
|
246
212
|
- test/legacy_sequel_test.rb
|
247
213
|
- test/run.sh
|
248
214
|
- test/sequel_test.rb
|
@@ -255,48 +221,37 @@ post_install_message: |2+
|
|
255
221
|
|
256
222
|
|
257
223
|
|
258
|
-
WARNING:
|
259
|
-
|
260
|
-
Additionally, there was a bug in Encryptor v2.0.0 that insecurely encrypted data when using an AES-*-GCM algorithm.
|
261
|
-
|
262
|
-
This bug was fixed but introduced breaking changes between v2.x and v3.x.
|
263
|
-
|
264
|
-
Please see the README for more information regarding upgrading to attr_encrypted v3.0.0.
|
224
|
+
WARNING: Using `#encrypted_attributes` is no longer supported. Instead, use `#attr_encrypted_encrypted_attributes` to avoid
|
225
|
+
collision with Active Record 7 native encryption.
|
265
226
|
|
266
227
|
|
267
|
-
rdoc_options:
|
268
|
-
- "--line-numbers"
|
269
|
-
- "--inline-source"
|
270
|
-
- "--main"
|
271
|
-
- README.rdoc
|
228
|
+
rdoc_options: []
|
272
229
|
require_paths:
|
273
230
|
- lib
|
274
231
|
required_ruby_version: !ruby/object:Gem::Requirement
|
275
232
|
requirements:
|
276
233
|
- - ">="
|
277
234
|
- !ruby/object:Gem::Version
|
278
|
-
version: 2.
|
235
|
+
version: 2.6.0
|
279
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
237
|
requirements:
|
281
238
|
- - ">="
|
282
239
|
- !ruby/object:Gem::Version
|
283
240
|
version: '0'
|
284
241
|
requirements: []
|
285
|
-
|
286
|
-
|
287
|
-
signing_key:
|
242
|
+
rubygems_version: 3.4.10
|
243
|
+
signing_key:
|
288
244
|
specification_version: 4
|
289
245
|
summary: Encrypt and decrypt attributes
|
290
246
|
test_files:
|
291
247
|
- test/active_record_test.rb
|
292
248
|
- test/attr_encrypted_test.rb
|
293
249
|
- test/compatibility_test.rb
|
294
|
-
- test/data_mapper_test.rb
|
295
250
|
- test/legacy_active_record_test.rb
|
296
251
|
- test/legacy_attr_encrypted_test.rb
|
297
252
|
- test/legacy_compatibility_test.rb
|
298
|
-
- test/legacy_data_mapper_test.rb
|
299
253
|
- test/legacy_sequel_test.rb
|
300
254
|
- test/run.sh
|
301
255
|
- test/sequel_test.rb
|
302
256
|
- test/test_helper.rb
|
257
|
+
...
|
checksums.yaml.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
)��`'\������l{�����-��p.�I�K�y��4�˕��`�{�¹�͏�L������uho�dވE��VHzP ����UO�#�t.���o���/��t�јz}���#3l`a�JDKc�����)^�� ���?�<���^E��2& �BoF�qZ��9��������69Z��s.���(h�U���?�{���zp?�P��\3���� m����N�Kj�#`0n�9J�Otݼ�{ޣ��}�� �)
|
data/.travis.yml
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
rvm:
|
5
|
-
- 2.0
|
6
|
-
- 2.1
|
7
|
-
- 2.2.2
|
8
|
-
- 2.3.0
|
9
|
-
- 2.4.0
|
10
|
-
- 2.5.0
|
11
|
-
- rbx
|
12
|
-
env:
|
13
|
-
- ACTIVERECORD=3.0.0
|
14
|
-
- ACTIVERECORD=3.1.0
|
15
|
-
- ACTIVERECORD=3.2.0
|
16
|
-
- ACTIVERECORD=4.0.0
|
17
|
-
- ACTIVERECORD=4.1.0
|
18
|
-
- ACTIVERECORD=4.2.0
|
19
|
-
- ACTIVERECORD=5.0.0
|
20
|
-
- ACTIVERECORD=5.1.1
|
21
|
-
matrix:
|
22
|
-
exclude:
|
23
|
-
- rvm: 2.0
|
24
|
-
env: ACTIVERECORD=5.0.0
|
25
|
-
- rvm: 2.0
|
26
|
-
env: ACTIVERECORD=5.1.1
|
27
|
-
- rvm: 2.1
|
28
|
-
env: ACTIVERECORD=5.0.0
|
29
|
-
- rvm: 2.1
|
30
|
-
env: ACTIVERECORD=5.1.1
|
31
|
-
- rvm: 2.4.0
|
32
|
-
env: ACTIVERECORD=3.0.0
|
33
|
-
- rvm: 2.4.0
|
34
|
-
env: ACTIVERECORD=3.1.0
|
35
|
-
- rvm: 2.4.0
|
36
|
-
env: ACTIVERECORD=3.2.0
|
37
|
-
- rvm: 2.4.0
|
38
|
-
env: ACTIVERECORD=4.0.0
|
39
|
-
- rvm: 2.4.0
|
40
|
-
env: ACTIVERECORD=4.1.0
|
41
|
-
- rvm: 2.5.0
|
42
|
-
env: ACTIVERECORD=3.0.0
|
43
|
-
- rvm: 2.5.0
|
44
|
-
env: ACTIVERECORD=3.1.0
|
45
|
-
- rvm: 2.5.0
|
46
|
-
env: ACTIVERECORD=3.2.0
|
47
|
-
- rvm: 2.5.0
|
48
|
-
env: ACTIVERECORD=4.0.0
|
49
|
-
- rvm: 2.5.0
|
50
|
-
env: ACTIVERECORD=4.1.0
|
51
|
-
- rvm: rbx
|
52
|
-
env: ACTIVERECORD=5.0.0
|
53
|
-
- rvm: rbx
|
54
|
-
env: ACTIVERECORD=5.1.1
|
55
|
-
allow_failures:
|
56
|
-
- rvm: rbx
|
57
|
-
fast_finish: true
|
58
|
-
addons:
|
59
|
-
code_climate:
|
60
|
-
repo_token: a90435ed4954dd6e9f3697a20c5bc3754f67d94703f870e8fc7b00f69f5b2d06
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lYsy7Wz6GEoOpD
|
16
|
-
bzRkjxZwGNbhXShMUZwm6zahYQ/L1/HFztLoMBMkm8EIfPxH0PDrP4aWl0oyWxmU
|
17
|
-
OLm0/t9icSWRPPJ1tLJvuAaDdVpY5dEHd6VdnNJGQC5vHKRInt1kEyqEttIJ/xmJ
|
18
|
-
leSEFyMeoFsR+C/WPG9WSC+xN0eXqakCu6YUJoQzCn/7znv8WxpHEbeZjNIHq0qb
|
19
|
-
nbqZ/ZW1bwzj1T/NIbnMr37wqV29XwkI4+LbewMkb6/bDPYl0qZpAkCxKtGYCCJp
|
20
|
-
l6KPs9K/72yH00dxuAhiTXikTkcLXeQJ
|
21
|
-
-----END CERTIFICATE-----
|
@@ -1,22 +0,0 @@
|
|
1
|
-
if defined?(DataMapper)
|
2
|
-
module AttrEncrypted
|
3
|
-
module Adapters
|
4
|
-
module DataMapper
|
5
|
-
def self.extended(base) # :nodoc:
|
6
|
-
class << base
|
7
|
-
alias_method :included_without_attr_encrypted, :included
|
8
|
-
alias_method :included, :included_with_attr_encrypted
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def included_with_attr_encrypted(base)
|
13
|
-
included_without_attr_encrypted(base)
|
14
|
-
base.extend AttrEncrypted
|
15
|
-
base.attr_encrypted_options[:encode] = true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
DataMapper::Resource.extend AttrEncrypted::Adapters::DataMapper
|
22
|
-
end
|
data/test/data_mapper_test.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require_relative 'test_helper'
|
2
|
-
|
3
|
-
DataMapper.setup(:default, 'sqlite3::memory:')
|
4
|
-
|
5
|
-
class Client
|
6
|
-
include DataMapper::Resource
|
7
|
-
|
8
|
-
property :id, Serial
|
9
|
-
property :encrypted_email, String
|
10
|
-
property :encrypted_email_iv, String
|
11
|
-
property :encrypted_email_salt, String
|
12
|
-
|
13
|
-
property :encrypted_credentials, Text
|
14
|
-
property :encrypted_credentials_iv, Text
|
15
|
-
property :encrypted_credentials_salt, Text
|
16
|
-
|
17
|
-
self.attr_encrypted_options[:mode] = :per_attribute_iv_and_salt
|
18
|
-
|
19
|
-
attr_encrypted :email, :key => SECRET_KEY
|
20
|
-
attr_encrypted :credentials, :key => SECRET_KEY, :marshal => true
|
21
|
-
|
22
|
-
def initialize(attrs = {})
|
23
|
-
super attrs
|
24
|
-
self.credentials ||= { :username => 'example', :password => 'test' }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
DataMapper.auto_migrate!
|
29
|
-
|
30
|
-
class DataMapperTest < Minitest::Test
|
31
|
-
|
32
|
-
def setup
|
33
|
-
Client.all.each(&:destroy)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_should_encrypt_email
|
37
|
-
@client = Client.new :email => 'test@example.com'
|
38
|
-
assert @client.save
|
39
|
-
refute_nil @client.encrypted_email
|
40
|
-
refute_equal @client.email, @client.encrypted_email
|
41
|
-
assert_equal @client.email, Client.first.email
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_should_marshal_and_encrypt_credentials
|
45
|
-
@client = Client.new
|
46
|
-
assert @client.save
|
47
|
-
refute_nil @client.encrypted_credentials
|
48
|
-
refute_equal @client.credentials, @client.encrypted_credentials
|
49
|
-
assert_equal @client.credentials, Client.first.credentials
|
50
|
-
assert Client.first.credentials.is_a?(Hash)
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_should_encode_by_default
|
54
|
-
assert Client.attr_encrypted_options[:encode]
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require_relative 'test_helper'
|
2
|
-
|
3
|
-
DataMapper.setup(:default, 'sqlite3::memory:')
|
4
|
-
|
5
|
-
class LegacyClient
|
6
|
-
include DataMapper::Resource
|
7
|
-
self.attr_encrypted_options[:insecure_mode] = true
|
8
|
-
self.attr_encrypted_options[:algorithm] = 'aes-256-cbc'
|
9
|
-
self.attr_encrypted_options[:mode] = :single_iv_and_salt
|
10
|
-
|
11
|
-
property :id, Serial
|
12
|
-
property :encrypted_email, String
|
13
|
-
property :encrypted_credentials, Text
|
14
|
-
property :salt, String
|
15
|
-
|
16
|
-
attr_encrypted :email, :key => 'a secret key', mode: :single_iv_and_salt
|
17
|
-
attr_encrypted :credentials, :key => Proc.new { |client| Encryptor.encrypt(:value => client.salt, :key => 'some private key', insecure_mode: true, algorithm: 'aes-256-cbc') }, :marshal => true, mode: :single_iv_and_salt
|
18
|
-
|
19
|
-
def initialize(attrs = {})
|
20
|
-
super attrs
|
21
|
-
self.salt ||= Digest::SHA1.hexdigest((Time.now.to_i * rand(5)).to_s)
|
22
|
-
self.credentials ||= { :username => 'example', :password => 'test' }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
DataMapper.auto_migrate!
|
27
|
-
|
28
|
-
class LegacyDataMapperTest < Minitest::Test
|
29
|
-
|
30
|
-
def setup
|
31
|
-
LegacyClient.all.each(&:destroy)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_should_encrypt_email
|
35
|
-
@client = LegacyClient.new :email => 'test@example.com'
|
36
|
-
assert @client.save
|
37
|
-
refute_nil @client.encrypted_email
|
38
|
-
refute_equal @client.email, @client.encrypted_email
|
39
|
-
assert_equal @client.email, LegacyClient.first.email
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_should_marshal_and_encrypt_credentials
|
43
|
-
@client = LegacyClient.new
|
44
|
-
assert @client.save
|
45
|
-
refute_nil @client.encrypted_credentials
|
46
|
-
refute_equal @client.credentials, @client.encrypted_credentials
|
47
|
-
assert_equal @client.credentials, LegacyClient.first.credentials
|
48
|
-
assert LegacyClient.first.credentials.is_a?(Hash)
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_should_encode_by_default
|
52
|
-
assert LegacyClient.attr_encrypted_options[:encode]
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Ae�mL������6>�o(p���{��~x�O.]L�|ZgfQ�L44uؤ��:��S!o�@�Ğ���au9s- Xx�6�����M
|