Class: ActiveStorageEncryption::TokenEncryptor

Inherits:
ActiveSupport::MessageEncryptor
  • Object
show all
Defined in:
lib/active_storage_encryption.rb

Overview

Unlike MessageVerifier#verify, MessageEncryptor#decrypt_and_verify does not raise an exception if the message decrypts, but has expired or was signed for a different purpose. We want an exception to remove the annoying nil checks.

Instance Method Summary collapse

Instance Method Details

#decrypt_and_verify(value, **options) ⇒ Object



29
30
31
32
33
# File 'lib/active_storage_encryption.rb', line 29

def decrypt_and_verify(value, **options)
  super.tap do |message_or_nil|
    raise StreamingTokenInvalidOrExpired if message_or_nil.nil?
  end
end