Production-ready security utilities for Swift/SwiftUI applications. Built for Detroit's cybersecurity and DevRel community.
- Keychain integration
- Encrypted data storage
- Device-only access
- Actor-based thread safety
- Email validation
- XSS prevention
- SQL injection detection
- Input sanitization
- Face ID / Touch ID support
- Async/await API
- Type detection
- Error handling
- Certificate pinning
- Secure requests
- Timeout handling
- Response validation
dependencies: [
.package(url: "https://github.com/durellwilson/swift-security-toolkit.git", from: "1.0.0")
]import SwiftSecurityToolkit
let storage = SecureStorage()
// Store sensitive data
let apiKey = "secret-key".data(using: .utf8)!
try await storage.store(apiKey, key: "api_key")
// Retrieve
let retrieved = try await storage.retrieve(key: "api_key")
// Delete
try await storage.delete(key: "api_key")let validator = InputValidator()
// Validate email
let isValid = validator.validateEmail("[email protected]") // true
// Sanitize input
let clean = validator.sanitizeInput("<script>alert('xss')</script>") // ""
// Detect injection
let hasInjection = validator.detectInjection("'; DROP TABLE users--") // truelet auth = BiometricAuth()
// Check type
let type = await auth.biometricType() // .faceID or .touchID
// Authenticate
let success = try await auth.authenticate(reason: "Unlock app")let network = NetworkSecurity()
// Secure request
let data = try await network.secureRequest(url: URL(string: "https://api.example.com")!)- Secure credential storage
- Biometric authentication
- Certificate pinning for API calls
- HIPAA-compliant data storage
- Patient data encryption
- Secure network communication
- SSO integration
- Input validation
- Audit logging
- Actor-based: Thread-safe by design
- Async/await: Modern concurrency
- Protocol-oriented: Easy to mock/test
- Zero dependencies: Pure Swift/Foundation
swift test- Keychain operations: <10ms
- Input validation: <1ms
- Biometric auth: ~500ms (system)
- Network requests: Depends on latency
Built for Detroit's open source community. Contributions welcome!
- Fork repository
- Create feature branch
- Add tests
- Submit PR
MIT License
Part of Detroit's Swift and cybersecurity education initiative.
Related Projects:
Built with ❤️ in Detroit 🏭