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

kard-network-ble-mesh

v1.1.5

Published

Kard Network BLE Mesh networking library for React Native with seamless permissions

Readme

kard-network-ble-mesh

A React Native library for BLE (Bluetooth Low Energy) mesh networking. Build decentralized, peer-to-peer messaging apps that work without internet connectivity.

Features

  • Cross-platform: Works on both iOS and Android
  • Mesh networking: Messages automatically relay through peers
  • End-to-end encryption: Noise protocol for secure private messages
  • Seamless permissions: Handles permission requests automatically
  • Message deduplication: Built-in deduplication prevents duplicate messages
  • Peer discovery: Automatic discovery of nearby devices

Installation

npm install kard-network-ble-mesh
# or
yarn add kard-network-ble-mesh

iOS

cd ios && pod install

Add the following to your Info.plist:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>This app uses Bluetooth to communicate with nearby devices</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>This app uses Bluetooth to communicate with nearby devices</string>
<key>UIBackgroundModes</key>
<array>
  <string>bluetooth-central</string>
  <string>bluetooth-peripheral</string>
</array>

Android

Add the following permissions to your AndroidManifest.xml (they are already included in the library manifest):

<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />

Usage

import { BleMesh } from 'kard-network-ble-mesh';

// Start the mesh service (automatically requests permissions)
await BleMesh.start({ nickname: 'Alice' });

// Listen for events
BleMesh.onPeerListUpdated(({ peers }) => {
  console.log('Connected peers:', peers);
});

BleMesh.onMessageReceived(({ message }) => {
  console.log('Received message:', message);
});

// Send a public broadcast message
await BleMesh.sendMessage('Hello everyone!');

// Send a private encrypted message
await BleMesh.sendPrivateMessage('Secret message', recipientPeerId);

// Get current peers
const peers = await BleMesh.getPeers();

// Stop the service
await BleMesh.stop();

API Reference

BleMesh

The main singleton instance for interacting with the BLE mesh.

Methods

start(config?: MeshServiceConfig): Promise<void>

Starts the mesh service. Automatically requests required permissions.

interface MeshServiceConfig {
  nickname?: string;              // Default: 'anon'
  autoRequestPermissions?: boolean; // Default: true
}
stop(): Promise<void>

Stops the mesh service and disconnects from all peers.

setNickname(nickname: string): Promise<void>

Updates your nickname and broadcasts the change to peers.

getMyPeerId(): Promise<string>

Returns your unique peer ID (derived from your public key fingerprint).

getMyNickname(): Promise<string>

Returns your current nickname.

getPeers(): Promise<Peer[]>

Returns an array of all discovered peers.

interface Peer {
  peerId: string;
  nickname: string;
  isConnected: boolean;
  rssi?: number;
  lastSeen: number;
  isVerified: boolean;
}
sendMessage(content: string, channel?: string): Promise<string>

Sends a public broadcast message. Returns the message ID.

sendPrivateMessage(content: string, recipientPeerId: string): Promise<string>

Sends an encrypted private message to a specific peer. Returns the message ID.

sendReadReceipt(messageId: string, recipientPeerId: string): Promise<void>

Sends a read receipt for a received message.

hasEncryptedSession(peerId: string): Promise<boolean>

Checks if an encrypted session exists with the specified peer.

initiateHandshake(peerId: string): Promise<void>

Initiates a Noise handshake with a peer for encrypted communication.

getIdentityFingerprint(): Promise<string>

Returns your identity fingerprint for verification.

getPeerFingerprint(peerId: string): Promise<string | null>

Returns a peer's identity fingerprint for verification.

broadcastAnnounce(): Promise<void>

Forces a broadcast announce to refresh your presence on the mesh.

Events

onPeerListUpdated(callback): () => void

Called when the peer list changes.

BleMesh.onPeerListUpdated(({ peers }) => {
  console.log('Peers updated:', peers);
});
onMessageReceived(callback): () => void

Called when a message is received.

BleMesh.onMessageReceived(({ message }) => {
  console.log('Message from', message.senderNickname, ':', message.content);
});
onConnectionStateChanged(callback): () => void

Called when the connection state changes.

onReadReceipt(callback): () => void

Called when a read receipt is received.

onDeliveryAck(callback): () => void

Called when a delivery acknowledgment is received.

onError(callback): () => void

Called when an error occurs.

Protocol Compatibility

This library uses the same binary protocol as:

Messages can be exchanged between all three platforms.

License

MIT