setupBlocking

fun setupBlocking(organizationId: String, projectId: String, publicKey: String, mode: TrustPinMode = TrustPinMode.STRICT)(source)

Initializes the TrustPin SDK with organization credentials (blocking version).

⚠️ WARNING: This method blocks the calling thread

This blocking method is provided for Java interoperability and non-coroutine contexts. It MUST NOT be called from:

  • Android main/UI thread (will cause ANR - Application Not Responding)

  • Any coroutine context (use suspend setup function instead)

  • High-frequency operations or performance-critical paths

Recommended Alternatives:

// ✅ RECOMMENDED: Kotlin with coroutines
lifecycleScope.launch {
TrustPin.setup(
organizationId = "prod-org-123",
projectId = "mobile-app-v2",
publicKey = "LS0tLS1CRUdJTi...",
mode = TrustPinMode.STRICT
)
}

// ✅ Java with ExecutorService
Executors.newSingleThreadExecutor().execute(() -> {
TrustPin.setupBlocking("prod-org-123", "mobile-app-v2", "LS0tLS1CRUdJTi...", TrustPinMode.STRICT);
});

// ❌ DON'T: Call from Android main thread
override fun onCreate(savedInstanceState: Bundle?) {
TrustPin.setupBlocking(...) // ❌ Will cause ANR!
}

When to use this method:

  • Command-line applications

  • Background services with dedicated worker threads

  • Testing scenarios with explicit thread management

Parameters

organizationId

Your organization identifier from the TrustPin dashboard

projectId

Your project identifier from the TrustPin dashboard

publicKey

Base64-encoded public key for signature verification

mode

The pinning mode controlling behavior for unregistered domains

Throws

if credentials are invalid or empty

if signature verification fails

if called from Android main thread


fun setupBlocking(organizationId: String, projectId: String, publicKey: String, configurationURL: URL, mode: TrustPinMode = TrustPinMode.STRICT)(source)

Initializes the TrustPin SDK with a custom configuration URL (blocking version).

⚠️ WARNING: This method blocks the calling thread

This blocking method is provided for Java interoperability and non-coroutine contexts. See setupBlocking for detailed usage warnings and recommended alternatives.

Parameters

organizationId

Your organization identifier from the TrustPin dashboard

projectId

Your project identifier from the TrustPin dashboard

publicKey

Base64-encoded public key for signature verification

configurationURL

Custom URL for the signed payload

mode

The pinning mode controlling behavior for unregistered domains

Throws

if credentials are invalid or empty

if signature verification fails

if called from Android main thread