Accessing the Native PowerAuthSDK
If you need to access the native PowerAuthSDK object (created in the JS/TS code) from Java/Kotlin or Objective-C/Swift, you can use the following snippets.
Consider consultation with our technical support when accessing the native object. This technique should be used rarely and only for limited purposes as it might lead to unexpected behavior.
iOS
To access the native PowerAuthSDK
object on iOS, use the LiftPowerAuthSdk
helper method.
#import "LiftPowerAuthSdk.h"
#import <PowerAuth2/PowerAuthSDK.h>
// The `bridge` availability depends on the place, where you're trying to access the PowerAuthSDK object.
// For example, you can access it in the AppDelegate that implements `RCTAppDelegate` or as property of an `RCTBridgeModule`.
PowerAuthSDK * sdk = LiftPowerAuthSdk(@"myPowerauthInstance", bridge);
if (sdk) {
// Do something with the native instance
}
Android
To access the native PowerAuthSDK
object on Android, use the PowerAuthUtils.liftPowerAuthSdk
helper method.
import com.wultra.android.powerauth.reactnative.PowerAuthUtils;
import io.getlime.security.powerauth.sdk.PowerAuthSDK;
// The `reactNativeContext` availability depends on the place, where you're trying to access the PowerAuthSDK object.
// For example, you can pass it when creating our package when implementing `ReactPackage` interface.
PowerAuthSDK sdk = PowerAuthUtils.liftPowerAuthSdk("test", reactNativeContext);
if (sdk != null) {
// Do something with the native instance
}
Last updated on Jan 13, 2025 (16:23)
Edit on Github
Send Feedback