Reference · @hexaeight/sdk · 0.1.0-preview3

Node.js SDK Reference

The Node SDK wraps the .NET Bridge with idiomatic JavaScript/TypeScript bindings. The underlying surface is identical to the .NET Bridge API — every method is exposed in camelCase, every Task<T> becomes a Promise<T>, and every record becomes a plain object.

Platform support

PlatformStatus
Linux (Ubuntu, Debian, RHEL, etc)✓ Supported
macOS✓ Expected to work (untested)
Windows + WSL2✓ Supported — use this on Windows
Windows native✗ Not supported — see microsoft/node-api-dotnet#479
Windows users: Run the Node SDK inside WSL2. Native Windows is blocked by an upstream System.Management / hosted-CLR limitation tracked at microsoft/node-api-dotnet#479 that affects any WMI-dependent NuGet package consumed via node-api-dotnet.

.NET developers on Windows should use the .NET Bridge NuGet directly — it works on native Windows without any limitation. Only the Node-hosted path is affected.

Install

npm install @hexaeight/sdk@preview

Requires Node.js ≥ 18 and .NET 10+ on the host. The postinstall script offers to install .NET automatically.

Requires .NET 8+ on the host. The postinstall script detects and offers to install it.

Naming map

.NET BridgeNode SDK
new Client()await HexaEight.connect()
EncryptEnvelopeAsync(...)he.envelope.encrypt(...)
DecryptEnvelopeAsync(...)he.envelope.decrypt(...)
Client.InspectEnvelope(...) (static)HexaEight.inspectEnvelope(...)
FetchAskAsync(...)he.ask.fetch(...)
PinAsk(recipient, kgt, ask)he.ask.pin(recipient, kgt, ask)
PinAskForSession(sessionId, ask)he.ask.pinForSession(sessionId, ask)
UnpinAsk(recipient, kgt)he.ask.unpin(recipient, kgt)
UnpinAskForSession(sessionId)he.ask.unpinForSession(sessionId)
HasCachedAsk(recipient, kgt)he.ask.has(recipient, kgt)
HasCachedSession(sessionId)he.ask.hasSession(sessionId)
ClearAskCache()he.ask.clear()
SaveAskCacheToDiskAsync(path)he.ask.saveToDisk(path)
LoadAskCacheFromDiskAsync(path)he.ask.loadFromDisk(path)
EnableAutoPersistAsync(path, loadIfExists)he.ask.enableAutoPersist(path, { loadIfExists })
DisableAutoPersist()he.ask.disableAutoPersist()

Quick example (sessioned round-trip)

import { HexaEight } from '@hexaeight/sdk';

const alice = await HexaEight.connect();
const sessionId = crypto.randomUUID();
const kgt = currentKgt();

const ask = await alice.ask.fetch('bob.example.com', kgt);
alice.ask.pinForSession(sessionId, ask);

const env = await alice.envelope.encrypt('bob.example.com', 'hello', { sessionId });

// On Bob's side:
const bob = await HexaEight.connect();
const askB = await bob.ask.fetch('alice.example.com', kgt);
bob.ask.pinForSession(sessionId, askB);
const msg = await bob.envelope.decrypt(env);
console.log(msg.sender, msg.body);   // "alice.example.com" "hello"

See also