GithubHelp home page GithubHelp logo

isabella232 / devicedna-ios Goto Github PK

View Code? Open in Web Editor NEW

This project forked from judopay/devicedna-ios

0.0 0.0 0.0 31.69 MB

Device DNA library for iOS SDK

License: MIT License

Ruby 6.78% C 0.71% Objective-C 74.27% Swift 18.24%

devicedna-ios's Introduction

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

devicedna-ios's People

Contributors

ashleybarrett avatar james-lappin avatar judo-ci avatar mpetrenco avatar zfoltin avatar

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.