Skip to Content
SDK IntegrationOverview

SDK Overview

TrustPin provides native SDKs for all major mobile and desktop platforms, enabling you to implement OWASP-compliant certificate pinning with minimal integration effort.

Available SDKs

SDKLatest versionLanguagesPlatforms
iOS / macOSTrustPinKit 6.4.0Swift 6.1+iOS 15+, macOS 13+, watchOS 8+, tvOS 15+, visionOS 2+
Android / Kotlincloud.trustpin:kotlin-sdk 6.4.0Kotlin 2.3.0+Android API 25+, JVM 11+
Fluttertrustpin_sdk 6.4.0DartiOS 15+, Android API 25+, macOS 13+
React Native@trustpin/react-native 6.4.0JavaScript / TypeScriptiOS 15+, Android API 25+

The Flutter package bundles the native SDKs (TrustPinKit 6.4.x on iOS/macOS, cloud.trustpin:kotlin-sdk 6.4.x on Android), so a single flutter pub get brings everything in. The React Native package wraps the same native SDKs for iOS and Android (no macOS).

iOS, macOS, watchOS, tvOS & visionOS

Android & JVM

Flutter (Cross-Platform)

React Native (iOS & Android)


Quick Integration

All TrustPin SDKs follow a consistent 3-step integration pattern:

1. Install the SDK

Add TrustPin to your project using your platform’s package manager:

  • iOS/macOS: Swift Package Manager or CocoaPods
  • Android: Gradle with Maven Central
  • Flutter: pub.dev package

2. Initialize TrustPin

Build a TrustPinConfiguration and pass it to setup() during app initialization. Each SDK can either load the configuration from a bundled file or accept it inline:

  • iOS / macOS: TrustPinConfiguration.fromPlist() reads a bundled TrustPin-Info.plist
  • Android / Kotlin: TrustPinConfiguration.fromAssets(context) reads src/main/assets/trustpin.json
  • Flutter: TrustPin.shared.setupWithNativeBundle() defers to each platform’s native config file (TrustPin-Info.plist on iOS/macOS, trustpin.json on Android), so credentials never enter the Dart isolate

All three forms accept the same fields: organizationId / OrganizationId, projectId / ProjectId, publicKey / PublicKey, optional mode, and optional configurationURL.

Changed in 6.4.0: configurationURL must be HTTPS and point at a public host. Loopback and private addresses, such as localhost or the Android emulator’s 10.0.2.2, are rejected during setup and do not fall back to the default endpoint. A valid custom URL that cannot be fetched at runtime does fall back to the TrustPin CDN. Only the configuration source is affected, not which hosts your app pins. See Swift, Kotlin, Flutter, or React Native.

Every SDK also accepts an optional embedded configuration: a signed configuration bundled inside the app, used only on a first start where no online source and no previously validated configuration is available. It is a last-resort fallback for apps protected by RASP, never a replacement for the online configuration. See each platform’s guide for the option name and file placement:

SDKOptionBundled file declared in
iOS / macOSembeddedConfigurationURLEmbeddedConfigurationFile in TrustPin-Info.plist
Android / KotlinembeddedConfiguration (EmbeddedConfiguration.Asset / .File)embedded_configuration_asset in trustpin.json
FlutterembeddedConfigurationFileEmbeddedConfigurationFile / embedded_configuration_asset
React NativeembeddedConfigurationFile (Expo plugin prop)EmbeddedConfigurationFile / embedded_configuration_asset

setup() is non-blocking. It returns as soon as the configuration starts loading. To fail closed (block until a validated configuration is available before making pinned requests), await the new awaitConfiguration() gate after setup(). See each platform’s guide for the exact call.

3. Configure HTTP Client

Integrate TrustPin with your HTTP client:

  • iOS / macOS: URLSession with TrustPin.makeURLSessionDelegate(), the Alamofire adapter (TrustPinKitAlamofire), or system-wide via TrustPinURLProtocol
  • Android / JVM: OkHttp / Retrofit / Ktor via the trustpin-okhttp / trustpin-ktor adapters (.trustPin()), or manually with TrustPinSSLSocketFactory.create()
  • Flutter: Dio with TrustPinDioInterceptor, or package:http via TrustPinHttpClient.create()

Key Features

All SDKs provide:

  • ✅ OWASP-Compliant Pinning - Implements OWASP Mobile Security Testing Guide recommendations
  • ✅ Zero-Downtime Updates - Update certificates remotely without app releases
  • ✅ Automatic Validation - Certificate pinning happens automatically on all HTTPS requests
  • ✅ Intelligent Caching - 10-minute configuration cache with automatic refresh
  • ✅ Strict & Permissive Modes - Strict refuses unregistered domains. Permissive lets them through unpinned, with no validation events, and is for development only (release builds must use strict)
  • ✅ Comprehensive Error Handling - Detailed error codes for debugging
  • ✅ Embedded Configuration Fallback - Optional signed configuration bundled in the app, for a first launch with no reachable configuration source (RASP-protected apps only)

Validation Listener Payload

Every SDK offers an observe-only listener for definitive pin verdicts. What a failure event carries differs by platform:

PlatformFailure event carries
SwiftInstance ID, domain, error, and the presented leaf certificate (presentedCertificate, DER-encoded Data)
KotlinInstance ID, domain, error, and the presented leaf certificate (X509Certificate)
FlutterDomain, error code, and the presented leaf certificate as PEM
React NativeDomain, failure code, and timestamp. No certificate material

Treat a presented certificate as untrusted input. See each platform’s guide for the exact API.


Platform-Specific Documentation

Choose your platform to view detailed integration guides, API references, and examples:


Need Help?