class method
self.new
Ruby on Rails 7.2.3
Since v7.2.3Signature
new(&secret_generator)
Initializes a new instance. secret_generator must accept a salt and a secret_length kwarg, and return a suitable secret (string) or secrets (array of strings). secret_generator may also accept other arbitrary kwargs. If #rotate is called with any options matching those kwargs, those options will be passed to secret_generator instead of to the message encryptor.
encryptors = ActiveSupport::MessageEncryptors.new do |salt, secret_length:, base:| MySecretGenerator.new(base).generate(salt, secret_length) end encryptors.rotate(base: "...")
Source
# File activesupport/lib/active_support/message_encryptors.rb, line 31
Defined in activesupport/lib/active_support/message_encryptors.rb line 31
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::MessageEncryptors