@aliakhgar1/react-native-ikev2
v1.0.0
Published
An advanced React Native TurboModule for IKEv2
Readme
⚡ Turbo Module architecture for optimal performance
🔐 IKEv2/IPSec native protocol support
🍎 iOS Built-in NEVPNManager integration
🤖 Android strongSwan implementation
🔔 Customizable notifications with actions and timers
🔄 Event-driven connection state management
📝 Fully typed APIs with IntelliSense support
🌐 Advanced routing and custom DNS features
🧭 Fast Navigation
📦 Installation - Complete setup and platform configuration guide
→ Browse Installation Guide
📋 API Reference - Complete method and interface documentation
→ Browse API Documentation
💡 Usage Example - Practical implementation examples and guides
→ View Usage Examples
🔧 Troubleshoot and Debug - Problem solutions and debugging tools
→ Access Troubleshooting Guide
📦 Installation
Quick Install
# Using npm
npm install @aliakhgar1/react-native-ikev2
# Using yarn
yarn add @aliakhgar1/react-native-ikev2
# Install iOS dependencies (iOS only)
cd ios && pod install🎯 Prerequisites
React Native: 0.68+
Android: API 24+
iOS: 15.1+
🚀 Quick Start
Get up and running with IKEv2 VPN connectivity in under 5 minutes:
import * as IKEv2 from '@aliakhgar1/react-native-ikev2';
// 1. Check permissions (Android only)
const connectToVPN = async () => {
if (Platform.OS === 'android') {
const isPrepared = await IKEv2.isPrepared();
if (!isPrepared) {
const granted = await IKEv2.prepare();
if (!granted) return; // User denied permission
}
}
// 2. Connect with minimal configuration
await IKEv2.connect({
address: 'your-vpn-server.com',
username: 'your-username',
password: 'your-password',
iOSOptions: {
localizedDescription: 'My IKEv2 Connection',
disconnectOnSleep: false,
onDemandEnabled: false,
},
androidOptions: {
connectionName: 'My IKEv2 VPN',
AuthType: IKEv2.AndroidAuthType.IKEv2_EAP,
Notification: {
openActivityPackageName: 'com.yourapp.MainActivity',
titleConnected: '🔒 Secure Connection Active',
titleConnecting: '🔄 Connecting to VPN...',
showDisconnectAction: true,
},
},
});
};
// 3. Listen for connection state changes
const subscription = IKEv2.addIKev2StateChangeListener((state) => {
switch (state.state) {
case IKEv2.ConnectionState.CONNECTED:
console.log('🟢 VPN Connected Successfully!');
break;
case IKEv2.ConnectionState.DISCONNECTED:
console.log('🔴 VPN Disconnected');
break;
case IKEv2.ConnectionState.CONNECTING:
console.log('🟡 Connecting to VPN...');
break;
}
});
// 4. Disconnect when done
await IKEv2.disconnect();
subscription.remove();Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
Made with create-react-native-library
