swift-security-expert

Enforce iOS/macOS security patterns for Keychain, Secure Enclave, and CryptoKit in Swift.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/izo/Ulk --skill swift-security-expert-izo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-security-expert
Source: https://github.com/izo/Ulk/tree/main/community-skills/swift/swift-security
Command: npx skills add https://github.com/izo/Ulk --skill swift-security-expert-izo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill codifies best-practice patterns for securing iOS/macOS apps using Swift, focusing on Keychain, biometric authentication, CryptoKit, and Secure Enclave to protect credentials and secrets.

Core Features & Use Cases

  • Keychain fundamentals: add-or-update patterns, explicit kSecAttrAccessible, SecAccessControl ACLs, and OSStatus handling.
  • Biometric-bound secrets: hardware-backed storage, Secure Enclave, and resilient enrollment-change handling.
  • CryptoKit integration: authenticated encryption (AES-GCM/ChaChaPoly), HKDF, and post-quantum considerations (iOS 26+).
  • Cross-app sharing and migration: keychain sharing, migration from UserDefaults/plists to Keychain, and audit-ready patterns.

Quick Start

Audit a sample iOS project to replace insecure storage with Keychain-bound secrets and implement biometric protection for high-value data.

Frequently Asked Questions about swift-security-expert

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

FAQPage Schema
How do I securely store OAuth tokens and API keys in Swift?

To securely store OAuth tokens and API keys in Swift, use the Keychain with explicit kSecAttrAccessible attributes and SecAccessControl ACLs. This enforces hardware-backed protection for credentials instead of saving them in UserDefaults or plists.

How does Swift handle biometric-bound secrets using Secure Enclave?

Swift handles biometric-bound secrets by storing them in the Secure Enclave with SecAccessControl biometric ACLs. This hardware-backed storage requires Face ID or Touch ID authentication before releasing sensitive credentials, while resiliently handling enrollment changes.

What is the best way to implement AES-GCM authenticated encryption with CryptoKit?

The best way to implement AES-GCM authenticated encryption with CryptoKit is using AES.GCM to seal and open encrypted data. This provides authenticated encryption, ensuring both confidentiality and integrity for sensitive payloads across Apple platforms.

Can I share Keychain items across multiple iOS apps?

Yes, you can share Keychain items across multiple iOS apps by configuring keychain sharing groups. This cross-app sharing pattern uses shared access groups to securely migrate credentials and secrets between applications within the same developer team.

Does this approach align with OWASP MASVS and MASTG security guidelines?

Yes, this approach aligns with OWASP MASVS and MASTG security guidelines by enforcing best-practice patterns for secure storage, certificate trust, and biometric gating. It provides audit-ready Swift code patterns that meet mobile application security verification standards.

Why should I migrate credentials from UserDefaults to the Keychain?

You should migrate credentials from UserDefaults to the Keychain because UserDefaults stores data in plain text without hardware-backed protection. Moving to Keychain with SecAccessControl ensures secrets are encrypted, access-controlled, and resilient against unauthorized extraction.