axiom-keychain
БесплатноБез исполняемых скриптовНе проверенUse when storing credentials, tokens, or secrets securely, debugging SecItem errors (errSecDuplicateItem, errSecItemNotFound, errSecInteractionNotAllowed)…
от ComeOnOliver★ 67 звёзд на GitHubОб этом скилле
Keychain Services
Secure credential storage, SecItem API mental model, uniqueness constraints, data protection classes, biometric access control, keychain sharing, and Mac keychain differences for iOS/macOS apps.
When to Use This Skill
Use when you need to:
- ☑ Store tokens, passwords, API keys, or cryptographic keys securely
- ☑ Debug errSecDuplicateItem, errSecItemNotFound, or errSecInteractionNotAllowed
- ☑ Choose the right kSecAttrAccessible level for your use case
- ☑ Add biometric or passcode protection to a keychain item
- ☑ Share credentials between apps or app extensions via access groups
- ☑ Migrate from UserDefaults/@AppStorage to keychain for sensitive data
- ☑ Understand why SecItemCopyMatching returns something different than expected
- ☑ Store or retrieve keychain items from a background context
Example Prompts
"How do I store an auth token in the keychain?" "errSecDuplicateItem when saving to keychain but the item doesn't exist" "My keychain read fails in background refresh" "How do I add Face ID protection to a keychain item?" "Share keychain items between my app and widget extension" "What's the difference between kSecAttrAccessibleAfterFirstUnlock and WhenUnlocked?" "SecItemCopyMatching returns errSecItemNotFound but I just saved it" "How do I use the keychain on macOS with Catalyst?" "My keychain wrapper is returning nil — how do I debug this?" "errSecInteractionNotAllowed in background task"
Red Flags
Signs you're making this harder than it needs to be:
- ❌ Using a keychain wrapper without understanding SecItem — Wrappers hide the 4-function model and introduce their own bugs. Quinn "The Eskimo!" explicitly warns: most wrapper issues stem from the wrapper, not the keychain. Learn the model first.
- ❌ Storing tokens in UserDefaults or @AppStorage — These are plist files readable by anyone with device access (or a backup). Credentials belong in the keychain. No exceptions.
- ❌ Force-unwrapping SecItemCopyMatching results — The return type depends on which kSecReturn* flags you passed. A mismatch gives you a surprising type, not your data.
- ❌ Not specifying kSecAttrAccessible — Defaults to kSecAttrAccessibleWhenUnlocked, which fails in background execution. If your app does background refresh, push processing, or VoIP, this will bite you.
- ❌ Catching errSecDuplicateItem by deleting then re-adding — This creates a race condition and destroys metadata (creation date, access control). Use SecItemUpdate instead.
- ❌ Using kSecMatchLimitAll without understanding delete semantics — SecItemDelete has no kSecMatchLimit; it deletes ALL matching items. One careless query can wipe credentials.
- ❌ Ignoring errSecDuplicateItem — "It worked last time" means you have a query/uniqueness mismatch. This is the #1 keychain bug.
The 4-Function Model
Quinn's mental model: the keychain is a database with per-class tables. The four SecItem functions map directly to SQL.
| SecItem Function | SQL Equivalent | Purpose |
|---|---|---|
| SecItemAdd | INSERT | Create a new item |
| SecItemCopyMatching | SELECT | Read one or more items |
| SecItemUpdate | UPDATE | Modify an existing item |
| SecItemDelete | DELETE | Remove items |
Per-Class Tables
Each item class is a separate table with different columns (attributes):
| Class | kSecClass Value | Typical Use |
|---|---|---|
| Generic password | kSecClassGenericPassword | App credentials, tokens, secrets |
| Internet password | kSecClassInternetPassword | URL-associated credentials |
| Certificate | kSecClassCertificate | X.509 certificates |
| Key | kSecClassKey | Cryptographic keys |
| Identity | kSecClassIdentity | Certificate + private key pair |
For most iOS apps, you only need kSecClassGenericPassword. Internet passwords are for credentials tied to a specific server/protocol/port. Certificates and keys are for custom cryptographic operations.
Uniqueness Constraints
This is where most keychain bugs originate. Each class has a primary key — a combination of attributes that must be unique.
Generic Password Primary Key
kSecAttrService + kSecAttrAccount + kSecAttrAccessGroup
Internet Password Primary Key
kSecAttrServer + kSecAttrAccount + kSecAttrPort
+ kSecAttrProtocol + kSecAttrAuthenticationType + kSecAttrSecurityDomain
+ kSecAttrAccessGroup
See axiom-keychain-ref for the full attribute breakdown per class.
The errSecDuplicateItem Trap
You call SecItemCopyMatching with a query and get errSecItemNotFound. You call SecItemAdd with what you think is the same item. You get errSecDuplicateItem. How?
The query attributes don't match the uniqueness attributes. Your copy query might search by kSecAttrService alone, but uniqueness is service + account + accessGroup. An item exists with the same service but a different account — your query misses it, but your add hits the uniqueness constraint on the combination.
// This query finds nothing (searching by service + label, b
Установить axiom-keychain в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл axiom-keychain?
Use when storing credentials, tokens, or secrets securely, debugging SecItem errors (errSecDuplicateItem, errSecItemNotFound, errSecInteractionNotAllowed), managing keychain access groups, or choosing accessibility classes. Covers SecItem API mental model, uniqueness constraints, data protection, biometric access control, sharing between apps, and Mac keychain differences.
Как установить скилл axiom-keychain?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл axiom-keychain запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic