48 lines
2.3 KiB
Text
48 lines
2.3 KiB
Text
--- devise-two-factor.gemspec.orig 2023-05-07 17:19:51 UTC
|
|
+++ devise-two-factor.gemspec
|
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
|
|
s.add_runtime_dependency(%q<railties>.freeze, ["< 7.1"])
|
|
s.add_runtime_dependency(%q<activesupport>.freeze, ["< 7.1"])
|
|
- s.add_runtime_dependency(%q<attr_encrypted>.freeze, [">= 1.3", "< 4", "!= 2"])
|
|
+ s.add_runtime_dependency(%q<attr_encrypted>.freeze, [">= 1.3", "< 5", "!= 2"])
|
|
s.add_runtime_dependency(%q<devise>.freeze, ["~> 4.0"])
|
|
s.add_runtime_dependency(%q<rotp>.freeze, ["~> 6.0"])
|
|
s.add_development_dependency(%q<activemodel>.freeze, [">= 0"])
|
|
--- spec/devise/models/two_factor_authenticatable_spec.rb.orig 2023-05-07 17:23:37 UTC
|
|
+++ spec/devise/models/two_factor_authenticatable_spec.rb
|
|
@@ -64,15 +64,31 @@ describe ::Devise::Models::TwoFactorAuthenticatable do
|
|
|
|
describe 'otp_secret options' do
|
|
it 'should be of the key' do
|
|
- expect(subject.encrypted_attributes[:otp_secret][:key]).to eq('test-key'*8)
|
|
+ if attr_encrypted_is_rails_seven_compatible?
|
|
+ expect(subject.attr_encrypted_encrypted_attributes[:otp_secret][:key]).to eq('test-key'*8)
|
|
+ else
|
|
+ expect(subject.encrypted_attributes[:otp_secret][:key]).to eq('test-key'*8)
|
|
+ end
|
|
end
|
|
|
|
it 'should be of the mode' do
|
|
- expect(subject.encrypted_attributes[:otp_secret][:mode]).to eq(:per_attribute_iv_and_salt)
|
|
+ if attr_encrypted_is_rails_seven_compatible?
|
|
+ expect(subject.attr_encrypted_encrypted_attributes[:otp_secret][:mode]).to eq(:per_attribute_iv_and_salt)
|
|
+ else
|
|
+ expect(subject.encrypted_attributes[:otp_secret][:mode]).to eq(:per_attribute_iv_and_salt)
|
|
+ end
|
|
end
|
|
|
|
it 'should be of the mode' do
|
|
- expect(subject.encrypted_attributes[:otp_secret][:algorithm]).to eq('aes-256-cbc')
|
|
+ if attr_encrypted_is_rails_seven_compatible?
|
|
+ expect(subject.attr_encrypted_encrypted_attributes[:otp_secret][:algorithm]).to eq('aes-256-cbc')
|
|
+ else
|
|
+ expect(subject.encrypted_attributes[:otp_secret][:algorithm]).to eq('aes-256-cbc')
|
|
+ end
|
|
+ end
|
|
+
|
|
+ def attr_encrypted_is_rails_seven_compatible?
|
|
+ Gem::Version.new(AttrEncrypted::Version.string) >= Gem::Version.new('4.0.0')
|
|
end
|
|
end
|
|
end
|