@exodus/react-native-biometrics 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,17 @@ public final class RNBiometricsModule extends ReactContextBaseJavaModule {
28
28
  return NAME;
29
29
  }
30
30
 
31
+ @ReactMethod
32
+ public void isSupported(Promise promise) {
33
+ try {
34
+ BiometricManager biometricManager = BiometricManager.from(context);
35
+ int canAuthenticate = biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG);
36
+ promise.resolve(canAuthenticate == BiometricManager.BIOMETRIC_SUCCESS);
37
+ } catch (Exception e) {
38
+ promise.reject(e);
39
+ }
40
+ }
41
+
31
42
  @ReactMethod
32
43
  public void authenticate(String title, String subtitle, String cancelButtonText, Promise promise) {
33
44
  context.getCurrentActivity().runOnUiThread(new Runnable() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/react-native-biometrics",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "React Native Biometrics",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -43,9 +43,6 @@
43
43
  "url": "https://github.com/ExodusMovement/react-native-biometrics/issues"
44
44
  },
45
45
  "homepage": "https://github.com/ExodusMovement/react-native-biometrics#readme",
46
- "publishConfig": {
47
- "registry": "https://registry.npmjs.org/"
48
- },
49
46
  "peerDependencies": {
50
47
  "react": ">=16.8.0",
51
48
  "react-native": ">=0.57.0"
@@ -3,6 +3,9 @@ import { NativeModules } from 'react-native';
3
3
  const AndroidBiometrics = NativeModules.Biometrics;
4
4
 
5
5
  export default {
6
+ isSupported: async () => {
7
+ return AndroidBiometrics.isSupported();
8
+ },
6
9
  authenticate: async ({ title, subtitle, cancelButtonText }) => {
7
10
  return AndroidBiometrics.authenticate(title, subtitle, cancelButtonText);
8
11
  }
@@ -1,4 +1,7 @@
1
1
  export default {
2
+ isSupported: async () => {
3
+ return Promise.reject('Biometrics is not supported on this platform');
4
+ },
2
5
  authenticate: async () => {
3
6
  return Promise.reject('Biometrics is not supported on this platform');
4
7
  }