HACertificateProvider

public protocol HACertificateProvider

Protocol for providing certificate authentication for HAKit REST API calls

  • Called when the server requests a client certificate (mTLS)

    Declaration

    Swift

    func provideClientCertificate(
        for challenge: URLAuthenticationChallenge,
        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
    )

    Parameters

    challenge

    The authentication challenge

    completionHandler

    Handler to call with the authentication result

  • Called when the server’s SSL certificate needs validation

    Declaration

    Swift

    func evaluateServerTrust(
        _ serverTrust: SecTrust,
        forHost host: String,
        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
    )

    Parameters

    serverTrust

    The server trust to evaluate

    host

    The hostname being connected to

    completionHandler

    Handler to call with the validation result