File tree Expand file tree Collapse file tree 3 files changed +22
-28
lines changed
android/src/main/java/com/freeraspreactnative Expand file tree Collapse file tree 3 files changed +22
-28
lines changed Original file line number Diff line number Diff line change @@ -238,29 +238,21 @@ const actions = {
238238 ' device binding': () => {
239239 console.log(' device binding' );
240240 },
241- // iOS only
242- ' deviceID' : () => {
243- console.log(' deviceID' );
244- },
245- // iOS only
246- ' missingSecureEnclave' : () => {
247- console.log(' missingSecureEnclave' );
241+ // Android & iOS
242+ ' passcode' : () => {
243+ console.log(' passcode' );
248244 },
245+ // Android & iOS
246+ ' hardwareBackedKeystoreNotAvailable' : () => {
247+ console.log(' hardwareBackedKeystoreNotAvailable' );
248+ }
249249 // iOS only
250250 ' passcodeChange' : () => {
251251 console.log(' passcodeChange' );
252252 },
253253 // iOS only
254- ' passcode' : () => {
255- console.log(' passcode' );
256- }
257- // Android only
258- ' onUnlockedDevice' : () => {
259- console.log(' onUnlockedDeviceDetected' );
260- },
261- // Android only
262- ' onHardwareBackedKeystoreNotAvailable' : () => {
263- console.log(' onHardwareBackedKeystoreNotAvailableDetected' );
254+ ' deviceID' : () => {
255+ console.log(' deviceID' );
264256 }
265257};
266258
Original file line number Diff line number Diff line change @@ -78,23 +78,23 @@ class FreeraspReactNativeModule(val reactContext: ReactApplicationContext) :
7878 sendOngoingPluginResult(" device binding" , null )
7979 }
8080
81+ // This is optional. Use only if you are interested in device state information like device lock and HW backed keystore state
82+ private val deviceStateListener = object : ThreatListener .DeviceState {
83+ override fun onUnlockedDeviceDetected () {
84+ sendOngoingPluginResult(" unlockedDevice" , null )
85+ }
86+
87+ override fun onHardwareBackedKeystoreNotAvailableDetected () {
88+ sendOngoingPluginResult(" hardwareBackedKeystoreNotAvailable" , null )
89+ }
90+ }
91+
8192 private fun sendOngoingPluginResult (eventName : String , params : WritableMap ? ) {
8293 reactContext
8394 .getJSModule(DeviceEventManagerModule .RCTDeviceEventEmitter ::class .java)
8495 .emit(eventName, params)
8596 }
8697
87- // This is optional. Use only if you are interested in device state information like device lock and HW backed keystore state
88- private val deviceStateListener = object : ThreatListener .DeviceState {
89- override fun onUnlockedDeviceDetected () {
90- sendOngoingPluginResult(" onUnlockedDeviceDetected" , null )
91- }
92-
93- override fun onHardwareBackedKeystoreNotAvailableDetected () {
94- // Set your reaction
95- sendOngoingPluginResult(" onHardwareBackedKeystoreNotAvailableDetected" , null )
96- }
97- }
9898
9999 private fun parseTalsecConfig (config : ReadableMap ): TalsecConfig {
100100 val androidConfig = config.getMap(" androidConfig" )!!
Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ type NativeEventEmitterActions = {
3030 'missingSecureEnclave' ?: ( ) => any ;
3131 'passcodeChange' ?: ( ) => any ;
3232 'passcode' ?: ( ) => any ;
33+ 'unlockedDevice' ?: ( ) => any ;
34+ 'hardwareBackedKeystoreNotAvailable' ?: ( ) => any ;
3335 'started' ?: ( ) => any ;
3436 'initializationError' ?: ( reason : { message : string } ) => any ;
3537} ;
You can’t perform that action at this time.
0 commit comments