Device DNA library for iOS SDK
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Framework
Source/DeviceDNA.framework
.gitignore
DeviceDNA.podspec
LICENSE
README.md

README.md

DeviceDNA

The DeviceDNA iOS library allows you to identify devices using the Judopay Genome service

Getting Started

Step 1: Initialize DeviceDNA

1. Add DeviceDNA as a dependency

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

  • You can install CocoaPods with the following command:
$ gem install cocoapods
  • Add DeviceDNA to your Podfile to integrate it into your Xcode project:
source 'https://github.com/CocoaPods/Specs.git'

pod 'DeviceDNA', '~> 0.1'
  • Then, run the following command:
$ pod install
  • Please make sure to always use the newly generated .xcworkspace file not not the projects .xcodeproj file

  • In your Xcode environment, go to your Project Navigator (blue project icon), select the target that will initialize DeviceDNA and open the tab called Build Phases.

  • Add a new Run Script Phase and drag it above the Compile Sources build phase.

  • In the shell script, paste the following line:

sh "${PODS_ROOT}/DeviceDNA/Framework/strip-frameworks-cocoapods.sh"

2. Initialize DeviceDNA with your Judo account details:

  • Add the following statement to the class where you intend to use DeviceDNA

swift

@import DeviceDNA

obj-c

#import <DeviceDNA/DeviceDNA.h>
  • Create an instance of DeviceDNA

swift

let credentials = Credentials(<YOUR_TOKEN> secret:<YOUR_SECRET>)
let deviceDNA = DeviceDNA(credentials: credentials)

obj-c

Credentials *credentials = [[Credentials alloc] initWithToken:<YOUR_TOKEN> secret:<YOUR_SECRET>];
DeviceDNA *deviceDNA = [[DeviceDNA alloc] initWithCredentials:credentials];

Step 2: Identify a device

  • Call DeviceDNA to identify the device, this executes a callback providing the discovered device identifier and an error object.

swift

deviceDNA.identifyDevice { (deviceIdentifier, error) in
    //Your provided callback.            
}

obj-c

[deviceDNA identifyDevice:^(NSString * _Nullable deviceIdentifier, NSError * _Nullable error) {
    //Your provided callback.    
}];

Step 3: Check the device profile

  • Using the device identifier returned in step 2, call to retrieve the device profile

swift

deviceDNA.getDeviceProfile(deviceId) { (device, error) in
    //Your provided callback.  
}

obj-c

[deviceDNA getDeviceProfile:deviceId completion:^(NSDictionary<NSString *,id> * _Nullable device, NSError * _Nullable error) {
    //Your provided callback.    
}];

Device signals for server to server fraud prevention

When performing server to server payments using the Judopay API, you may wish to identify the device at the time of payment. To obtain the device signals necessary for fraud prevention, use DeviceDNA to obtain the encrypted signals which will be passed in the clientDetails JSON field of the request body:

swift

deviceDNA.getDeviceSignals { (device, error) in
    if let device = device as [String : String]? 
        let deviceId = device["deviceIdentifier"];
        let key = device["key"];
        let value = device["value"];
    }
}

obj-c

[deviceDNA getDeviceSignals:^(NSDictionary<NSString *,NSString *> * _Nullable device, NSError * _Nullable error) {
    NSString *deviceId = device["deviceIdentifier"];
    NSString *key = device["key"];
    NSString *value = device["value"];
}];