Skip to content

HTTPClientCapability.TLSHandler: Server trust and client certificate callbacks - #192

Open
guoye-zhang wants to merge 2 commits into
apple:mainfrom
guoye-zhang:tls
Open

guoye-zhang wants to merge 2 commits into
apple:mainfrom
guoye-zhang:tls

Conversation

@guoye-zhang

Copy link
Copy Markdown
Collaborator

Using swift-certificates for Certificate and PrivateKey types. Implemented in both URLSession and AHC.

Dependencies:

swift-certificates PR: apple/swift-certificates#321
AHC branch: https://github.com/guoye-zhang/async-http-client/tree/per-request-tls-verification

@guoye-zhang guoye-zhang added the 🆕 semver/minor Adds new public API. label Oct 3, 2026
/// configuration.
func handleClientCertificateChallenge(distinguishedNames: [Data]) async throws -> (SecIdentity, [SecCertificate])?
func handleClientCertificateChallenge(
distinguishedNames: [DistinguishedName]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the future we should think if we should use Span<DistinguishedName> name here potentially might need new swift-certificates APIs though


/// An error raised while applying ``HTTPClientCapability/TLSHandler`` options to a request.
@available(anyAppleOS 26.0, *)
public struct HTTPClientTLSError: Error, Hashable, Sendable, CustomStringConvertible {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this error type exist here? I am not sure we should define a common error type here for TLS cert errors.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http-client kind/feature New feature. 🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants