What problem does it solve?
Securely persist small sensitive values such as tokens, passwords, and short secrets in .NET MAUI applications while avoiding platform-specific pitfalls that can cause crashes or data leakage. It highlights differences between Android, iOS, Mac Catalyst, and Windows storage behaviors and provides patterns to make storage robust and testable.
Core Features & Use Cases
- Safe access patterns for SetAsync, GetAsync, Remove, and RemoveAll with guidance to wrap retrieval in exception handling to recover from corrupted backups.
- Platform setup and gotchas covering Android auto-backup rules, iOS Keychain entitlements and simulator caveats, and Windows key/value size limits.
- Testability via DI with an ISecureStorageService interface and a concrete SecureStorageService implementation to allow mocking in unit tests.
- Use Case: Store an authentication token securely on-device while ensuring restores from backups do not crash the app and tests can mock storage behavior.
Quick Start
Use the skill to implement a DI-backed secure storage service that calls SecureStorage.Default.SetAsync and GetAsync for tokens with exception-safe retrieval and platform backup exclusions.