lockbox 0.6.4 → 0.6.8

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: 06b9f5c13a4cbdab22a46664beaf453bffa923a7bbebd918adecea008ecbc797
4
- data.tar.gz: 42c68577c2f4b8b4d1b068c01f314893a069b6fd361bd06d87a0de6531636c94
3
+ metadata.gz: 0cc5589dbbfae34908ffdd634798549fa161c7dc79b528f23b8e097a044f3d9d
4
+ data.tar.gz: 3eb23c1dfb284abb335e2addfb20fee77b31373b561ab6c0f9afaf28abf8aeb8
5
5
  SHA512:
6
- metadata.gz: 138df2feafe849bfc5ba80818e1b3695eb107e1f37b0d6654467383bc1788d5803bc00cb753bd7d3a8d3f30773ef4ed3d05f0945a896529d8b685df55b0e10ae
7
- data.tar.gz: 29ad6a9cb2248489caec35bdc56fdbcb6d1d251a0833ec1d597e1e955ac17ccc07626f59ce92683843658fc45311571f495d044f6219075abfcef8b2783dd6a8
6
+ metadata.gz: b0bd8a7ee500cbba73daa2ef0c9c6af07695b53799735f865d5b0e9e907e8ef86904983d5f8cfdff098b554d4cd9d4351133778079bde93a7440bbacf03d0545
7
+ data.tar.gz: ea83a9ecb7734e907a03be89e628fc103815b0cc5acc2aec0c21dc0f2d6b7e746f299a489d4a11b14f413a55c4fb06b45d6e23302c853c8b216ad2bca63218d6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 0.6.8 (2022-01-25)
2
+
3
+ - Fixed issue with `encrypts` loading model schema early
4
+ - Removed warning for attributes with `default` option
5
+
6
+ ## 0.6.7 (2022-01-25)
7
+
8
+ - Added warning for attributes with `default` option
9
+ - Removed warning for Active Record 5.0 (still supported)
10
+
11
+ ## 0.6.6 (2021-09-27)
12
+
13
+ - Fixed `attribute?` method for `boolean` and `integer` types
14
+
15
+ ## 0.6.5 (2021-07-07)
16
+
17
+ - Fixed issue with `pluck` extension not loading in some cases
18
+
1
19
  ## 0.6.4 (2021-04-05)
2
20
 
3
21
  - Fixed in place changes in callbacks
@@ -17,6 +35,7 @@
17
35
  ## 0.6.1 (2020-12-03)
18
36
 
19
37
  - Added integration with Rails credentials
38
+ - Added warning for unsupported versions of Active Record
20
39
  - Fixed in place changes for Active Record 6.1
21
40
  - Fixed error with `content_type` method for CarrierWave < 2
22
41
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018-2021 Andrew Kane
3
+ Copyright (c) 2018-2022 Andrew Kane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -16,7 +16,7 @@ Learn [the principles behind it](https://ankane.org/modern-encryption-rails), [h
16
16
  Add this line to your application’s Gemfile:
17
17
 
18
18
  ```ruby
19
- gem 'lockbox'
19
+ gem "lockbox"
20
20
  ```
21
21
 
22
22
  ## Key Generation
@@ -87,6 +87,8 @@ class User < ApplicationRecord
87
87
  end
88
88
  ```
89
89
 
90
+ **Note:** With Rails 7, use `lockbox_encrypts` instead of `encrypts`
91
+
90
92
  You can use `email` just like any other attribute.
91
93
 
92
94
  ```ruby
@@ -336,6 +338,8 @@ def license
336
338
  end
337
339
  ```
338
340
 
341
+ Use `filename` to specify a filename or `disposition: "inline"` to show inline.
342
+
339
343
  #### Migrating Existing Files
340
344
 
341
345
  Lockbox makes it easy to encrypt existing files without downtime.
@@ -401,6 +405,8 @@ def license
401
405
  end
402
406
  ```
403
407
 
408
+ Use `filename` to specify a filename or `disposition: "inline"` to show inline.
409
+
404
410
  #### Migrating Existing Files
405
411
 
406
412
  Encrypt existing files without downtime. Create a new encrypted uploader:
@@ -476,6 +482,8 @@ def license
476
482
  end
477
483
  ```
478
484
 
485
+ Use `filename` to specify a filename or `disposition: "inline"` to show inline.
486
+
479
487
  #### Non-Models
480
488
 
481
489
  Generate a key
@@ -711,7 +719,7 @@ brew install libsodium
711
719
  And add to your Gemfile:
712
720
 
713
721
  ```ruby
714
- gem 'rbnacl'
722
+ gem "rbnacl"
715
723
  ```
716
724
 
717
725
  Then add to your model:
data/lib/lockbox/model.rb CHANGED
@@ -309,6 +309,11 @@ module Lockbox
309
309
  super()
310
310
  end
311
311
  end
312
+
313
+ define_method("#{name}?") do
314
+ # uses public_send, so we don't need to preload attribute
315
+ query_attribute(name)
316
+ end
312
317
  else
313
318
  # keep this module dead simple
314
319
  # Mongoid uses changed_attributes to calculate keys to update
@@ -348,10 +353,10 @@ module Lockbox
348
353
  send("reset_#{encrypted_attribute}_to_default!")
349
354
  send(name)
350
355
  end
351
- end
352
356
 
353
- define_method("#{name}?") do
354
- send("#{encrypted_attribute}?")
357
+ define_method("#{name}?") do
358
+ send("#{encrypted_attribute}?")
359
+ end
355
360
  end
356
361
 
357
362
  define_method("#{name}=") do |message|
@@ -1,3 +1,3 @@
1
1
  module Lockbox
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.8"
3
3
  end
data/lib/lockbox.rb CHANGED
@@ -28,7 +28,7 @@ end
28
28
  if defined?(ActiveSupport.on_load)
29
29
  ActiveSupport.on_load(:active_record) do
30
30
  # TODO raise error in 0.7.0
31
- if ActiveRecord::VERSION::STRING.to_f <= 5.0
31
+ if ActiveRecord::VERSION::STRING.to_f < 5.0
32
32
  warn "Active Record version (#{ActiveRecord::VERSION::STRING}) not supported in this version of Lockbox (#{Lockbox::VERSION})"
33
33
  end
34
34
 
@@ -36,7 +36,7 @@ if defined?(ActiveSupport.on_load)
36
36
  extend Lockbox::Model::Attached
37
37
  # alias_method is private in Ruby < 2.5
38
38
  singleton_class.send(:alias_method, :encrypts, :lockbox_encrypts) if ActiveRecord::VERSION::MAJOR < 7
39
- ActiveRecord::Calculations.prepend Lockbox::Calculations
39
+ ActiveRecord::Relation.prepend Lockbox::Calculations
40
40
  end
41
41
 
42
42
  ActiveSupport.on_load(:mongoid) do
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: 0.6.4
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-06 00:00:00.000000000 Z
11
+ date: 2022-01-26 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.2.3
61
+ rubygems_version: 3.3.3
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: Modern encryption for Ruby and Rails