Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

React Native Touch ID is a [React Native](http://facebook.github.io/react-native/) library for authenticating users with biometric authentication methods like Face ID and Touch ID on both iOS and Android (experimental).

⚠️ Note: **This library is not currently actively maintained.** If you're looking for something more stable that "just works", the awesome folks over at [Expo](https://expo.io) have begun open-sourcing some of their modules for compatability with React Native projects not built with Expo. As such you can attempt to use their equivalent library called [LocalAuthentication](https://docs.expo.io/versions/v30.0.0/sdk/local-authentication) at [expo-local-authentication](https://www.npmjs.com/package/expo-local-authentication) if you run into any issues here!
Note: the awesome folks over at [Expo](https://expo.io) have begun open-sourcing some of their modules for compatability with React Native projects not built with Expo. As such you can attempt to use their equivalent library called [LocalAuthentication](https://docs.expo.io/versions/v30.0.0/sdk/local-authentication) at [expo-local-authentication](https://www.npmjs.com/package/expo-local-authentication) if you run into any issues here!

![react-native-touch-id](https://cloud.githubusercontent.com/assets/1627824/7975919/2c69a776-0a42-11e5-9773-3ea1c7dd79f3.gif)

Expand Down Expand Up @@ -260,7 +260,6 @@ Format:
| `LAErrorPasscodeNotSet` | Authentication could not start because the passcode is not set on the device. |
| `LAErrorTouchIDNotAvailable` | Authentication could not start because Touch ID is not available on the device |
| `LAErrorTouchIDNotEnrolled` | Authentication could not start because Touch ID has no enrolled fingers. |
| `LAErrorTouchIDLockout` | Authentication failed because of too many failed attempts. |
| `RCTTouchIDUnknownError` | Could not authenticate for an unknown reason. |
| `RCTTouchIDNotSupported` | Device does not support Touch ID. |

Expand Down
4 changes: 2 additions & 2 deletions TouchID.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default {
(error, code) => {
return reject(createError(config, error, code));
},
(biometryType) => {
return resolve(biometryType);
success => {
return resolve(true);
}
);
});
Expand Down
4 changes: 0 additions & 4 deletions TouchID.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ - (NSString *)getErrorReason:(NSError *)error
case LAErrorTouchIDNotEnrolled:
errorReason = @"LAErrorTouchIDNotEnrolled";
break;

case LAErrorTouchIDLockout:
errorReason = @"LAErrorTouchIDLockout";
break;

default:
errorReason = @"RCTTouchIDUnknownError";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TouchID.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>11</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>58B511DA1A9E6C8500147676</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
<dict>
<key>SchemeUserState</key>
<dict>
<key>TouchID.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>11</integer>
<key>isShown</key>
<false/>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>58B511DA1A9E6C8500147676</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TouchID.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>58B511DA1A9E6C8500147676</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
<dict>
<key>SchemeUserState</key>
<dict>
<key>TouchID.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<key>isShown</key>
<false/>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>58B511DA1A9E6C8500147676</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
12 changes: 6 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Inspired by rayronvictor's PR #248 tp react-native-config
// https://github.com/luggit/react-native-config/pull/248

def _ext = rootProject.ext

buildscript {
repositories {
maven {
Expand All @@ -14,12 +9,17 @@ buildscript {
}

dependencies {
classpath _ext.has('gradleBuildTools') ? _ext.gradleBuildTools : 'com.android.tools.build:gradle:3.4.0'
classpath 'com.android.tools.build:gradle:3.3.1'
}
}

apply plugin: 'com.android.library'

// Inspired by rayronvictor's PR #248 tp react-native-config
// https://github.com/luggit/react-native-config/pull/248

def _ext = rootProject.ext

def _reactNativeVersion = _ext.has('reactNative') ? _ext.reactNative : '+'
def _compileSdkVersion = _ext.has('compileSdkVersion') ? _ext.compileSdkVersion : 27
def _buildToolsVersion = _ext.has('buildToolsVersion') ? _ext.buildToolsVersion : '27.0.3'
Expand Down
12 changes: 9 additions & 3 deletions android/src/main/java/com/rnfingerprint/DialogResultHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@ public DialogResultHandler(Callback reactErrorCallback, Callback reactSuccessCal
@Override
public void onAuthenticated() {
FingerprintAuthModule.inProgress = false;
successCallback.invoke("Successfully authenticated.");
if(successCallback != null) {
successCallback.invoke("Successfully authenticated.");
}
}

@Override
public void onError(String errorString, int errorCode) {
FingerprintAuthModule.inProgress = false;
errorCallback.invoke(errorString, errorCode);
if (errorCallback != null) {
errorCallback.invoke(errorString, errorCode);
}
}
@Override
public void onCancelled() {
FingerprintAuthModule.inProgress = false;
errorCallback.invoke("cancelled", FingerprintAuthConstants.AUTHENTICATION_CANCELED);
if (errorCallback != null) {
errorCallback.invoke("cancelled", FingerprintAuthConstants.AUTHENTICATION_CANCELED);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ public void isSupported(final Callback reactErrorCallback, final Callback reactS

int result = isFingerprintAuthAvailable();
if (result == FingerprintAuthConstants.IS_SUPPORTED) {
// TODO: once this package supports Android's Face Unlock,
// implement a method to find out which type of biometry
// (not just fingerprint) is actually supported
reactSuccessCallback.invoke("Fingerprint");
reactSuccessCallback.invoke("Is supported.");
} else {
reactErrorCallback.invoke("Not supported.", result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ public interface DialogResultListener {
@Override
public void onAuthenticated() {
this.isAuthInProgress = false;
this.dialogCallback.onAuthenticated();
if (this.dialogCallback != null) {
this.dialogCallback.onAuthenticated();
}
dismiss();
}

Expand All @@ -181,7 +183,9 @@ public void onError(String errorString, int errorCode) {
public void onCancelled() {
this.isAuthInProgress = false;
this.mFingerprintHandler.endAuth();
this.dialogCallback.onCancelled();
if (this.dialogCallback != null) {
this.dialogCallback.onCancelled();
}
dismiss();
}
}
4 changes: 0 additions & 4 deletions data/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const codes = {
LAErrorPasscodeNotSet: 'LAErrorPasscodeNotSet',
LAErrorTouchIDNotAvailable: 'LAErrorTouchIDNotAvailable',
LAErrorTouchIDNotEnrolled: 'LAErrorTouchIDNotEnrolled',
LAErrorTouchIDLockout: 'LAErrorTouchIDLockout',
RCTTouchIDNotSupported: 'RCTTouchIDNotSupported',
RCTTouchIDUnknownError: 'RCTTouchIDUnknownError'
},
Expand Down Expand Up @@ -56,9 +55,6 @@ const iOSErrors = {
[codes.iOSCodes.LAErrorTouchIDNotEnrolled]: {
message: 'Authentication could not start because Touch ID has no enrolled fingers.'
},
[codes.iOSCodes.LAErrorTouchIDLockout]: {
message: 'Authentication failed because of too many failed attempts.'
},
[codes.iOSCodes.RCTTouchIDUnknownError]: {
message: 'Could not authenticate for an unknown reason.'
},
Expand Down
3 changes: 0 additions & 3 deletions errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ const getError = (code) => {
case codes.iOSCodes.LAErrorUserFallback:
return errors.USER_FALLBACK;

case codes.iOSCodes.LAErrorTouchIDLockout:
return errors.LOCKOUT;

default:
return errors.UNKNOWN_ERROR;
}
Expand Down
3 changes: 0 additions & 3 deletions examples/BiometricAuthExample/.babelrc

This file was deleted.

6 changes: 0 additions & 6 deletions examples/BiometricAuthExample/.buckconfig

This file was deleted.

48 changes: 0 additions & 48 deletions examples/BiometricAuthExample/.flowconfig

This file was deleted.

1 change: 0 additions & 1 deletion examples/BiometricAuthExample/.gitattributes

This file was deleted.

53 changes: 0 additions & 53 deletions examples/BiometricAuthExample/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion examples/BiometricAuthExample/.watchmanconfig

This file was deleted.

Loading