I would open an issue on the .NET MAUI GitHub with the feature request: https://github.com/dotnet/maui
Can Sync Support to Maui SecureStorage be Added, Please?
I can see a plea to @James Montemagno for sync SecureStorage to be added from as far back as over 3 years ago (then under Xamarin.Essentials
, now Microsoft.Maui.Storage
namespace), for example as posted here. As someone commented in that plea, I also find it real pain for implementation when it comes to using the async SecureStorage.
This is the case because most usage of SecureStorage shows up in a constructor, for example, database initialization where the encryption key is obtained as await SecureStorage.GetAsync("ciptherKey")
. Since an instance constructor cannot be async, the workaround at best is not elegant when a sync version like SecureStorage.Get("ciptherKey")
could save the day.
Could @James Montemagno please please please reconsider the inclusion of sync SecureStorage getter and setter for Maui?
-
James Montemagno 351 Reputation points Microsoft Employee
2022-08-04T21:16:21.027+00:00