What problem does it solve?
Swift-Security provides a comprehensive, battle-tested approach to secure credential handling on Apple platforms, focusing on binding secrets to hardware-backed protections and preventing AI-generated insecure patterns such as storing tokens in UserDefaults or gating sensitive data behind a simple biometric check.
Core Features & Use Cases
- Keychain-bound secrets: store tokens, keys, and credentials with explicit SecAccessControl flags and device-bound accessibility.
- Biometric gating + Secure Enclave: leverage biometric authentication to unlock keychain items protected by the Secure Enclave.
- CryptoKit integration: perform signing, key agreement, and post-quantum considerations with modern cryptography primitives.
- Lifecycle patterns: add-or-update semantics, enrollment-change handling, and robust error handling for production-grade credential management.
- Cross-platform guidance: aligns with Apple Platform Security Guide, OWASP/MASVS MAStG mappings, and established credential-storage patterns.
Quick Start
Store a secret in the Keychain with biometric protection and retrieve it via a biometric-guarded query.
Quick Start
Configure the Keychain query with SecAccessControl, insert the secret, and read it back through SecItemCopyMatching with biometric prompts when required.
-- Note: The Quick Start section above is a plain instruction line to illustrate the intended workflow; implementers should adapt the steps to their app architecture and security requirements.
Quick Start
Perform a biometric-protected read of a credential from the Keychain using a SecItemCopyMatching query that relies on SecUseAuthenticationContext and a SecAccessControl ACL.