lockbox 0.6.6 → 0.6.7

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: 71efd55022975063c04c0a0588532e1bdd5167c7f2e6df5c8cf442362b4d52d6
4
- data.tar.gz: b823faa4b637c300367032b625972f7d41d0e3e12595921d7474140a955c64c7
3
+ metadata.gz: 2b85dd2a91e0fbb6e687dc63a36915c3b67552320f417fe4caed9f27c5b8fbfc
4
+ data.tar.gz: 807037af47e0ee9fae9ed93d95ad0253b68bd6c6ab13ee53ce2cc8de0536e926
5
5
  SHA512:
6
- metadata.gz: 0d7fd7b285c51ac3f80657ec8956d7cd4692481d33710be69dfa567da02dd2f38de7bef9e4b43962395d9241d7d8c452d01f156e2124d957f52ea9026c0ea14f
7
- data.tar.gz: 5d62ccbb565e9a3a6e76c1b6df617377bdcd1003289634cd16a2ba4b0e1d1a1ec72966c2a98dae27959e471fdf9ca77fd0755d25bd75ce6bd1e0cd7755819162
6
+ metadata.gz: 429401bd5b38388d43a07bfbc8cbe4acdac73718e05c5043276092ac0d992f439721beeb2d36320a84b69cd24687838edd9a59f28a39ac7f7797502911bd708a
7
+ data.tar.gz: 412a3eacac1489f931ea1cae22f628fe73eeb9a1d01b568c385f37ede3281f657235ed16b831c2c9c46348d23bb1e6d62a4e5ea857a2e619d0087f4e4e4b89ce
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.6.7 (2022-01-25)
2
+
3
+ - Added warning for attributes with `default` option
4
+ - Removing warning for Active Record 5.0 (still supported)
5
+
1
6
  ## 0.6.6 (2021-09-27)
2
7
 
3
8
  - Fixed `attribute?` method for `boolean` and `integer` types
@@ -25,6 +30,7 @@
25
30
  ## 0.6.1 (2020-12-03)
26
31
 
27
32
  - Added integration with Rails credentials
33
+ - Added warning for unsupported versions of Active Record
28
34
  - Fixed in place changes for Active Record 6.1
29
35
  - Fixed error with `content_type` method for CarrierWave < 2
30
36
 
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
@@ -314,6 +314,16 @@ module Lockbox
314
314
  # uses public_send, so we don't need to preload attribute
315
315
  query_attribute(name)
316
316
  end
317
+
318
+ user_provided_default =
319
+ if ActiveRecord::VERSION::STRING >= "5.2"
320
+ ActiveModel::Attribute::UserProvidedDefault
321
+ else
322
+ ActiveRecord::Attribute::UserProvidedDefault
323
+ end
324
+ if _default_attributes[name.to_s].is_a?(user_provided_default)
325
+ warn "[lockbox] WARNING: attributes with `:default` option are not supported. Use `after_initialize` instead."
326
+ end
317
327
  else
318
328
  # keep this module dead simple
319
329
  # Mongoid uses changed_attributes to calculate keys to update
@@ -1,3 +1,3 @@
1
1
  module Lockbox
2
- VERSION = "0.6.6"
2
+ VERSION = "0.6.7"
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
 
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.6
4
+ version: 0.6.7
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-09-28 00:00:00.000000000 Z
11
+ date: 2022-01-25 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.22
61
+ rubygems_version: 3.3.3
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: Modern encryption for Ruby and Rails