Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-native-touch-id-android
Advanced tools
Readme
Fingerprint identity for Android based on https://github.com/ajalt/reprint
current latest version: v0.1.x
for RN < 0.47.0, use react-native-touch-id-android@0.0.5
An example working project is available at: https://github.com/ElekenAgency/react-native-touch-id-android/tree/master/example
Tested only on RN version > 0.40
npm install react-native-touch-id-android --save
react-native link react-native-touch-id-android
android/build.gradle
(not android/app/build.gradle, pay attention):
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { url "https://jitpack.io" } // <--- add this line
}
}
android/app/src/main/java/<YOUR-APP-FOLDER>/MainApplication
file, check if you already have this lines:
import com.github.ajalt.reprint.core.Reprint; // <- add this line
import co.eleken.react_native_touch_id_android.FingerprintPackage; // <- add this line
public class MainApplication extends Application implements ReactApplication {
...
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new FingerprintPackage() // <- add this line
);
}
};
@Override
public void onCreate() {
super.onCreate();
Reprint.initialize(this); // <- add this line
}
...
Finger.isSensorAvailable()
: Promise returns true
if success and string error
in other cases (including case when you have sensor, but not enabled it in your phone's settings)
Finger.isSensorAvailable()
.then((isAvailable) => { })
.catch(error => { });
Finger.requestTouch()
: Promise returns true
if success and string error
in other cases.
Finger.requestTouch()
.then(success => { })
.catch(error => { });
Finger.dismiss()
if you open sensor and want to close it before touching (like when close app or dialog)
import Finger from 'react-native-touch-id-android'
export default class TouchTest extends Component {
componentDidMount() {
Finger.isSensorAvailable()
.then((isAvailable) => {
ToastAndroid.show('Sensor is available and is waiting for touch', ToastAndroid.SHORT);
this.touchAuth()
})
.catch(error => {
ToastAndroid.show(error, ToastAndroid.SHORT);
});
}
touchAuth(){
Finger.requestTouch()
.then(success => {
ToastAndroid.show('Access granted', ToastAndroid.SHORT);
})
.catch(error => {
ToastAndroid.show(error, ToastAndroid.SHORT);
});
}
render() {
return (
...
);
}
componentWillUnmount(){
Finger.dismiss()
}
}
If you made 5 wrong fingerprint attempts, Android Fingerprint API requires some time to continue work with sensor. In that case Finger.requestTouch()
returns error LOCKED_OUT
, so it would be good to make user awared that senser is temporary unavailable (near 30 seconds).
Feel free to open an issue
FAQs
touchID for React Native (Android)
The npm package react-native-touch-id-android receives a total of 46 weekly downloads. As such, react-native-touch-id-android popularity was classified as not popular.
We found that react-native-touch-id-android demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.