Swiftpack.co - Judopay/DeviceDNA-iOS as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Judopay.
Judopay/DeviceDNA-iOS 2.0.0
Device DNA library for iOS SDK
⭐️ 5
🕓 12 weeks ago
.package(url: "https://github.com/Judopay/DeviceDNA-iOS.git", from: "2.0.0")


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 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


@import DeviceDNA


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


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


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.


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


[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


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


[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:


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


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


Stars: 5
Last commit: 4 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

12 weeks ago

XCFramework support

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics