DeviceDNA 2.1.2

DeviceDNA 2.1.2

License MIT
ReleasedLast Release Aug 2024

Maintained by Judopay.



DeviceDNA 2.1.2

  • By
  • Judopay

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', '~> 2.0'
  • Then, run the following command:
$ pod install
  • Please make sure to always use the newly generated .xcworkspace file not not the projects .xcodeproj file

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"];
}];