Module: Decidim::Fingerprintable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Proposals::Proposal
- Defined in:
- decidim-core/lib/decidim/fingerprintable.rb
Overview
This module adds support functionality to be able to generate a unique fingerprint from a model, given some fields. Its goal is to provide a way to give an informal “receipt” to a user to they can detect tampering.
Instance Method Summary collapse
-
#fingerprint ⇒ Object
Public: Returns an instance of ‘FingerprintCalculator` containing the fingerprint.
Instance Method Details
#fingerprint ⇒ Object
Public: Returns an instance of ‘FingerprintCalculator` containing the fingerprint.
Example:
model.fingerprint.value # Returns the fingerprint as a String
model.fingerprint.source # Returns the source String (usually a json) from which
# the fingerprint is generated.
44 45 46 |
# File 'decidim-core/lib/decidim/fingerprintable.rb', line 44 def fingerprint @fingerprint ||= FingerprintCalculator.new(fingerprint_data) end |