mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 13:38:01 -05:00
@@ -1,6 +1,7 @@
|
||||
import { createModel } from 'xstate/lib/model';
|
||||
import * as LocalAuthentication from 'expo-local-authentication';
|
||||
import { EventFrom, MetaObject, StateFrom } from 'xstate';
|
||||
import { Platform } from 'react-native';
|
||||
|
||||
// ----- CREATE MODEL ---------------------------------------------------------
|
||||
const model = createModel(
|
||||
@@ -97,6 +98,9 @@ export const biometricsMachine = model.createMachine(
|
||||
authenticating: {
|
||||
invoke: {
|
||||
src: () => async () => {
|
||||
if (Platform.OS === 'android') {
|
||||
await LocalAuthentication.cancelAuthenticate();
|
||||
}
|
||||
const res = await LocalAuthentication.authenticateAsync({
|
||||
promptMessage: 'Biometric Authentication',
|
||||
|
||||
@@ -112,6 +116,9 @@ export const biometricsMachine = model.createMachine(
|
||||
actions: ['setStatus'],
|
||||
},
|
||||
},
|
||||
on: {
|
||||
AUTHENTICATE: 'authenticating',
|
||||
},
|
||||
},
|
||||
|
||||
reauthenticating: {
|
||||
@@ -145,6 +152,7 @@ export const biometricsMachine = model.createMachine(
|
||||
SET_IS_AVAILABLE: {
|
||||
target: '#biometrics.available',
|
||||
},
|
||||
AUTHENTICATE: 'authenticating',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -186,6 +194,9 @@ export const biometricsMachine = model.createMachine(
|
||||
},
|
||||
},
|
||||
},
|
||||
on: {
|
||||
AUTHENTICATE: 'authenticating',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user