Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IdentityApi to check rewards eligibility #2103

Merged
merged 3 commits into from
Nov 11, 2024

Conversation

hectorgomezv
Copy link
Member

@hectorgomezv hectorgomezv commented Nov 7, 2024

Summary

This PR implements an eligibility check for the Safe clients. The main criterion for eligibility (e.g.: eligible for rewards) is the country of origin of the incoming request.

For that purpose, FingerprintJS is used. This service requires the client to install a JS Agent, that makes a request to Fingerprint servers. The response contains a sealed data payload, holding anonymous identity data like browser type, VPN information, IP location, etc. Then, this data can be sent to the CGW, which unseals it, and applies the eligibility logic.

A more detailed explanation of how this works can be found in the Fingerprint documentation for Sealed Client Results.

Changes

  • Adds a CommunityRepository['checkEligibility'] function to check if a specific request is eligible.
  • Adds FingerprintApiService that wraps a FingerprintJS library, to unseal the request identity payload.
  • Adds FINGERPRINT_NON_ELIGIBLE_COUNTRIES as a non-mandatory environment variable (defaulting to ['US']).
  • Adds FINGERPRINT_ENCRYPTION_KEY as a mandatory environment variable.

Out of scope

  • It could be different eligibility conditions per community campaign. The PR assumes all the campaigns share the same eligibility conditions.
  • It could be other eligibility conditions besides the request origin country. The PR assumes the only criterion is the origin country.

@hectorgomezv hectorgomezv self-assigned this Nov 7, 2024
@hectorgomezv hectorgomezv marked this pull request as ready for review November 7, 2024 14:14
@hectorgomezv hectorgomezv requested a review from a team as a code owner November 7, 2024 14:14
@hectorgomezv hectorgomezv requested a review from iamacook November 8, 2024 17:00
@hectorgomezv hectorgomezv merged commit e3d15b6 into main Nov 11, 2024
20 checks passed
@hectorgomezv hectorgomezv deleted the fingerprint-integration branch November 11, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants