Implementing device lock–based user authentication
This commit is contained in:
10
package-lock.json
generated
10
package-lock.json
generated
@@ -13,6 +13,7 @@
|
|||||||
"@react-native/new-app-screen": "0.83.1",
|
"@react-native/new-app-screen": "0.83.1",
|
||||||
"react": "19.2.0",
|
"react": "19.2.0",
|
||||||
"react-native": "0.83.1",
|
"react-native": "0.83.1",
|
||||||
|
"react-native-biometrics": "^3.0.1",
|
||||||
"react-native-safe-area-context": "^5.5.2"
|
"react-native-safe-area-context": "^5.5.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -10101,6 +10102,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-native-biometrics": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-native-biometrics/-/react-native-biometrics-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-Ru80gXRa9KG04sl5AB9HyjLjVbduhqZVjA+AiOSGqr+fNqCDmCu9y5WEksnjbnniNLmq1yGcw+qcLXmR1ddLDQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react-native": ">=0.60.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-native-safe-area-context": {
|
"node_modules/react-native-safe-area-context": {
|
||||||
"version": "5.6.2",
|
"version": "5.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.6.2.tgz",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
"@react-native/new-app-screen": "0.83.1",
|
"@react-native/new-app-screen": "0.83.1",
|
||||||
"react": "19.2.0",
|
"react": "19.2.0",
|
||||||
"react-native": "0.83.1",
|
"react-native": "0.83.1",
|
||||||
|
"react-native-biometrics": "^3.0.1",
|
||||||
"react-native-safe-area-context": "^5.5.2"
|
"react-native-safe-area-context": "^5.5.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
18
src/screen/GetPinAuthenticate.tsx
Normal file
18
src/screen/GetPinAuthenticate.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
import ReactNativeBiometrics from 'react-native-biometrics';
|
||||||
|
|
||||||
|
const rnBiometrics = new ReactNativeBiometrics({
|
||||||
|
allowDeviceCredentials: true, // IMPORTANT
|
||||||
|
});
|
||||||
|
|
||||||
|
const authenticateWithDevicePin = async () => {
|
||||||
|
const { success } = await rnBiometrics.simplePrompt({
|
||||||
|
promptMessage: 'Authenticate using device lock',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
console.log('User authenticated using device PIN / Pattern / FaceID');
|
||||||
|
} else {
|
||||||
|
console.log('Authentication cancelled');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user