TrustPinConfiguration
public struct TrustPinConfiguration : Sendable
Encapsulates all configuration options for a TrustPin instance.
Pass a TrustPinConfiguration to setup(_:) (or the static
setup(_:autoRegisterURLProtocol:) for the default instance).
All properties are immutable — construct the value once and pass it directly to setup.
Basic usage
try await TrustPin.setup(TrustPinConfiguration(
organizationId: "your-org-id",
projectId: "your-project-id",
publicKey: "your-base64-public-key"
))
Custom mode
try await TrustPin.setup(TrustPinConfiguration(
organizationId: "your-org-id",
projectId: "your-project-id",
publicKey: "your-base64-public-key",
mode: .permissive
))
Custom configuration URL
For self-hosted or BYOK deployments, supply a configurationURL pointing to a
signed JWS payload. CDN-managed projects should leave this nil.
try await TrustPin.setup(TrustPinConfiguration(
organizationId: "org",
projectId: "proj",
publicKey: key,
configurationURL: URL(string: "https://your-server.com/pins.jws")
))
-
Your organization identifier from the TrustPin dashboard.
Declaration
Swift
public let organizationId: String -
Your project identifier from the TrustPin dashboard.
Declaration
Swift
public let projectId: String -
Base64-encoded public key used to verify the signature of the pinning payload.
Declaration
Swift
public let publicKey: String
-
Controls how TrustPin behaves for domains not present in the pinning payload.
strict: throwsdomainNotRegistered(default, recommended for production)permissive: allows the connection and logs an informational message
Declaration
Swift
public let mode: TrustPinMode -
Custom URL for the signed pinning payload.
When
nil, TrustPin fetches from the CDN chain in order: primary → mobile → backup. When set, this URL is tried first; if it fails, the SDK falls through to the CDN chain automatically. Only set this for self-hosted or BYOK deployments.Declaration
Swift
public let configurationURL: URL? -
Creates a new
TrustPinConfigurationwith the required credentials and optional overrides.Declaration
Swift
public init(organizationId: String, projectId: String, publicKey: String, mode: TrustPinMode = .strict, configurationURL: URL? = nil)Parameters
organizationIdYour organization identifier from the TrustPin dashboard.
projectIdYour project identifier from the TrustPin dashboard.
publicKeyA Base64-encoded public key used to verify the signature of the pinning payload.
modeControls how TrustPin handles domains not present in the pinning payload. Defaults to
strict, which throwsdomainNotRegisteredfor unknown domains. Usepermissiveduring development to allow unregistered domains instead.configurationURLA custom URL pointing to a signed JWS pinning payload. When set, this URL is tried first; if it fails, the SDK automatically falls through to the CDN chain (primary → mobile → backup). Pass
nil(the default) to start directly from the CDN chain. Only set this for self-hosted or BYOK deployments.
View on GitHub
Install in Dash