iOS
Integrating Verisoul in iOS Apps
Verisoul provides a native iOS SDK that allows you to implement fraud prevention in your iOS applications. This guide covers the installation, configuration, and usage of the Verisoul iOS SDK.
Installation
You can install VerisoulSDK in your iOS project using either CocoaPods or Swift Package Manager.
CocoaPods
To integrate VerisoulSDK with CocoaPods:
- Ensure CocoaPods is installed on your machine. If not, run:
- Add VerisoulSDK to your Podfile:
- Run the following command to install the SDK:
- Open the
.xcworkspace
file in Xcode and start using the SDK.
Swift Package Manager (SPM)
To integrate VerisoulSDK using Swift Package Manager:
- Open your project in Xcode.
- Go to
File > Add Packages
. - Enter the repository URL for VerisoulSDK:
- Choose the version you wish to use and add the package.
The SDK will automatically integrate into your project.
Capabilities
To fully utilize VerisoulSDK, you must add the App Attest
capability to your project. This capability allows the SDK to perform necessary checks and validations to ensure the integrity and security of your application.
Update your app’s entitlements file:
Device Check and App Attest Integration
The SDK collects device and network risk data and wraps Apple’s Device Check and App Attest APIs to improve security. These features are optional — you can choose to enable or disable them as needed however they are highly recommended to improve security.
To enable these features, you must provide the following information in the developer section of the Verisoul dashboard in the Developers Section:
- Apple Team ID: Your Apple Developer Team identifier.
- Bundle Identifier: The bundle ID of your app.
- Device Check Private Key: Create a private key (a .p8 file) and provide its associated Key ID.
- Create the Device Check Key here
- Sharing this key only allows Verisoul to validate device check tokens created by your application
Usage
1. Initialization
configure(env:projectId:bundleIdentifier:)
Configure the SDK by passing it the environment, project ID, and bundle identifier. This function initializes the networking, device check, and device attestation components.
Parameters:
env (VerisoulEnvironment)
: The environment to configure the SDK with (e.g., dev, staging, prod).projectId (String)
: Your project’s unique identifier.bundleIdentifier (String)
: The bundle identifier of your app.
Note: The configure(env:projectId:)
method should be called once, typically during the app’s initialization process (e.g., in the AppDelegate
or SceneDelegate
).
2. Get Session ID
session() async throws -> String
Once the minimum amount of data is gathered the session ID becomes available. The session ID is needed in order to request a risk assessment from Verisoul’s API. Note that session IDs are short lived and will expire after 24 hours. The application can obtain session ID by providing the callback as shown below:
Update the privacy manifest file
Next Steps
- Learn about Backend Integration for API implementation
- See Integration Best Practices
- Explore Android Integration for Android devices
- See the iOS Sample App for a complete implementation