Native Core
The Core source is platform-native Swift and does not import React. The React Native bridge is a separate layer and is not part of this API.
Integrate encrypted geofence checks, continuous verification, persisted fingerprints, and native device signals directly in a Swift application.
KadeClient.shared is the high-level native entry point. It owns configuration, encryption, pings, continuous checks, and fingerprint submission. KadeCore.shared exposes lower-level permissions, location, device, and marker collection.
The Core source is platform-native Swift and does not import React. The React Native bridge is a separate layer and is not part of this API.
Use the shared client, start it before calling ping or training methods, and destroy it when the integration is no longer needed.
async version and a completion-handler version. Native Core exposes evaluateEmail(_:) with EvaluateEmailOptions for fire-and-forget registration email evaluation. The server always answers with an empty response; the verdict is visible only to operators. It does not expose network-based location estimation APIs.Version 1.1.0 completes the native Kade rename. Use KadeClient, KadeCore, KadeConfig, and KadeErrorCodes.
KadeSdk. Legacy public aliases have been removed. Persisted storage keys, encryption, payloads, routes, and wire error-code strings remain unchanged.The iOS Core SDK is not currently distributed as a standalone public CocoaPods artifact. There is no public pod installation command to use.
Core subspec, but that does not constitute a public release.The source configuration sets an iOS 13.0 minimum, Swift 5.7, and links Foundation, CoreLocation, CoreMotion, SystemConfiguration, Network, Security, and DeviceCheck.
After Kade supplies the native package, add it to the application target using the delivery-specific instructions. Do not add the React Native bridge to a native-only target.
Build your application target to verify the delivered package:
xcodebuild \
-workspace YourApp.xcworkspace \
-scheme YourApp \
-sdk iphonesimulator \
buildKadeSdk pod and module name. Follow the package-specific instructions you receive.Start the shared client, then issue a ping only after configuration succeeds. With Swift concurrency, use the async versions; failures throw a KadeError.
import KadeSdk
let client = KadeClient.shared
Task {
do {
try await client.start(config: KadeConfig(apiToken: "your-api-token", regionId: 123))
let response = try await client.ping(
options: PingOptions(userId: "player-123", source: "login", email: "player@example.com")
)
if response.blocked == true {
print("Blocked:", response.code ?? "unknown")
} else {
print("Inside:", response.inside, "area:", response.area?.name ?? "none")
}
} catch let error as KadeError {
// error.code: a location code or GEOFENCE_INIT / GEOFENCE_PING;
// error.httpStatus when the server answered with an error status.
print("Kade failed:", error.code, error.httpStatus ?? "", error.message)
}
}The same flow with completion handlers:
let client = KadeClient.shared
let config = KadeConfig(
apiToken: "your-api-token",
regionId: 123
)
client.start(config: config) { result in
switch result {
case .success:
let options = PingOptions(
userId: "player-123",
source: "login",
email: "player@example.com"
)
client.ping(options: options) { pingResult in
switch pingResult {
case .success(let response):
if response.blocked == true {
print("Blocked:", response.code ?? "unknown")
} else {
print("Inside:", response.inside)
print("Area:", response.area?.name ?? "none")
}
case .failure(let error):
print("Kade ping failed:", error)
}
}
case .failure(let error):
print("Kade startup failed:", error)
}
}start(config:completion:) derives the encryption key on a background queue and invokes its completion with a Result<Void, KadeError>. Do not assume the client is ready immediately after calling start. Completions arrive on a background queue; a failure found up front (not started yet) completes at once on the calling thread. The async versions resume on the caller's executor (the main actor for main-actor code).Add a user-facing location purpose string to the host application's Info.plist, then use KadeCore to inspect and request authorization.
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is used to verify availability in your region.</string>let core = KadeCore.shared
switch core.getLocationPermissionStatus() {
case .granted:
beginVerification()
case .notDetermined:
Task { @MainActor in
// Or the completion-handler version: requestLocationPermission { status in … }
if await core.requestLocationPermission() == .granted {
beginVerification()
} else {
showLocationUnavailable()
}
}
case .denied, .restricted:
showLocationUnavailable()
}The native permission states are granted, denied, restricted, and notDetermined; reduced (approximate) accuracy counts as granted. Android reports the same values with the same meaning. If your policy permits a server-side check without device location, set skipLocation: true on PingOptions; confirm that policy with Kade.
These are native Swift signatures from the Core layer, not React Native bridge methods.
GEOFENCE_PING if startup has not completed.onPingResponse and onPingError.visitorId.EvaluateEmailOptions has the JavaScript SDKs' option names: email (required), firstName, lastName, userId, dob, gender, occupation, phone, postalCode, addressLine, referrerPlayerId, referralCode, trafficSource, platform, metadata (your own key/value pairs such as ad click IDs and campaign tags: strings, numbers and booleans; anything else is dropped; use facebookClickId, googleClickId, redtrackClickId, microsoftClickId, tiktokClickId and utmCampaign for the identifiers Kade recognises) and includeLocation (default true: attach the cached fix only when the permission is already held; never prompts).let core = KadeCore.shared
let status = core.getLocationPermissionStatus()
let device = core.getDeviceInfo()
let jailbreak = core.getJailbreak()
let developerMode = core.getDeveloperMode()
let mockLocation = core.getMockLocation()
let locationSource = core.getLocationSource()
let vpn = core.getVpn()
let battery = core.getBattery()
let fix = try await core.getCurrentLocation(
accuracy: .high,
timeoutMs: 10_000,
maxAgeMs: 120_000
)
let markers = await core.getMobileMarkers(options: MobileMarkersOptions(includeSensors: false))
print(KadeCore.sdkVersion)Core also exposes sensor collection, integrity attestation, persisted fingerprint ID accessors, and explicit location watcher controls, each with an async and a completion-handler version where it is asynchronous. Most integrations should prefer KadeClient for policy checks.
PingResponse, AddressSessionLocation, GeoLocation, DeviceInfo, FingerprintResult, MobileMarkers and the detector results conform to KadeJSONRepresentable: asDictionary() returns the same keys the React Native SDK hands JavaScript (absent when nil), and jsonString(pretty:) the JSON text.
let response = try await client.ping(options: PingOptions(userId: "player-123"))
print(response.jsonString(pretty: true))
// { "distanceToBorder" : 5120.4, "inside" : true, "interval" : 10000, "regionId" : 123, … }| Field | Type and default | Behavior |
|---|---|---|
apiToken | String, required | Workspace API token. |
serverUrl | String, https://api.kade.io | API base URL. |
regionId | Int?, nil | Default region; ping-level value overrides it. |
signingSecret | String?, nil | Enables request signing when non-empty. |
locationStrategy | LocationStrategy, .race | Location retrieval strategy. |
locationMaxAgeMs | Int, 120,000 | Preferred cached-fix age. This is the floor of a dynamic reuse window. |
locationMaxAgeCapMs | Int, 600,000 | Upper bound for the dynamic cached-fix reuse window. |
locationMaxStalenessRadius | Double, 100 | Staleness radius used by location selection. |
locationAccuracy | LocationAccuracy, .high | .high, .balanced, or .low. |
debug | Bool, false | Enables verbose SDK logging. |
let options = PingOptions(
userId: "player-123",
silent: false,
skipLocation: false,
source: "deposit",
regionId: 123,
email: "player@example.com",
firstName: "Player",
lastName: "One"
)Every option has a default. source is a free-form flow tag, regionId overrides configuration for that ping, and identity fields are associated with the server-side client record.
Register handlers before starting continuous checks, retain no second client instance, and stop checks when the protected flow ends.
let client = KadeClient.shared
client.onPingResponse = { response in
DispatchQueue.main.async {
updateAccessState(using: response)
}
}
client.onPingError = { (error: KadeError) in
DispatchQueue.main.async {
// A location code, or GEOFENCE_PING_ERROR for any other failure.
showVerificationError(code: error.code)
}
}
client.startContinuousPing(
options: PingOptions(userId: "player-123", source: "session")
)
// When the verified flow ends:
client.stopContinuousPing()
// When disposing the entire integration:
client.destroy()startContinuousPing does nothing before successful startup.stop() and stopContinuousPing() stop continuous checks; destroy() also clears Core and configuration state.onPingResponse and onPingError are called on a background queue. Dispatch UI work to the main queue.Branch on blocked first, tolerate optional fields, and keep transport failures separate from server verdicts.
func handle(_ response: PingResponse) {
if response.blocked == true {
if response.code == KadeErrorCodes.locationPermissionMissing {
showLocationPermissionHelp()
}
denyAccess(
code: response.code,
message: response.message
)
return
}
if response.inside {
allowAccess(areaName: response.area?.name)
} else {
showOutsideRegion(distance: response.distanceToBorder)
}
if response.requestLocation == true {
// Revisit the permission/location flow before the next check.
}
}| Field | Type | Meaning |
|---|---|---|
inside | Bool | Whether the server resolved the client inside the relevant geofence. |
status | Int | Server response status value. |
message, code | String? | Optional response detail and machine-readable code. |
interval | Int | Server-provided interval used by continuous checks; the model default is 10,000. |
distanceToBorder | Double | Distance value returned by the server. |
regionId | Int? | Resolved region when present. |
area | PingArea? | Matched area with id and name. |
blocked | Bool? | Explicit block decision when supplied. |
requestLocation | Bool? | Reserved: the server does not send it yet (asks the client to obtain location). |
deviceTrustTtl | Int? | Reserved: the server does not send it yet (device-trust lifetime in ms). |
Every failure from KadeClient, in a completion's Result, thrown by an async version, or passed to onPingError, is a KadeError. It has already been reported to Kade; you don't need to report it again.
| Property | Type | Meaning |
|---|---|---|
code | String | Stable code to match on (below); the same strings the React Native SDK rejects with. |
httpStatus | Int? | The HTTP status when the server answered with an error status, else nil. |
message | String | What went wrong, for logs. Not stable. Also the error's localizedDescription. |
underlyingError | Error? | The error Core caught, such as a URLError, when there is one. |
KadeErrorCodes | Code | When |
|---|---|---|
locationPermissionMissing | LOCATION_PERMISSION_MISSING | No location permission. |
locationPermissionPreciseRequired | LOCATION_PERMISSION_PRECISE_REQUIRED | Precise location required. |
locationServicesDisabled | LOCATION_SERVICES_DISABLED | Location turned off on the device. |
locationTimeout, locationUnavailable | LOCATION_TIMEOUT, LOCATION_UNAVAILABLE | No fix in time, or none available. |
start | GEOFENCE_INIT | start failed. |
ping | GEOFENCE_PING | ping failed: not started, no response, or an HTTP error. |
continuousPing | GEOFENCE_PING_ERROR | A continuous-ping failure other than location. |
fingerprint | GEOFENCE_FINGERPRINT | sendFingerprintForTraining failed. |
evaluateEmail | GEOFENCE_EVALUATE_EMAIL | evaluateEmail failed, or email was empty. |
A blocked ping is not an error: it is a PingResponse with blocked == true and a code.
Talk to Kade for SDK access, approved packaging, credentials, and integration guidance for your application.