When users set a passcode, derive a high‑cost key using PBKDF2 or, better, Argon2id with mobile‑sane parameters tuned by real device tests. Mix in device‑bound secrets and salt, then use HKDF to create distinct subkeys for files, databases, metadata, and token protection across isolated execution contexts.
On iOS, prefer Data Protection classes that require the device to be unlocked for access, and enable biometric‑gated Keychain entries. On Android, request hardware‑backed keys, require user authentication where appropriate, and fail closed on emulators or unsupported chips. Document fallbacks explicitly so engineers avoid accidental weakening.
Plan rotation from day one. Tag every encrypted blob with key identifiers, schedule gradual rewraps during normal usage, and maintain a secure, revocable recovery mechanism. Never export raw keys for support; instead, rely on escrowed, device‑bound secrets with auditable access governed by strict, least‑privilege processes.