hxtp-js
v1.1.0
Published
HxTP/3.0 client SDK — HMAC-SHA256 signed protocol for IoT device communication. Browser, Node.js, Bun, Deno, React Native.
Maintainers
Readme
hxtp-js
HxTP/3.1JavaScript/TypeScript Client SDK — A high-performance implementation of the Ed25519-signed IoT protocol. Designed for speed, security, and zero runtime dependencies.
Key Features
- Lightweight: Zero runtime dependencies. Tree-shakeable ESM build.
- HxTP/3.1 Core: Pipe-separated framing with mandatory backslash escaping and NFC normalization.
- Native MQTT: High-performance transport support via
MQTTTransport. - Universal: Works in Browser, Node.js 18+, Bun, Deno, and React Native.
- Anti-Replay: Integrated nonce generation and monotonic sequence enforcement.
- Pluggable: Customizable transport (MQTT/REST/WS) and crypto providers.
Installation
# bun (recommended)
bun add hxtp-js
# npm
npm install hxtp-js⏱ Quick Start
Native MQTT Command Execution
import { Client } from "hxtp-js";
import { MQTTTransport } from "hxtp-js/transport/mqtt";
import { NodeCryptoProvider } from "hxtp-js/crypto/node";
const client = new Client({
url: "https://api.hestialabs.in/api/v1",
tenantId: "your-tenant-uuid",
deviceId: "your-device-uuid",
clientId: "unique-client-id",
signingKey: "64-char-hex-private-key",
crypto: new NodeCryptoProvider()
});
// Use native MQTT for sub-millisecond dispatch
const mqtt = new MQTTTransport({ url: "tcp://broker.hestialabs.in:1883" });
client.setTransport(mqtt);
await mqtt.connect();
// Send a signed command via MQTT
const response = await client.sendCommand("light-1", "toggle", { power: true });
console.log(" Command Sent:", response.messageId);Architecture
The SDK is built with a strictly modular architecture to support diverse environments.
hxtp-js
├── core/ Protocol-agnostic core logic
│ ├── canonical HxTP/3.1 Pipe-separated builder
│ ├── signing Ed25519 signature engine
│ ├── validation 7-step protocol validation pipeline
│ ├── envelope Signed message envelope builder
│ └── nonce Replay protection & nonce management
├── crypto/ Environment-aware crypto providers
│ ├── node Node.js native (node:crypto)
│ └── web Web Crypto API (Browser/RN/Deno)
└── transport/ Pluggable transport layer
├── mqtt Native MQTT transport
└── websocket Secure WebSocket implementationProtocol Alignment: HxTP/3.1
This SDK implements HxTP/3.1 with bit-perfect parityto the Go, Python, and Embedded SDKs.
| Component | Status | Details |
| :--- | :--- | :--- |
| Framing| | Pipe-separated (\|) with mandatory backslash escaping. |
| Normalization| | Mandatory Unicode NFCnormalization for all fields. |
| Numbers| | Deterministic decimal strings (up to 20 places). |
| Compliance| | Verified against the cross-language compliance suite. |
License
This project is licensed under the MIT License. See LICENSE for details.
Copyright © 2026 Hestia Labs run test # Run Vitest suite
---
## License
This project is licensed under the **MIT License**. See [LICENSE](LICENSE) for details.
Copyright © 2026 **Hestia Labs**