OPTXOPTX DOCS
SDK Reference

@jettoptx/chat

502525

JettChat SDK — E2E messaging transports, channels, and integration patterns.

The @jettoptx/chat package provides encrypted messaging primitives for building JettChat-compatible clients. Source: jettoptx-sdk/packages/jettchat-sdk.

Install

npm install @jettoptx/chat

Peer dependency: @jettoptx/auth@>=0.1.0

Encryption

Messages are encrypted client-side using X25519 key exchange and NaCl SecretBox (ChaCha20-Poly1305). Phantom Mode adds a post-quantum hybrid layer — see Phantom Mode for the Secure-Legion stack. Implementation details are not documented here — integrate via the public SDK APIs.

Transports

TransportUse Case
WebSocketReal-time JOE agent chat
Federation BridgeOptional Matrix-compatible inter-agent transport
Activity StreamX Activity API SSE events

Quick Start — E2E Encryption

import {
  generateKeyPair,
  deriveSharedSecret,
  encryptMessage,
  decryptMessage,
} from "@jettoptx/chat";

const alice = generateKeyPair();
const bob = generateKeyPair();

const aliceShared = deriveSharedSecret(alice.secretKey, bob.publicKey);
const bobShared = deriveSharedSecret(bob.secretKey, alice.publicKey);

const payload = encryptMessage("hello from alice", aliceShared);
const plaintext = decryptMessage(payload, bobShared);

Channels & Identity

import { createChannel, sendMessage } from "@jettoptx/chat";

// Requires authenticated session from @jettoptx/auth
const channel = await createChannel({ name: "my-room", members: ["alice", "bob"] });
await sendMessage(channel.id, { text: "Hello OPTX" });