Module: Decidim::Fingerprintable

Extended by:
ActiveSupport::Concern
Defined in:
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

Instance Method Details

#fingerprintObject

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 'lib/decidim/fingerprintable.rb', line 44

def fingerprint
  @fingerprint ||= FingerprintCalculator.new(fingerprint_data)
end