method

valid_message?

Importance_1
v6.1.7.7 - Show latest stable - 0 notes - Class: ActiveSupport::MessageVerifier
valid_message?(signed_message) public

Checks if a signed message could have been generated by signing an object with the MessageVerifier's secret.

verifier = ActiveSupport::MessageVerifier.new 's3Krit'
signed_message = verifier.generate 'a private message'
verifier.valid_message?(signed_message) # => true

tampered_message = signed_message.chop # editing the message invalidates the signature
verifier.valid_message?(tampered_message) # => false
Show source
Register or log in to add new notes.