@castleio/react-native-castle
v4.0.1
Published
Castle SDK for React Native
Readme
Castle for React Native
Castle adds real-time monitoring to your authentication stack, instantly notifying you and your users of potential account hijacks.
NOTE: Version 4.0.0 has breaking changes compared to previous 2.x.x versions. Android now requires 8.0+ (minSdkVersion 26, compileSdkVersion 36), so apps supporting API 24-25 cannot upgrade, and the iOS deployment target was raised from 12.0 to 13.0. In addition:
userAgent(),queueSize()and thesensorTrackingEnabledoption have been removed.flushIfNeeded()andbaseUrl()are iOS only. On AndroidflushIfNeeded()is a no-op andbaseUrl()resolvesnull.createRequestToken()resolvesnullinstead of an empty string before the SDK has been configured.configure()andconfigureWithPublishableKey()reject the promise when configuration fails instead of resolving.baseURLAllowListentries must include a scheme, for examplehttps://api.example.com.
See the CHANGELOG for the full list.
Requirements
React Native
- React Native 0.77.0+
iOS
- iOS 15.1+
- Xcode 16.3+
Android
- Android 8.0 (API 26)
- compileSdkVersion 36
Installation
Add the @castleio/react-native-castle package to your package.json.
yarn
yarn add @castleio/react-native-castlenpm
npm install --save @castleio/react-native-castleLinking Native Code on iOS
Run pod install in the ios directory in order to link to the native iOS project. A shortcut for doing this without switching directories is to run
npx pod-installThe Castle iOS SDK ships as a binary XCFramework vendored inside this package, so CocoaPods links, embeds and signs it for you. No extra Podfile setup is required.
Once completed, re-build the app binary and start using the library
npx react-native run-iosLiking Native Code on Android
In order to start using the library you'll need to re-build the app binary
npx react-native run-androidUsage
Please see the Mobile Integration Guide.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
