npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

erebrus-react-native-sdk

v1.0.12

Published

React Native SDK for Erebrus VPN

Downloads

43

Readme

erebrus-react-native-sdk

React Native SDK for implementing Erebrus dVPN in Android and iOS apps

Installation

npm install erebrus-react-native-sdk
# or
yarn add erebrus-react-native-sdk

Features

  • VPN connection management
  • Client creation and configuration
  • QR code generation for WireGuard configuration
  • Status monitoring
  • Customizable UI components
  • TypeScript support
  • Authentication flow with organization management

Usage

Basic Setup

Wrap your app with the VPNProvider:

import { VPNProvider } from 'erebrus-react-native-sdk';

const App = () => {
  return (
    <VPNProvider>
      <YourApp />
    </VPNProvider>
  );
};

Authentication

The SDK includes an authentication flow that handles organization creation and token generation:

import { Auth } from 'erebrus-react-native-sdk';

const Authentication = () => {
  const handleTokenReceived = (token: string) => {
    // Store the token and proceed with VPN setup
    console.log('Token received:', token);
  };

  return <Auth onTokenReceived={handleTokenReceived} />;
};

The Auth component provides:

  • Organization creation
  • API key management
  • Token generation
  • Automatic token refresh

Using the Connection Button

import { ConnectionButton, useVPN } from 'erebrus-react-native-sdk';

const VPNConnection = () => {
  const { vpnStatus, isConnecting, isDisconnecting, connectVPN, disconnectVPN } = useVPN();

  return (
    <ConnectionButton
      isConnected={vpnStatus?.isConnected || false}
      isConnecting={isConnecting}
      isDisconnecting={isDisconnecting}
      onConnect={connectVPN}
      onDisconnect={disconnectVPN}
      theme={customTheme} // Optional theme customization
    />
  );
};

Creating a New VPN Client

import { ClientCreator } from 'erebrus-react-native-sdk';

const CreateClient = () => {
  const handleClientCreated = ({ configFile, vpnConfig }) => {
    console.log('Client created:', configFile);
    // The configFile can be used to generate a QR code
    // The vpnConfig can be used to connect to the VPN
  };

  return (
    <ClientCreator
      apiConfig={{
        token: 'your-api-token', // Token received from Auth component
        gatewayUrl: 'https://gateway.erebrus.io/',
      }}
      onClientCreated={handleClientCreated}
      theme={customTheme} // Optional theme customization
    />
  );
};

Displaying VPN Status

import { StatusCard, useVPN } from 'erebrus-react-native-sdk';

const VPNStatus = () => {
  const { vpnStatus } = useVPN();

  return (
    <StatusCard 
      vpnStatus={vpnStatus} 
      theme={customTheme} // Optional theme customization
    />
  );
};

Complete Example

Here's a complete example showing how to use all components together:

import { 
  VPNProvider, 
  Auth, 
  StatusCard, 
  ConnectionButton, 
  ClientCreator,
  useVPN 
} from 'erebrus-react-native-sdk';

const VPNScreen = () => {
  const { vpnStatus, isConnecting, isDisconnecting, connectVPN, disconnectVPN } = useVPN();
  const [token, setToken] = useState("");
  const [showCreateModal, setShowCreateModal] = useState(false);
  const [showQrCodeModal, setShowQrCodeModal] = useState(false);
  const [configFile, setConfigFile] = useState("");

  const handleClientCreated = ({ configFile, vpnConfig }) => {
    setConfigFile(configFile);
    setShowQrCodeModal(true);
    setShowCreateModal(false);
  };

  return (
    <SafeAreaView style={styles.container}>
      {/* Authentication Section */}
      <Auth onTokenReceived={setToken} />

      {/* VPN Status Section */}
      <StatusCard vpnStatus={vpnStatus} />

      {/* Connection Controls */}
      <ConnectionButton
        isConnected={vpnStatus?.isConnected || false}
        isConnecting={isConnecting}
        isDisconnecting={isDisconnecting}
        onConnect={connectVPN}
        onDisconnect={disconnectVPN}
      />

      {/* Create Client Button */}
      <TouchableOpacity onPress={() => setShowCreateModal(true)}>
        <Text>Create New Client</Text>
      </TouchableOpacity>

      {/* Create Client Modal */}
      {showCreateModal && (
        <Modal>
          <ClientCreator
            apiConfig={{
              token,
              gatewayUrl: 'https://gateway.erebrus.io/',
            }}
            onClientCreated={handleClientCreated}
          />
        </Modal>
      )}

      {/* QR Code Modal */}
      {showQrCodeModal && configFile && (
        <Modal>
          <QRCode value={configFile} size={200} />
        </Modal>
      )}
    </SafeAreaView>
  );
};

const App = () => (
  <VPNProvider>
    <VPNScreen />
  </VPNProvider>
);

Customizing the Theme

All components accept a theme prop for customization:

const customTheme = {
  background: '#1a1a1a',
  surface: '#2a2a2a',
  primary: '#6366f1',
  success: '#10b981',
  error: '#ef4444',
  warning: '#f59e0b',
  text: '#ffffff',
  textSecondary: '#a1a1aa',
  border: '#374151',
};

<ConnectionButton
  theme={customTheme}
  // ... other props
/>

API Reference

VPNProvider

The main provider component that manages VPN state and functionality.

Props

  • children: React nodes to be wrapped by the provider

Auth

The authentication component that handles organization creation and token generation.

Props

  • onTokenReceived: Callback function that receives the generated token
  • theme: Optional theme object for customization

useVPN Hook

A hook that provides access to VPN functionality.

Returns

  • vpnStatus: Current VPN status
  • isConnecting: Whether the VPN is currently connecting
  • isDisconnecting: Whether the VPN is currently disconnecting
  • isInitialized: Whether the VPN module is initialized
  • connectVPN: Function to connect to VPN
  • disconnectVPN: Function to disconnect from VPN
  • updateStatus: Function to update VPN status

ConnectionButton

A customizable button component for VPN connection control.

Props

  • isConnected: Whether the VPN is connected
  • isConnecting: Whether the VPN is connecting
  • isDisconnecting: Whether the VPN is disconnecting
  • onConnect: Function to call when connecting
  • onDisconnect: Function to call when disconnecting
  • theme: Optional theme object for customization

ClientCreator

A component for creating new VPN clients.

Props

  • apiConfig: Configuration for the API
    • token: API token (received from Auth component)
    • gatewayUrl: API gateway URL
  • onClientCreated: Callback when a client is created
    • Receives { configFile, vpnConfig } object
    • configFile: String containing the WireGuard configuration
    • vpnConfig: Object containing the VPN configuration for connection
  • theme: Optional theme object for customization

StatusCard

A component for displaying VPN status information.

Props

  • vpnStatus: Current VPN status
  • theme: Optional theme object for customization

Types

The SDK includes TypeScript types for all components and functions:

  • VPNConfig
  • Node
  • Region
  • Theme
  • WireGuardStatus

License

MIT