class ActiveSupport::MessageEncryptor
def encrypt_and_sign(value, **options)
specified when verifying the message; otherwise, verification will fail.
The purpose of the message. If specified, the same purpose must be
[+:purpose+]
encryptor.decrypt_and_verify(message) # => nil
# 24 hours later...
encryptor.decrypt_and_verify(message) # => "hello"
message = encryptor.encrypt_and_sign("hello", expires_in: 24.hours)
elapsed, verification of the message will fail.
The duration for which the message is valid. After this duration has
[+:expires_in+]
encryptor.decrypt_and_verify(message) # => nil
# 24 hours later...
encryptor.decrypt_and_verify(message) # => "hello"
message = encryptor.encrypt_and_sign("hello", expires_at: Time.now.tomorrow)
verification of the message will fail.
The datetime at which the message expires. After this datetime,
[+:expires_at+]
==== Options
padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/.
Encrypt and sign a message. We need to sign the message in order to avoid
def encrypt_and_sign(value, **options) create_message(value, **options) end