method

valid_message?

Importance_1
v7.1.3.2 - Show latest stable - 0 notes - Class: ActiveSupport::MessageVerifier
valid_message?(message) public

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

verifier = ActiveSupport::MessageVerifier.new("secret")
signed_message = verifier.generate("signed 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.