Merge pull request #10712 from colinux/rails-7-finalize-defaults

Rails 7.0 : finalise la migration des defaults
This commit is contained in:
Colin Darie 2024-09-09 08:08:27 +00:00 committed by GitHub
commit 7c30ab87bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 185 additions and 152 deletions

View file

@ -7,6 +7,10 @@ class EncryptionService
password = Rails.application.secrets.secret_key_base
key = ActiveSupport::KeyGenerator.new(password).generate_key(salt, len)
@encryptor = ActiveSupport::MessageEncryptor.new(key)
# Remove after all encrypted attributes have been rotated.
legacy_key = ActiveSupport::KeyGenerator.new(password, hash_digest_class: OpenSSL::Digest::SHA1).generate_key(salt, len)
@encryptor.rotate legacy_key
end
def encrypt(value)