Skip to content

Add TLS certificate pinning for API connections#20

Merged
dadachi merged 1 commit intomainfrom
add_tls_certificate_pinning
Mar 23, 2026
Merged

Add TLS certificate pinning for API connections#20
dadachi merged 1 commit intomainfrom
add_tls_certificate_pinning

Conversation

@dadachi
Copy link
Copy Markdown
Contributor

@dadachi dadachi commented Mar 22, 2026

Summary

  • Add CertificatePinningDelegate that validates server certificates against pinned SHA-256 public key hashes (leaf + intermediate CA) for api.nativeapptemplate.com
  • Centralize pinned URLSession via .pinned extension, replacing per-service URLSession(configuration: .default) instances
  • Provide default session implementation in the Service protocol so individual services no longer need to declare their own

Test plan

  • Verify app connects successfully to api.nativeapptemplate.com (pinned hashes match)
  • Verify app rejects connections if pinned hashes are modified (simulate pin mismatch)
  • Verify login, sign-up, and all API service calls work end-to-end
  • Confirm non-pinned-domain requests (if any) are unaffected

🤖 Generated with Claude Code

Pin leaf and intermediate CA public keys for api.nativeapptemplate.com
to prevent MITM attacks. Centralizes URLSession creation via .pinned
extension using a shared CertificatePinningDelegate, replacing
per-service URLSession instances with a default pinned session
in the Service protocol.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dadachi dadachi merged commit 501cf9c into main Mar 23, 2026
2 checks passed
@dadachi dadachi deleted the add_tls_certificate_pinning branch March 23, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant