Class: Stytch::Fraud::Fingerprint

Inherits:
Object
  • Object
show all
Includes:
RequestHelper
Defined in:
lib/stytch/fraud.rb

Instance Method Summary collapse

Methods included from RequestHelper

#delete_request, #get_request, #post_request, #put_request, #request_with_query_params

Constructor Details

#initialize(connection) ⇒ Fingerprint

Returns a new instance of Fingerprint.



27
28
29
# File 'lib/stytch/fraud.rb', line 27

def initialize(connection)
  @connection = connection
end

Instance Method Details

#lookup(telemetry_id:, external_metadata: nil) ⇒ Object

Lookup the associated fingerprint for the ‘telemetry_id` returned from the `GetTelemetryID()` function. Learn more about the different fingerprint types and verdicts in our [DFP guide](stytch.com/docs/fraud/guides/device-fingerprinting/overview).

You can make a decision based on the recommended ‘verdict` in the response:

  • ‘ALLOW` - This is a known valid device grouping or device profile that is part of the default `ALLOW` listed set of known devices by Stytch. This grouping is made up of verified device profiles that match the characteristics of known/authentic traffic origins.

  • ‘BLOCK` - This is a known bad or malicious device profile that is undesirable and should be blocked from completing the privileged action in question.

  • ‘CHALLENGE` - This is an unknown or potentially malicious device that should be put through increased friction such as 2FA or other forms of extended user verification before allowing the privileged action to proceed.

If the ‘telemetry_id` is expired or not found, this endpoint returns a 404 `telemetry_id_not_found` [error](stytch.com/docs/fraud/api/errors/404#telemetry_id_not_found). We recommend treating 404 errors as a `BLOCK`, since it could be a sign of an attacker trying to bypass DFP protections. See [Attacker-controlled telemetry IDs](stytch.com/docs/fraud/guides/device-fingerprinting/integration-steps/test-your-integration#attacker-controlled-telemetry-ids) for more information.

Parameters:

telemetry_id

The telemetry ID associated with the fingerprint getting looked up. The type of this field is String.

external_metadata

External identifiers that you wish to associate with the given telemetry ID. You will be able to search for fingerprint results by these identifiers in the DFP analytics dashboard. External metadata fields may not exceed 65 characters. They may only contain alphanumerics and the characters ‘_` `-` `+` `.` or `@`. The type of this field is nilable Metadata (object).

Returns:

An object with the following fields:

request_id

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is String.

telemetry_id

The telemetry ID associated with the fingerprint getting looked up. The type of this field is String.

fingerprints

A Stytch fingerprint consists of the following identifiers: The type of this field is Fingerprints (object).

verdict

The metadata associated with each fingerprint The type of this field is Verdict (object).

external_metadata

External identifiers that you wish to associate with the given telemetry ID. You will be able to search for fingerprint results by these identifiers in the DFP analytics dashboard. External metadata fields may not exceed 65 characters. They may only contain alphanumerics and the characters ‘_` `-` `+` `.` or `@`. The type of this field is Metadata (object).

created_at

The time when the fingerprint was taken. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. ‘2021-12-29T12:33:09Z`. The type of this field is String.

expires_at

The timestamp when the fingerprint expires. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. ‘2021-12-29T12:33:09Z`. The type of this field is String.

status_code

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is Integer.

properties

Additional information about the user’s browser and network. The type of this field is nilable Properties (object).

raw_signals

The raw device attributes, such as screen size, that were collected by the Device Fingerprinting product to generate the fingerprints and verdict. You must be specifically enabled for the raw signals feature to see this field. You can find documentation for the specific fields in the [guides](stytch.com/docs/fraud/guides/device-fingerprinting/reference/raw-signals). The type of this field is nilable object.



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/stytch/fraud.rb', line 83

def lookup(
  telemetry_id:,
  external_metadata: nil
)
  headers = {}
  request = {
    telemetry_id: telemetry_id
  }
  request[:external_metadata] =  unless .nil?

  post_request('/v1/fingerprint/lookup', request, headers)
end