File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
android/src/main/java/com/freeraspreactnative Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -253,7 +253,15 @@ const actions = {
253253 // iOS only
254254 ' passcode' : () => {
255255 console.log(' passcode' );
256+ }
257+ // Android only
258+ ' onUnlockedDevice' : () => {
259+ console.log(' onUnlockedDeviceDetected' );
256260 },
261+ // Android only
262+ ' onHardwareBackedKeystoreNotAvailable' : () => {
263+ console.log(' onHardwareBackedKeystoreNotAvailableDetected' );
264+ }
257265};
258266
259267useFreeRasp(config, actions);
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ class FreeraspReactNativeModule(val reactContext: ReactApplicationContext) :
2828 try {
2929 val config = parseTalsecConfig(options)
3030 listener.registerListener(reactContext)
31+ ThreatListener ( this ,deviceStateListener).registerListener(reactContext)
3132 Talsec .start(reactContext, config)
3233 sendOngoingPluginResult(" started" , null )
3334
@@ -83,6 +84,18 @@ class FreeraspReactNativeModule(val reactContext: ReactApplicationContext) :
8384 .emit(eventName, params)
8485 }
8586
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+ }
98+
8699 private fun parseTalsecConfig (config : ReadableMap ): TalsecConfig {
87100 val androidConfig = config.getMap(" androidConfig" )!!
88101 val packageName = androidConfig.getString(" packageName" )!!
You can’t perform that action at this time.
0 commit comments