maui-secure-storage

Add DI-wrapped exception-safe secure storage to .NET MAUI apps across Android, iOS, Mac Catalyst, Windows.

Updated Nov 27, 2025
One-click install
npx skills add https://github.com/seydakaratekeli/KamPay3 --skill maui-secure-storage-seydakaratekeli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: maui-secure-storage
Source: https://github.com/seydakaratekeli/KamPay3/tree/main/KamPay/.github/skills/maui-secure-storage%20-%20Kopyala
Command: npx skills add https://github.com/seydakaratekeli/KamPay3 --skill maui-secure-storage-seydakaratekeli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about maui-secure-storage

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

FAQPage Schema
How do I securely store authentication tokens in .NET MAUI?

Securely store authentication tokens in .NET MAUI using SecureStorage.Default.SetAsync and GetAsync. This approach provides exception-safe retrieval patterns and a DI wrapper to ensure tokens are saved reliably across Android, iOS, Mac Catalyst, and Windows.

What is the best way to mock secure storage in .NET MAUI unit tests?

Mock secure storage in .NET MAUI unit tests by injecting an ISecureStorageService interface. This Skill provides a concrete SecureStorageService implementation wrapping SecureStorage.Default, allowing you to mock storage behavior and test token retrieval without device access.

Does .NET MAUI SecureStorage work with Android auto-backup?

.NET MAUI SecureStorage works with Android auto-backup, but corrupted backups can cause retrieval crashes. This Skill provides patterns to exclude or disable auto-backup rules and wrap GetAsync in exception handling to recover from corrupted backup restores safely.

Why does SecureStorage crash on iOS after restoring from a backup?

SecureStorage crashes on iOS after restoring from a backup due to Keychain entitlement mismatches and simulator caveats. This Skill highlights platform-specific behaviors and provides exception-safe retrieval to prevent crashes when accessing corrupted backup data.

Are there size limits for secure storage on Windows in .NET MAUI?

There are key and value size limits for secure storage on Windows in .NET MAUI. This Skill documents platform-specific behaviors for Windows, ensuring you account for these constraints when storing small secrets, tokens, or passwords using SecureStorage.Default.