TrustPinConfiguration

data class TrustPinConfiguration(val organizationId: String, val projectId: String, val publicKey: String, val mode: TrustPinMode = TrustPinMode.STRICT, val configurationURL: URL? = null)

Configuration values for a TrustPin instance.

On Android — use one of the two Context-aware entry points

On Android the recommended setup paths are both Context-aware:

  • Bundled config: load the configuration from a trustpin.json in assets/ via TrustPinConfiguration.fromAssets(context).

TrustPin.setup(TrustPinConfiguration.fromAssets(context))
  • Programmatic config: build the configuration directly, then chain .withAndroidStorage(context):

val config = TrustPinConfiguration(orgId, projId, publicKey)
.withAndroidStorage(context)
TrustPin.setup(config)

Constructing a TrustPinConfiguration on Android without going through one of those paths is not recommended. The SDK still works, but the security profile of the instance is degraded. A one-shot info log is emitted in that case so the regression is operator-visible.

Single-use contract on Android

A configuration produced by withAndroidStorage(context) (or by fromAssets(context), which calls it internally) MUST be passed to exactly one TrustPin.setup call. Reusing the same decorated configuration for a second setup silently downgrades that subsequent instance. Build a fresh decorated configuration for each TrustPin instance you set up. See withAndroidStorage for a worked example.

On JVM

JVM consumers (server, desktop, embedded) construct the configuration directly and call TrustPin.setup. The Context-aware factories are unavailable and not needed on JVM.

TrustPin.setup(
TrustPinConfiguration(
organizationId = "my-org",
projectId = "my-project",
publicKey = "MFkwEwYH...",
mode = TrustPinMode.STRICT,
)
)

Constructors

Link copied to clipboard
constructor(organizationId: String, projectId: String, publicKey: String, mode: TrustPinMode = TrustPinMode.STRICT, configurationURL: URL? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Optional override for the configuration source. Leave null for the default hosted configuration.

Link copied to clipboard

Behaviour for unregistered domains. See TrustPinMode.

Link copied to clipboard

Organization identifier from the TrustPin dashboard.

Link copied to clipboard

Project identifier from the TrustPin dashboard.

Link copied to clipboard

Base64-encoded public key issued by the TrustPin dashboard.

Functions

Link copied to clipboard
fun TrustPinConfiguration.withAndroidStorage(context: ERROR CLASS: Symbol not found for Context): TrustPinConfiguration

Programmatic Android setup — wires this configuration to the Android Context and returns the same instance.