From 83e59521401c8f7ee3da1324e405c8e513a4726e Mon Sep 17 00:00:00 2001 From: dormin Date: Tue, 21 Jan 2020 23:42:37 -0500 Subject: [PATCH 1/3] update readme --- README.md | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 10e4dac..fe34cef 100644 --- a/README.md +++ b/README.md @@ -1 +1,93 @@ -see https://www.riskified.com/documentation/mobile-sdks/ for latest instructions +## RiskifiedBeacon for iOS Devices +##### Version 1.2.7 + +###### The following guide explains how to install and implement Riskified's Mobile SDK into your application environment. +###### The Mobile SDK is analogous to Riskified's Javascript code used for analytics and fraud review enhancement on the browser, and is critical for main analytics features such as ATO Prevention and CHB Guarantee. + +### Prerequisites: + + * iOS 8.0 and above. + +--- + +### Installation: + +#### Using CocoaPods: + + * Add the following line to the `Podfile`, under your app's `target` section: +```yaml + pod 'RiskifiedBeacon', '~> 1.2.7' +``` + + * Run `$ pod install` in your project directory. + * Open `App.xcworkspace` and build. + +#### Manually: + + * Download and extract the latest release from [Github](https://github.com/Riskified/ios_sdk/releases/latest). + * Copy/Drag `libriskifiedbeacon.a` and `RiskifiedBeacon.h` into your XCode project. + * Ensure that the `libriskifiedbeacon.a` library exists in the project settings under Build Phases → Link Binary with Libraries. + +--- + +### Implementation: + +##### 1. Add an `#import "RiskifiedBeacon.h"` to the top of your ApplicationDelegate. + +##### 2. Start the beacon at the end of `applicationDidFinishLaunching`: +```objective-c + [RiskifiedBeacon startBeacon:@"myshop.com" sessionToken:token debugInfo:true]; +``` + + * `startBeacon()` arguments: + * `shopName` - Name of your Riskified account. + * `sessionTokeb` - Unique identifier of the user's current session in the app. The same identifier is passed by your backend (in the `cart_token` field) to Riskified. + * `debugInfo` - Boolean parameter that indicates whether or not to display the beacon logs. + + +##### 3. When the user's session changes, update the token by calling: +```objective-c + [RiskifiedBeacon updateSessionToken:newToken]; +``` + +##### 4. Notify the beacon on each relevant HTTP request from the app: +```objective-c + [RiskifiedBeacon logRequest:requestUrl]; +``` + +##### 5. Collect rich device information. This method should usually be called only once per session: +```objective-c + [RiskifiedBeacon logSensitiveDeviceInfo]; +``` + +##### 6. (Optional) Extract Riskified's device identifier to support custom flows: +```objective-c + NSString *riskifiedDeviceID = [RXBeacon rCookie]; +``` + +--- +### Bridging for Swift + +If your project is built in Swift, you'll need to follow these additional steps: + + 1. Add a new Bridging Header file if it doesn't already exists (ex. Bridging-Header.h). + 1. Ensure the file is listed correctly under Objective-C Bridging Header in the project's Build Settings. + 1. Add `#import "RiskifiedBeacon.h"` to the bridging header file. + 1. Continue as usual using Swift syntax: `RiskifiedBeacon.startBeacon("myshop.com", sessionToken:token)` + +--- + +### FAQs + +##### Q: Does the SDK require any additional permissions from the user? + * The SDK does **not** require or prompt for any user permissions. + * The SDK utilizes certain permissions if the host app previously requested them. + +##### Q: When and how should `logRequest:` be used? + * Call this method every time a user performs a meaningful action in the app (for example: view product page, search, add to cart). + * Riskified uses this data for behavioral modeling and analysis, so please take care to only call `logRequest:` in response to an actual user action. + * The single URL argument represents the action taken, this can usually be achieved by passing the same URL used in the backend call for the action (`https://api.myshop.com/search?term=shoes`). + +##### Q: When should `logsensitiveDeviceInfo` be called? + * Ideally once per session, depending on the use case. For example - before attempting to process a checkout, or before the first login attempt. + * Multiple invocations of this function in a single session will not generate an error, but have the wasteful effect of generating identical payloads for analysis. From d83a37fe08af43b0b0b4ac70832ebbd87877743d Mon Sep 17 00:00:00 2001 From: dormin Date: Tue, 21 Jan 2020 23:50:56 -0500 Subject: [PATCH 2/3] fix typos --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fe34cef..724a037 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,10 @@ [RiskifiedBeacon startBeacon:@"myshop.com" sessionToken:token debugInfo:true]; ``` - * `startBeacon()` arguments: + * `startBeacon:` arguments: * `shopName` - Name of your Riskified account. - * `sessionTokeb` - Unique identifier of the user's current session in the app. The same identifier is passed by your backend (in the `cart_token` field) to Riskified. - * `debugInfo` - Boolean parameter that indicates whether or not to display the beacon logs. + * `sessionToken` - Unique String identifier of the user's current session in the app. The same identifier is passed by your backend (in the `cart_token` field) to Riskified. + * `debugInfo` - Boolean parameter that enables beacon logging for debugging. ##### 3. When the user's session changes, update the token by calling: @@ -86,7 +86,7 @@ If your project is built in Swift, you'll need to follow these additional steps: ##### Q: When and how should `logRequest:` be used? * Call this method every time a user performs a meaningful action in the app (for example: view product page, search, add to cart). * Riskified uses this data for behavioral modeling and analysis, so please take care to only call `logRequest:` in response to an actual user action. - * The single URL argument represents the action taken, this can usually be achieved by passing the same URL used in the backend call for the action (`https://api.myshop.com/search?term=shoes`). + * The single URL argument represents the action taken, this can usually be achieved by passing the same URL used in the backend call for the action (ie., `https://api.myshop.com/search?term=shoes`). ##### Q: When should `logsensitiveDeviceInfo` be called? * Ideally once per session, depending on the use case. For example - before attempting to process a checkout, or before the first login attempt. From 083a452a23b882020b11228bbf4fbd7d4ec69f96 Mon Sep 17 00:00:00 2001 From: dormin Date: Wed, 19 Feb 2020 15:57:48 -0500 Subject: [PATCH 3/3] add changelog --- CHANGELOG.md | 19 +++++++++++++++++++ README.md | 16 ++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..44f773b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.2.7] - 2019-12-18 + +### Added + +- rCookie() device identifier public method + +## [1.2.6] - 2019-12-11 + +### Added + +- .podspec for CocoaPods + diff --git a/README.md b/README.md index 724a037..d87720c 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,13 @@ * Run `$ pod install` in your project directory. * Open `App.xcworkspace` and build. - + #### Manually: * Download and extract the latest release from [Github](https://github.com/Riskified/ios_sdk/releases/latest). * Copy/Drag `libriskifiedbeacon.a` and `RiskifiedBeacon.h` into your XCode project. * Ensure that the `libriskifiedbeacon.a` library exists in the project settings under Build Phases → Link Binary with Libraries. - + --- ### Implementation: @@ -36,7 +36,7 @@ ##### 2. Start the beacon at the end of `applicationDidFinishLaunching`: ```objective-c - [RiskifiedBeacon startBeacon:@"myshop.com" sessionToken:token debugInfo:true]; +[RiskifiedBeacon startBeacon:@"myshop.com" sessionToken:token debugInfo:true]; ``` * `startBeacon:` arguments: @@ -72,7 +72,7 @@ If your project is built in Swift, you'll need to follow these additional steps: 1. Add a new Bridging Header file if it doesn't already exists (ex. Bridging-Header.h). 1. Ensure the file is listed correctly under Objective-C Bridging Header in the project's Build Settings. - 1. Add `#import "RiskifiedBeacon.h"` to the bridging header file. + 1. Add `#import "RiskifiedBeacon.h"` to the bridging header file. 1. Continue as usual using Swift syntax: `RiskifiedBeacon.startBeacon("myshop.com", sessionToken:token)` --- @@ -80,14 +80,14 @@ If your project is built in Swift, you'll need to follow these additional steps: ### FAQs ##### Q: Does the SDK require any additional permissions from the user? - * The SDK does **not** require or prompt for any user permissions. + * The SDK does **not** require or prompt for any user permissions. * The SDK utilizes certain permissions if the host app previously requested them. ##### Q: When and how should `logRequest:` be used? * Call this method every time a user performs a meaningful action in the app (for example: view product page, search, add to cart). * Riskified uses this data for behavioral modeling and analysis, so please take care to only call `logRequest:` in response to an actual user action. * The single URL argument represents the action taken, this can usually be achieved by passing the same URL used in the backend call for the action (ie., `https://api.myshop.com/search?term=shoes`). - -##### Q: When should `logsensitiveDeviceInfo` be called? + +##### Q: When should `logsensitiveDeviceInfo` be called? * Ideally once per session, depending on the use case. For example - before attempting to process a checkout, or before the first login attempt. - * Multiple invocations of this function in a single session will not generate an error, but have the wasteful effect of generating identical payloads for analysis. + * Multiple invocations of this function in a single session will not generate an error, but have the wasteful effect of generating identical payloads for analysis.