module ActiveSupport::Messages::Rotator::Encryptor

def build_rotation(secret = @secret, sign_secret = @sign_secret, options)

def build_rotation(secret = @secret, sign_secret = @sign_secret, options)
  self.class.new(secret, sign_secret, **options)
end

def decrypt_and_verify(*args, on_rotation: @on_rotation, **options)

def decrypt_and_verify(*args, on_rotation: @on_rotation, **options)
  super
rescue MessageEncryptor::InvalidMessage, MessageVerifier::InvalidSignature
  run_rotations(on_rotation) { |encryptor| encryptor.decrypt_and_verify(*args, **options) } || raise
end