You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Install the latest stable version of `BiometryService` in your platform heads and `BiometryService.Abstractions` in your presentation layer if you are using MVVM pattern, and if not just install both in your platform heads.
35
-
36
-
A small sample Uno application is available as a playground with some basic command to test the service methods.
37
-
They also provide some basic initialization but no dependency injection and more complex code.
38
-
39
-
### Instantiation
40
-
41
-
#### Android
42
-
43
-
Face authentication is only available when using `.SetAllowedAuthenticators(AndroidX.Biometric.BiometricManager.Authenticators.BiometricWeak)` in the `BiometricPrompt.PromptInfo.Builder` instantiation that is required for the service. Please note that if you are using `.SetAllowedAuthenticators(AndroidX.Biometric.BiometricManager.Authenticators.BiometricStrong)` in the `BiometricPrompt.PromptInfo.Builder` Face authentication is only available on a Google Pixel 4 as of now.
44
-
45
-
Please note that Encrypt/Decrypt methods are only available when using `.SetAllowedAuthenticators(AndroidX.Biometric.BiometricManager.Authenticators.BiometricStrong)` in the `BiometricPrompt.PromptInfo.Builder` instantiation that is required for the service.
9
+
1. Install `BiometryService` nuget package.
10
+
11
+
1. Get an `IBiometryService` instance.
12
+
13
+
`IBiometryService` is implemented by `BiometryService`.
14
+
The constructor of `BiometryService` is different on each platform.
15
+
16
+
### Windows
17
+
18
+
On Windows there are no parameters.
19
+
20
+
```cs
21
+
_biometryService=newBiometryService();
22
+
```
23
+
24
+
### Android
25
+
26
+
On Android, you need to provide a `fragmentActivity` and a `promptInfoBuilder`.
- Face authentication is only available when using `.SetAllowedAuthenticators(AndroidX.Biometric.BiometricManager.Authenticators.BiometricWeak)` in the `BiometricPrompt.PromptInfo.Builder` instantiation that is required for the service. Please note that if you are using `.SetAllowedAuthenticators(AndroidX.Biometric.BiometricManager.Authenticators.BiometricStrong)` in the `BiometricPrompt.PromptInfo.Builder` Facial authentification is exclusively accessible on phones equipped with Class 3 Biometric capabilities. (Pixel 4 and 8 for now).
83
+
84
+
- Please note that `Encrypt` and `Decrypt` methods are only available when using `.SetAllowedAuthenticators(AndroidX.Biometric.BiometricManager.Authenticators.BiometricStrong)` in the `BiometricPrompt.PromptInfo.Builder` instantiation that is required for the service.
85
+
86
+
- Please also note that the prompt builder `SetTitle` and `SetSubtitle` are used for both `Fingerprint` and `Face` biometry. We suggest that you use something generic enough for both cases.
87
+
88
+
### iOS
89
+
90
+
- The `laContext` parameter (local authentication context) can be set by creating a new [LAContext](https://developer.apple.com/documentation/localauthentication/lacontext#2930204).
91
+
```csharp
92
+
varlaContext=newLAContext
93
+
{
94
+
LocalizedReason="This app wants to use biometry for ...",
95
+
LocalizedFallbackTitle="Fallback Title",
96
+
LocalizedCancelTitle="Cancel Title"
97
+
};
98
+
```
99
+
- Please note that the subtitle passed via `useOperationPrompt` is only displayed on devices using TouchID.
46
100
47
-
Please also note that the title and subtitle are used for `Fingerprint` and `Face` biometry.
48
-
49
-
Here is an example of instantiation of the service for Android.
On Android, a new `CryptoObject` from `AndroidX.Biometric` is created with a key as a parameter. Then the data is encrypted and presented to the `BiometricPrompt` manager.
160
+
The final step encodes the data in base64 and stores it in the shared preferences.
125
161
126
-
A new `CryptoObject` from `AndroidX.Biometric` is created with a key as a parameter. Then the data will be encrypted and presented to the `BiometricPrompt` manager.
127
-
The final step will encode the data in base64 and store it in App with the shared preferences.
128
-
129
-
#### iOS
130
-
131
-
The `SecKeyChain` will be used to store a string linked to a key. The OS is in charge of securing the data with biometric authentication during the process.
162
+
On iOS, the `SecKeyChain` is used to store a string linked to a key. The OS is in charge of securing the data with biometric authentication during the process.
132
163
133
164
### Decrypt
134
165
135
-
Decrypts and gets the data associated to the given key name.
166
+
This method decrypts and gets the data associated to the given key.
Retrieve the shared preference encrypted data, then decrypt it with the secret as a parameter by presenting it to the `BiometricPrompt` manager.
144
-
145
-
#### iOS
172
+
On Android, the method retrieves the shared preference encrypted data, then decrypts it with the secret as a parameter by presenting it to the `BiometricPrompt` manager.
146
173
147
-
Retrieve the encrypted data from the `SecKeyChain` with the secret as a parameter. iOS is in charge of decrypting the data with biometric Authentication during the process.
174
+
On iOS, the method retrieves the encrypted data from the `SecKeyChain` with the secret as a parameter. iOS is in charge of decrypting the data with biometric authentication during the process.
148
175
149
176
### Remove
150
177
151
-
Removes the ecrypted value in the platform secure storage.
178
+
This method removes the ecrypted value from the platform secure storage.
152
179
153
180
```cs
154
181
biometryService.Remove("KeyName");
155
182
```
156
183
157
-
####Android
184
+
On Android, the method removes the encrypted data from the shared preferences.
158
185
159
-
Remove the encrypted data from the shared preferences.
186
+
On iOS, the method removes the encrypted data from the `SecKeyChain`.
160
187
161
-
#### iOS
188
+
##Breaking Changes
162
189
163
-
Remove the encrypted data from the `SecKeyChain`.
190
+
Please consult the [BREAKING CHANGES](BREAKING_CHANGES.md) for more information about breaking changes history.
164
191
165
192
## Changelog
166
193
@@ -177,10 +204,4 @@ This project is licensed under the Apache 2.0 license - see the
177
204
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on the process for
178
205
contributing to this project.
179
206
180
-
Be mindful of our [Code of Conduct](CODE_OF_CONDUCT.md).
181
-
182
-
## Contributors
183
-
184
-
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
185
-
186
-
<!-- ALL-CONTRIBUTORS-LIST:END -->
207
+
Be mindful of our [Code of Conduct](CODE_OF_CONDUCT.md).
0 commit comments