Alex
Alex

Reputation: 459

How could I use BiometricAuthentication in MAUI?

Note. This question only refers to Android, for now. I will leave IOs for a later date.

I have the following situation in MAUI (which means C# in Visual Studio). I need to allow fingerprint authentication.

Using the library "Plugin.Fingerprint" I can, of course, show the prompt for fingerprint auth.

My question refers to the token I have to pass fo and from the server.

I understand that this authentication should work like this:

  1. Upon the initial successful login using username/password and the user's request to use from now on the fingerprint auth, I will ask the server to issue for this DeviceID some token, say, a GUID.
  2. The server saves this token (the GUID) in a database on the server in a table named, say, FingerprintAuth, with the key DeviceID.
  3. This token will also be sent to the user's device in some kind of response.
  4. The app will save somewhere on the device this authentication token.
  5. Upon each subsequent fingerprint auth in the app on this device, the app will send to the server the pair {deviceID, authentication token}.
  6. The server will look into the table FingerprintAuth and retrieve the token saved at step 3.
  7. The server compares the two tokens. Upon success, the server will issue to the app, again wrapped in some kind of response, a "ServiceToken", just as it does everytime a user successfully authenticates with {username, pass}.
  8. This "ServiceToken" will then be sent to the server with each subsequent query of the app.

Questions:

  1. Is my understanding of this strategy correct ?
  2. Where should I save this "AuthToken" on the device ? It should of course be saved somewhere secure, and surely encrypted.
  3. About the ebcryption: which should be the encryption method to be used for the token ? I have read a bit about the Android KeyStore, using CryptoObjects, etc, but I am not sure how to use that in C#. Is there any example code I could access ? NOTE: I have read about the plugin biometric_storage 5.0.1 but this uses Kotlin, Flutter, and other things I know nothing about :-( This is my first attempt at a mobile app. Note: there is a package named "biometric_storage 5.0.1" for Android, but I don't know whether to try to use that from MAUI (how ?) Note: I have found in NuGet a package named "BiometricStorage", but that seems to be abandoned, it has been downloaded only a few times and has been published over 5 years ago.
  4. Is there any sample code somewhere on the net ? I couldn't find much info in my research.

Thank you very much Alex

Upvotes: 0

Views: 230

Answers (0)

Related Questions