swift-security

Implement Keychain, biometric, CryptoKit, and certificate pinning on Apple platforms.

Updated May 10, 2026
One-click install
npx skills add https://github.com/FelixRauch/medat-figuren --skill swift-security-felixrauch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-security
Source: https://github.com/FelixRauch/medat-figuren/tree/main/.agents/skills/swift-security
Command: npx skills add https://github.com/FelixRauch/medat-figuren --skill swift-security-felixrauch

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you prevent insecure iOS security implementations by providing correct, Apple-documented patterns for Keychain, biometric gating, CryptoKit cryptography, certificate trust, and compliance-ready review guidance.

Core Features & Use Cases

  • Keychain correctness & safety: Implements SecItem CRUD using exhaustive OSStatus handling, explicit accessibility control, and safe add-or-update semantics to avoid silent failures and fragile credential lifecycle bugs.
  • Biometric security that can’t be bypassed: Guides secure designs using SecAccessControl + keychain-bound authentication instead of LAContext evaluatePolicy boolean gates.
  • Cryptography done right: Recommends correct CryptoKit primitives (AES-GCM/ChaChaPoly, HMAC, SHA-2/SHA-3 where available) and safe key derivation (HKDF, PBKDF2) with strong misuse prevention (e.g., nonce reuse).
  • Certificate trust & pinning strategy: Covers SecTrust evaluation, SPKI/intermediate pinning approaches, mTLS handling, and ATS interactions with operational rotation guidance.
  • Use Case: Review or implement an iOS app’s login/credential storage and TLS validation so tokens are stored safely, biometric-protected secrets unlock via the keychain, and server identity is verified with a resilient pinning strategy.

Quick Start

Ask the AI agent: "Review my Swift code that stores an OAuth token and uses Face ID, then rewrite it to follow Keychain + SecAccessControl best practices and provide the OSStatus-based error handling checklist."

Frequently Asked Questions about swift-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I store OAuth tokens in the iOS Keychain using Swift without silent failures?

To store OAuth tokens in the iOS Keychain safely, implement SecItem CRUD operations with explicit accessibility control and exhaustive OSStatus handling to avoid silent credential lifecycle failures and ensure secure data protection.

Why does using LAContext evaluatePolicy for biometric gating create a security bypass risk?

Using LAContext evaluatePolicy for biometric gating creates a bypass risk because it returns a simple boolean. Secure designs require SecAccessControl with keychain-bound authentication to ensure secrets unlock only through hardware-backed biometric protection.

What's the best way to implement certificate pinning in iOS without using deprecated APIs?

The best way to implement resilient certificate pinning in iOS is using SecTrust evaluation combined with SPKI or intermediate pinning approaches, while handling mTLS and ATS interactions to avoid deprecated APIs and ensure operational rotation readiness.

How do I prevent nonce reuse when implementing cryptography with CryptoKit?

To prevent nonce reuse and other cryptographic misuses in CryptoKit, implement safe key derivation using HKDF or PBKDF2 and apply correct primitives like AES-GCM, ChaChaPoly, and SHA-2/SHA-3 for robust construction.

Can I use the Secure Enclave for biometric access control on iOS?

Yes, you can leverage the Secure Enclave for biometric access control by binding authentication to Keychain Services via SecAccessControl, ensuring non-bypassable biometric gating and hardware-backed protection for sensitive credentials.