file-protection-ref

Map iOS FileProtectionType levels to encryption behavior with Swift examples.

1.1k|81|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/CharlesWiltgen/Axiom --skill file-protection-ref
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: file-protection-ref
Source: https://github.com/CharlesWiltgen/Axiom/tree/main/.claude-plugin/plugins/axiom/skills/file-protection-ref
Command: npx skills add https://github.com/CharlesWiltgen/Axiom --skill file-protection-ref

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Comprehensive reference for iOS file encryption and data protection APIs, including FileProtectionType levels and when files are accessible.

Core Features & Use Cases

  • Understanding protection levels: complete, completeUnlessOpen, completeUntilFirstUserAuthentication, none
  • Choosing protection level for sensitive data
  • Background access considerations
  • Code examples and best practices

Quick Start

Explain which FileProtectionLevel is best for encrypting user health data that must remain available in the background.

Frequently Asked Questions about file-protection-ref

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

FAQPage Schema
What are iOS file protection levels and when should I use each one?

iOS file protection includes four FileProtectionType levels: complete (most restrictive, file inaccessible when device locked), completeUnlessOpen (accessible if already open when locked), completeUntilFirstUserAuthentication (accessible after first unlock), and none (no encryption). Choose based on data sensitivity and background access requirements.

How do I set file protection on iOS data at rest?

In Swift, set file protection using FileManager attributes with the fileProtectionType key when creating files, or apply it retroactively to existing files. Specify the appropriate FileProtectionType level matching your security and accessibility needs before writing sensitive data.

Can my app access encrypted files in the background with file protection enabled?

Background access depends on the protection level chosen. Complete protection blocks background access entirely; completeUnlessOpen allows access if the file was already open; completeUntilFirstUserAuthentication and none permit background access after first device unlock.

What's the best file protection level for health data that needs background availability?

Use completeUntilFirstUserAuthentication for health data requiring background access. It encrypts files at rest and becomes accessible after the user first unlocks the device, balancing security with background execution requirements.

Why am I getting access errors after device lock with file protection?

Access errors after lock occur when file protection level restricts access in the device's locked state. Verify your protection level matches your app's needs; complete protection always blocks locked access, while other levels have specific unlock or background-access conditions.

How do I compare file protection accessibility across different scenarios?

File protection accessibility varies by level and device state: complete blocks all locked access; completeUnlessOpen depends on pre-lock file state; completeUntilFirstUserAuthentication permits post-unlock access; none provides no encryption. Map your app's operational scenarios to matching protection levels.