Classes

The following classes are available globally.

Objective-C Bundle Accessor

  • Undocumented

    See more

    Declaration

    Swift

    @objc
    public final class TrustPinKitResources : NSObject
  • A URLProtocol implementation that performs certificate pinning using TrustPin verification.

    This protocol intercepts HTTPS requests and validates server certificates against domain-specific whitelists using the TrustPin verification system.

    Usage

    // Register the protocol
    TrustPinURLProtocol.register()
    
    // Use with URLSession
    let session = URLSession(configuration: .default)
    // Requests will automatically use certificate pinning
    
    // Unregister when no longer needed
    TrustPinURLProtocol.unregister()
    
    See more

    Declaration

    Swift

    @available(iOS 13.0, macOS 13.0, tvOS 13.0, watchOS 7.0, visionOS 2.0, *)
    public final class TrustPinURLProtocol : URLProtocol, @unchecked Sendable
  • SSL certificate pinning for iOS, macOS, tvOS, watchOS, and visionOS.

    Single instance (app — existing usage, zero changes required)

    try await TrustPin.setup(TrustPinConfiguration(
        organizationId: "org", projectId: "proj", publicKey: key
    ))
    try await TrustPin.verify(domain: "api.example.com", certificate: pem)
    

    Multiple instances (library or multi-tenant app)

    A library should create its own isolated instance so it never interferes with the host app’s pinning configuration:

    // Inside the library (keep this reference private/internal)
    let pin = TrustPin.instance(id: "com.mylib.networking")
    try await pin.setup(TrustPinConfiguration(
        organizationId: "lib-org", projectId: "lib-proj", publicKey: libKey
    ))
    try await pin.verify(domain: "api.library.com", certificate: pem)
    

    URLProtocol (default instance only)

    registerURLProtocol() and unregisterURLProtocol() are static methods and always operate on TrustPin.default. They are intentionally unavailable on named instances — libraries should use makeURLSessionDelegate() instead.

    Thread Safety

    All operations are thread-safe. Internal state is protected by Swift actors.

    See more

    Declaration

    Swift

    public final class TrustPin : @unchecked Sendable