Coder Social home page Coder Social logo

fingerprintjs / fingerprintjs-ios Goto Github PK

View Code? Open in Web Editor NEW
76.0 4.0 17.0 2.8 MB

iOS library for device fingerprinting. Does not require server APIs to work, fully client-side operation. MIT license, no restrictions on usage in production.

Home Page: https://fingerprint.com/github/

License: MIT License

Swift 95.17% Ruby 1.70% Makefile 0.17% Shell 2.96%
ios-security fraud-prevention ios fingerprinting device-fingerprint ios-library

fingerprintjs-ios's Introduction

FingerprintJS

Lightweight iOS library for local device fingerprinting

CI status Supported Swift versions Supported platforms Pod version

Discord server

Demo application on the App Store

Download on the App Store

Installation (CocoaPods)

# Podfile
pod 'FingerprintJS'

Note: If you've never used CocoaPods for dependency management, check out their Using CocoaPods guide that will walk you through the setup process.

Quick Start (async/await - preferred)

import FingerprintJS
 
let fingerprinter = FingerprinterFactory.getInstance()
Task {
    // Get fingerprint for the current device
    if let fingerprint = await fingerprinter.getFingerprint() {
      // Do something awesome with the fingerprint  
    }
}

Quick Start (closures - backwards compatibility)

import FingerprintJS 

let fingerprinter = FingerprinterFactory.getInstance()
fingerprinter.getFingerprint { fingerprint in
    // Do something awesome with the fingerprint
}

Fingerprint vs. DeviceId

FingerprintJS provides two main methods that return different kinds of identifiers:

  1. Device identifier retrieved by calling Fingerprinter::getDeviceId() that internally uses the identifierForVendor() method which returns a unique identifier for the current application (tied to the device). FingerprintJS further remembers this identifier in the keychain, making the identifier stable even between app reinstalls.

  2. Fingerprinter::getFingerprint() computes a device fingerprint by gathering device information (hardware, OS, device settings, etc.) and computing a hash value from available items. The fingerprint isn't currently as stable as the Device Identifier, because the values might change between OS updates or when the user changes settings used to compute the previous value. Furthermore, the fingerprint stability can be customized by supplying the stabilityLevel option to the Configuration object.

Configuration

Fingerprinter instance can be configured through the Configuration object that provides options to select the fingerprint version, set the desired fingerprint stability level, or change the algorithm that is used to compute the individual fingerprints.

// note that this example exists only to illustrate the available options
// and that its outcome mirrors the current default configuration

let configuration = Configuration(version: .latest, stabilityLevel: .optimal, algorithm: .sha256)
let fingerprinter = FingerprinterFactory.getInstance(config)

// fingerprinter uses latest fingerprint version with OPTIMAL stability level and SHA256 algorithm

Fingerprint Stability Levels

There are three different fingerprint stability levels, as defined in FingerprintStabilityLevel enum.

  • unique that indicates the use of every signal the library is able to collect. This stability level is recommended for obtaining the most accurate fingerprint.
  • optimal that indicates the use of a combination of signals that don’t change and signals that might change, though not very often. This is the default stability level and it is recommended as providing the best balance between fingerprint stability and fingerprint accuracy.
  • stable that indicates the use of hardware signals or signals that aren’t supposed to change at all. This stability level is recommended for obtaining the most stable fingerprint.

NOTE: The supplied stability level is only applicable in fingerprint version v3 and later, such that it is ignored if you use fingerprint versions v1 or v2.

Creating Custom Fingerprinting Function

The default hashing function which computes the fingerprint from the content data is SHA256. The Configuration object offers a way to inject a custom hashing function by specifying .custom(YourCustomFingerprintFunctionInstance) in the algorithm variable:

struct HitchhikersFunction: FingerprintFunction {
    func fingerprint(_ data: Data) -> String {
        return "42"
    }
}

let fingerprintFunction = HitchhikersFunction()
let config = Configuration(version: .latest, stabilityLevel: .optimal, algorithm: .custom(fingerprintFunction))
let fingerprinter = FingerprinterFactory.getInstance(config)

let fingerprint = await fingerprinter.getFingerprint() // returns "42"

Keep in mind that the change in the supplied hashing function will inevitably lead to the change of the output fingerprint.

Android version

License

This library is MIT licensed. Copyright FingerprintJS, Inc. 2023.

fingerprintjs-ios's People

Contributors

csauvage avatar mgutski avatar petrpalata avatar steven0351 avatar valve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fingerprintjs-ios's Issues

FingerprintJS.framework: No such file or directory

When I run the project I am getting this error

I just installed pod and in Appdelegate file I have written below code
let fingerprinter = FingerprinterFactory.getInstance()
async {
// Get fingerprint for the current device
let fingerprint = await fingerprinter.getDeviceId()
print(fingerprint)

        // Do something awesome with the fingerprint
    }
    
    Please suggest  me some solution for this issue

Want to know more about the limitation

Does the deviceId or fingerprint change on this two cases?

  • User can attach iPhone to MacOS and delete the value in keychain manually
  • User can create a new apple id and the keychains will be renewed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.