JOLT SDK · API REFERENCE
jolt-sdk
Every exported class, interface, function, and type of the four SDK modules, generated from the committed typedoc output. Start with the SDK overview or the app development guide.
modulejolt-sdk
jolt-sdk: the TypeScript SDK for building applications on the Jolt network.
Layers, top to bottom:
- Client (
createJoltClient): domain-shaped operations with tolerant reads. What applications program against. - Operations: one typed function per stable daemon endpoint, for the rare call the client does not wrap.
- Transports: how requests reach the daemon. Import one from
jolt-sdk/transport-httporjolt-sdk/transport-tauri, or the fake fromjolt-sdk/testing.
Quick start (browser or Node.js):
import { createJoltClient } from "jolt-sdk";
import { HttpTransport } from "jolt-sdk/transport-http";
let token = "";
const jolt = createJoltClient({
transport: new HttpTransport({ daemonUrl: "http://127.0.0.1:9862" }),
getSessionToken: () => token,
});
const request = await jolt.requestSession({
appId: "myapp.local",
appName: "My App",
appOrigin: "http://127.0.0.1:5173",
identity: (await jolt.getStatus()).identity_address,
capabilities: ["publish:/myapp/*", "resolve:public", "fetch:public"],
});
// ...poll jolt.getSessionRequestStatus(request.request_id) until it
// carries a session_token (the user approves in Jolt Console), then:
await jolt.publishJson("/myapp/hello", { hello: "world" });References
re-exportSessionRequest
Re-export of index.operations.SessionRequest.
Namespaces
namespaceoperations
Typed daemon operations over a JoltTransport.
One function per daemon endpoint the application contract declares stable. These are the lowest app-facing layer: wire DTOs in and out, no domain marshalling. Most applications should use the client from createJoltClient instead and drop to operations only for endpoints the client does not wrap (e.g. binary publish).
typeSessionRequest
type SessionRequest = { ... }What an app declares when opening a Jolt session.
| Property | Type | Description |
|---|---|---|
appId | string | |
appName | string | |
appOrigin | string | |
capabilities | readonly string[] | Requested capability strings, e.g. publish:/myapp/*. |
identity | string | The identity whose authority the session requests. |
functionacceptIngress
function acceptIngress(transport: JoltTransport, token: string, ingressId: string, options?: CallOptions): Promise<IngressRecord>Accept a pending ingress envelope.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
ingressId | string | |
options | CallOptions | optional |
functionappendPublishJson
function appendPublishJson(transport: JoltTransport, token: string, path: string, body: object, options?: CallOptions): Promise<PublishResponse>Publish a coexisting device-writer append record at path. Append records never overwrite each other, so concurrent writers are safe; read them back with enumerate, never with resolve.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
path | string | |
body | object | |
options | CallOptions | optional |
functiondecryptEncryptedTarget
function decryptEncryptedTarget(transport: JoltTransport, token: string, target: string, options?: CallOptions): Promise<DecryptedEncryptedObject>Resolve + decrypt an encrypted publication addressed to this session's identity.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
target | string | |
options | CallOptions | optional |
functionenumerate
function enumerate(transport: JoltTransport, token: string, identity: string, pathPrefix: string, options?: CallOptions): Promise<AppendRecordInfo[]>List an identity's append records under a path prefix.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
identity | string | |
pathPrefix | string | |
options | CallOptions | optional |
functionfetchTarget
function fetchTarget(transport: JoltTransport, token: string, target: string, options?: CallOptions): Promise<FetchResult>Fetch raw bytes by content id or address.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
target | string | |
options | CallOptions | optional |
functiongetCurrentSession
function getCurrentSession(transport: JoltTransport, token: string, options?: CallOptions): Promise<CurrentAppSession>The session behind a bearer token, as the daemon sees it.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
options | CallOptions | optional |
functiongetSessionRequestStatus
function getSessionRequestStatus(transport: JoltTransport, requestId: string, options?: CallOptions): Promise<AppSessionStatusResponse>Poll a session request until it carries a session_token.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
requestId | string | |
options | CallOptions | optional |
functiongetStatus
function getStatus(transport: JoltTransport, options?: CallOptions): Promise<NodeStatus>Local daemon status: identity address, peer id, connectivity.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
options | CallOptions | optional |
functionlistPendingIngress
function listPendingIngress(transport: JoltTransport, token: string, options?: CallOptions): Promise<IngressRecord[]>Pending ingress envelopes awaiting review.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
options | CallOptions | optional |
functionlistPublished
function listPublished(transport: JoltTransport, token: string, options?: CallOptions): Promise<PublishedContent[]>This node's published inventory.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
options | CallOptions | optional |
functionopenIngress
function openIngress(transport: JoltTransport, token: string, ingressId: string, options?: CallOptions): Promise<DecryptedIngress>Decrypt a pending ingress envelope without deciding it.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
ingressId | string | |
options | CallOptions | optional |
functionpublishBytes
function publishBytes(transport: JoltTransport, token: string, path: string, bytes: Uint8Array<ArrayBufferLike>, meta: { fileName: string; mimeType: string }, options?: CallOptions): Promise<PublishResponse>Publish raw bytes (images, media) at a signed path.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
path | string | |
bytes | Uint8Array<ArrayBufferLike> | |
meta | { fileName: string; mimeType: string } | |
options | CallOptions | optional |
functionpublishEncryptedBytes
function publishEncryptedBytes(transport: JoltTransport, token: string, path: string, plaintext: Uint8Array<ArrayBufferLike>, meta: { mimeType: string; recipients: string[] }, options?: CallOptions): Promise<EncryptedPublishResponse>Publish raw bytes encrypted to recipients.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
path | string | |
plaintext | Uint8Array<ArrayBufferLike> | |
meta | { mimeType: string; recipients: string[] } | |
options | CallOptions | optional |
functionpublishEncryptedJson
function publishEncryptedJson(transport: JoltTransport, token: string, path: string, body: object, recipients: string[], options?: CallOptions): Promise<EncryptedPublishResponse>Publish a JSON object encrypted to recipients (identity addresses).
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
path | string | |
body | object | |
recipients | string[] | |
options | CallOptions | optional |
functionpublishJson
function publishJson(transport: JoltTransport, token: string, path: string, body: object, options?: CallOptions): Promise<PublishResponse>Publish a JSON object at a signed path (last-writer-wins update log).
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
path | string | |
body | object | |
options | CallOptions | optional |
functionrejectIngress
function rejectIngress(transport: JoltTransport, token: string, ingressId: string, options?: CallOptions): Promise<IngressRecord>Reject a pending ingress envelope.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
ingressId | string | |
options | CallOptions | optional |
functionrequestSession
function requestSession(transport: JoltTransport, req: SessionRequest, options?: CallOptions): Promise<AppSessionRequestResponse>Ask the daemon for a scoped session. The user approves it in Jolt Console.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
req | SessionRequest | |
options | CallOptions | optional |
functionresolveAddress
function resolveAddress(transport: JoltTransport, token: string, address: string, options?: CallOptions): Promise<ResolveResponse>Resolve a .jolt address (identity + path) to its current content id.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
address | string | |
options | CallOptions | optional |
functionsendIngress
function sendIngress(transport: JoltTransport, token: string, req: { encryptedObject: number[]; expiresAt?: number; recipient: string }, options?: CallOptions): Promise<IngressRecord>Deliver an already-encrypted object to a recipient's daemon (/app/v1/ingress/send). Most apps should use the client's sendObject, which also publishes the sender's own encrypted copy.
| Parameter | Type | Notes |
|---|---|---|
transport | JoltTransport | |
token | string | |
req | { encryptedObject: number[]; expiresAt?: number; recipient: string } | |
options | CallOptions | optional |
Classes
classJoltApiError
The daemon (or its dev proxy) answered with a non-success status.
The daemon's JSON error body, when present, is preserved on body and its error field becomes the message.
new JoltApiError
new JoltApiError(message: string, options?: { body?: unknown; code?: string; status?: number }): JoltApiError| Parameter | Type | Notes |
|---|---|---|
message | string | |
options | { body?: unknown; code?: string; status?: number } | defaults to {} |
| Property | Type | Description |
|---|---|---|
readonly body? | unknown | The raw parsed error body, for callers that need more than the message. |
| Property | Type | Description |
|---|---|---|
cause? | unknown |
| Property | Type | Description |
|---|---|---|
readonly code? | string | Machine-readable error code from the daemon body (e.g. app_session_unauthorized), when present. |
| Property | Type | Description |
|---|---|---|
message | string |
| Property | Type | Description |
|---|---|---|
name | string |
| Property | Type | Description |
|---|---|---|
stack? | string |
| Property | Type | Description |
|---|---|---|
readonly status? | number | HTTP status code of the response, when the transport had one. |
classJoltTransportError
The daemon could not be reached at all: connection refused, DNS failure, aborted request, or timeout. The cause carries the underlying error.
new JoltTransportError
new JoltTransportError(message: string, options?: { cause?: unknown }): JoltTransportError| Parameter | Type | Notes |
|---|---|---|
message | string | |
options | { cause?: unknown } | defaults to {} |
| Property | Type | Description |
|---|---|---|
cause? | unknown |
| Property | Type | Description |
|---|---|---|
message | string |
| Property | Type | Description |
|---|---|---|
name | string |
| Property | Type | Description |
|---|---|---|
stack? | string |
Interfaces
interfaceJoltAppendSdk
Coexisting append records and their enumeration.
enumerate
enumerate(identity: string, pathPrefix: string, options?: CallOptions): Promise<EnumeratedRecord[]>List an identity's append records under a path prefix.
| Parameter | Type | Notes |
|---|---|---|
identity | string | |
pathPrefix | string | |
options | CallOptions | optional |
publishAppend
publishAppend(path: string, body: object, options?: CallOptions): Promise<PublishResult>Publish a coexisting device-writer append record at path.
| Parameter | Type | Notes |
|---|---|---|
path | string | |
body | object | |
options | CallOptions | optional |
interfaceJoltEncryptedSdk
Encrypted publish and tolerant encrypted reads.
listPublished
listPublished(options?: CallOptions): Promise<PublishedContent[]>The local node's published inventory.
| Parameter | Type | Notes |
|---|---|---|
options | CallOptions | optional |
publishEncryptedJson
publishEncryptedJson(path: string, body: object, recipients: string[], options?: CallOptions): Promise<PublishResult>Publish a JSON body encrypted to recipients (identity addresses). Use [self] for an encrypt-to-self publication; the publisher can always decrypt its own publications, so readEncrypted reads them back.
| Parameter | Type | Notes |
|---|---|---|
path | string | |
body | object | |
recipients | string[] | |
options | CallOptions | optional |
readEncrypted
readEncrypted<T>(ref: Reference, decode: Decoder<T>, options?: CallOptions): Promise<null | Versioned<T>>Resolve + decrypt + parse + decode; null on any failing step.
| Parameter | Type | Notes |
|---|---|---|
ref | Reference | |
decode | Decoder<T> | |
options | CallOptions | optional |
interfaceJoltIngressSdk
The recipient-controlled ingress door: deliver identified objects to another identity's daemon and review what arrives at yours. Transport-level vocabulary only; classifying payloads is the app's job.
acceptIngress
acceptIngress(ingressId: string, options?: CallOptions): Promise<void>| Parameter | Type | Notes |
|---|---|---|
ingressId | string | |
options | CallOptions | optional |
listPendingIngress
listPendingIngress(options?: CallOptions): Promise<IngressRecord[]>| Parameter | Type | Notes |
|---|---|---|
options | CallOptions | optional |
openIngress
openIngress(ingressId: string, options?: CallOptions): Promise<unknown>Decrypt a pending envelope and return its parsed JSON, or null.
| Parameter | Type | Notes |
|---|---|---|
ingressId | string | |
options | CallOptions | optional |
rejectIngress
rejectIngress(ingressId: string, options?: CallOptions): Promise<void>| Parameter | Type | Notes |
|---|---|---|
ingressId | string | |
options | CallOptions | optional |
sendObject
sendObject(recipient: string, path: string, body: object, options?: CallOptions): Promise<PublishResult>Encrypt-publish the object at path (the sender's own copy) and deliver it to recipient's daemon. Returns the publish result so the sender can version its own copy.
| Parameter | Type | Notes |
|---|---|---|
recipient | string | |
path | string | |
body | object | |
options | CallOptions | optional |
interfaceJoltSdk
Public publish and tolerant versioned reads.
publishJson
publishJson(path: string, body: object, options?: CallOptions): Promise<PublishResult>Publish a JSON object at a signed path (last-writer-wins).
| Parameter | Type | Notes |
|---|---|---|
path | string | |
body | object | |
options | CallOptions | optional |
read
read<T>(ref: Reference, decode: Decoder<T>, options?: CallOptions): Promise<null | Versioned<T>>Resolve, fetch, parse, and decode a publication. Returns null when the reference is missing/unreachable or the bytes do not decode to T.
| Parameter | Type | Notes |
|---|---|---|
ref | Reference | |
decode | Decoder<T> | |
options | CallOptions | optional |
readContent
readContent<T>(contentId: string, ref: Reference, latestSequence: number, decode: Decoder<T>, options?: CallOptions): Promise<null | Versioned<T>>Fetch a known content id (from an enumerated append record), then parse and decode it against the supplied logical reference.
| Parameter | Type | Notes |
|---|---|---|
contentId | string | |
ref | Reference | |
latestSequence | number | |
decode | Decoder<T> | |
options | CallOptions | optional |
interfaceJoltSessionSdk
Session bootstrap and daemon status, bound to the client's transport.
getCurrentSession
getCurrentSession(options?: CallOptions): Promise<CurrentAppSession>The session behind the current token, as the daemon sees it.
| Parameter | Type | Notes |
|---|---|---|
options | CallOptions | optional |
getSessionRequestStatus
getSessionRequestStatus(requestId: string, options?: CallOptions): Promise<AppSessionStatusResponse>Poll a session request until it carries a token.
| Parameter | Type | Notes |
|---|---|---|
requestId | string | |
options | CallOptions | optional |
getStatus
getStatus(options?: CallOptions): Promise<NodeStatus>Local daemon status (no session required).
| Parameter | Type | Notes |
|---|---|---|
options | CallOptions | optional |
requestSession
requestSession(req: SessionRequest, options?: CallOptions): Promise<AppSessionRequestResponse>Ask the daemon for a scoped session; the user approves it in Console.
| Parameter | Type | Notes |
|---|---|---|
req | SessionRequest | |
options | CallOptions | optional |
interfaceJoltTransport
The single interface a transport implements.
Implementations must throw JoltApiError for non-success daemon responses and JoltTransportError for network-level failures, so application error handling is uniform across runtimes.
request
request<T>(base: ApiBase, path: string, req?: TransportRequest): Promise<T>Send a JSON request to base + path and parse the JSON response.
| Parameter | Type | Notes |
|---|---|---|
base | ApiBase | |
path | string | |
req | TransportRequest | optional |
upload
upload<T>(base: ApiBase, path: string, req: TransportUpload): Promise<T>Send a multipart file upload to base + path and parse the JSON response.
| Parameter | Type | Notes |
|---|---|---|
base | ApiBase | |
path | string | |
req | TransportUpload |
Type Aliases
typeApiBase
type ApiBase = "app" | "daemon"Which daemon API surface a request targets.
typeAppendRecordInfo
type AppendRecordInfo = { ... }One device-writer append record as enumeration returns it (/app/v1/enumerate).
| Property | Type | Description |
|---|---|---|
content_id | string | |
created_at | string | |
device_id | string | |
device_sequence | number | |
entry_hash | string | |
path | string |
typeAppSessionRequestResponse
type AppSessionRequestResponse = { ... }Response to a session request (/app/v1/sessions/request).
| Property | Type | Description |
|---|---|---|
request_id | string | |
status | AppSessionStatus |
typeAppSessionStatus
type AppSessionStatus = "pending" | "active" | "rejected" | "revoked" | "expired"Lifecycle states of an app session.
typeAppSessionStatusResponse
type AppSessionStatusResponse = { ... }Polled session request status (/app/v1/sessions/{request_id}).
| Property | Type | Description |
|---|---|---|
capabilities | string[] | |
expires_at? | number | null | |
identity? | string | null | |
request_id | string | |
session_id? | string | null | |
session_token? | string | null | |
status | AppSessionStatus |
typeCallOptions
type CallOptions = { ... }Options accepted by every SDK operation.
signal aborts the request; timeoutMs fails it with a JoltTransportError after the given time. Both may be combined.
| Property | Type | Description |
|---|---|---|
signal? | AbortSignal | |
timeoutMs? | number |
typeCurrentAppSession
type CurrentAppSession = { ... }The current session, as seen by the daemon (/app/v1/session).
| Property | Type | Description |
|---|---|---|
app_id | string | |
app_name | string | |
expires_at? | number | null | |
granted_capabilities | string[] | |
identity? | string | null | |
last_used_at? | number | null | |
request_id | string | |
session_id? | string | null | |
status | AppSessionStatus |
typeDecoder
type Decoder<T> = (value: unknown) => T | nullA decoder is the app's schema-level reader: it validates an already-parsed JSON value into a canonical type, or returns null to reject it. Decoders never see bytes or transport concerns.
typeDecryptedEncryptedObject
type DecryptedEncryptedObject = { ... }Decrypted encrypted publication (/app/v1/encrypted/decrypt).
| Property | Type | Description |
|---|---|---|
content_id | string | |
content_type | string | |
path | string | |
plaintext | number[] | |
size | number |
typeDecryptedIngress
type DecryptedIngress = { ... }Decrypted ingress payload (/app/v1/ingress/{id}/open).
| Property | Type | Description |
|---|---|---|
content_type | string | |
plaintext | number[] | |
size | number |
typeEncryptedPublishResponse
type EncryptedPublishResponse = PublishResponse & { ... }Result of an encrypted publish (/app/v1/encrypted/publish).
| Property | Type | Description |
|---|---|---|
recipient_count | number |
typeEnumeratedRecord
type EnumeratedRecord = { ... }One append record, marshalled into domain shape.
| Property | Type | Description |
|---|---|---|
contentId | string | |
createdAt | string | |
deviceId | string | |
deviceSequence | number | |
entryHash | string | |
identity | string | |
path | string |
typeFetchResult
type FetchResult = { ... }Raw bytes fetched by content id (/app/v1/fetch).
| Property | Type | Description |
|---|---|---|
content_id | string | |
data | number[] | |
size | number |
typeIngressRecord
type IngressRecord = { ... }One recipient-controlled ingress envelope awaiting (or past) review.
| Property | Type | Description |
|---|---|---|
accepted_at? | number | null | |
expires_at? | number | null | |
ingress_id | string | |
received_at | number | |
receiver_id | string | |
recipient_identity | string | |
rejected_at? | number | null | |
schema_hint? | string | null | |
sender_identity | string | |
size | number | |
status | "pending" | "accepted" | "rejected" |
typeJoltClient
type JoltClient = JoltSdk & JoltAppendSdk & JoltEncryptedSdk & JoltIngressSdk & JoltSessionSdk & { ... }Everything a typical Jolt application needs, in one object.
| Property | Type | Description |
|---|---|---|
readonly transport | JoltTransport | The transport backing this client, for operations the client does not wrap. |
typeJoltClientOptions
type JoltClientOptions = { ... }Configuration for createJoltClient.
| Property | Type | Description |
|---|---|---|
getSessionToken | () => string | Where the client finds the current session token. Called per request so token rotation needs no client rebuild. |
transport | JoltTransport |
typeNodeStatus
type NodeStatus = { ... }/api/v1/status: the local daemon's identity and connectivity summary.
| Property | Type | Description |
|---|---|---|
connected_peers | number | |
daemon_version? | string | |
identity_address | string | |
peer_id | string | |
uptime_secs | number |
typePublishedContent
type PublishedContent = { ... }One locally published item (/app/v1/published).
| Property | Type | Description |
|---|---|---|
address? | string | null | |
content_id | string | |
local_sequence? | number | null | |
path? | string | null | |
pin_state | string | |
size | number |
typePublishResponse
type PublishResponse = { ... }Result of a public publish (/app/v1/publish).
| Property | Type | Description |
|---|---|---|
address? | string | null | |
content_id | string | |
latest_sequence? | number | null | |
path? | string | null | |
size | number |
typePublishResult
type PublishResult = { ... }Result of any publish, in domain (camelCase) shape.
| Property | Type | Description |
|---|---|---|
address | string | null | |
contentId | string | |
latestSequence | number | |
path | string |
typeReference
type Reference = { ... }The stable identity of a publication: (identity, path).
| Property | Type | Description |
|---|---|---|
identity | string | |
path | string |
typeResolveResponse
type ResolveResponse = { ... }Result of resolving a .jolt address (/app/v1/resolve).
| Property | Type | Description |
|---|---|---|
address | string | |
content_id | string | |
identity | string | |
latest_sequence | number | |
path | string | |
reachability_hints | unknown[] | |
source | string |
typeTransportRequest
type TransportRequest = CallOptions & { ... }A JSON (or empty-body) request.
| Property | Type | Description |
|---|---|---|
json? | unknown | JSON body; omitted for GET. |
method? | "GET" | "POST" | "DELETE" | |
token? | string | null | Bearer session token, when the endpoint needs one. |
typeTransportUpload
type TransportUpload = CallOptions & { ... }A multipart upload request (public publish and append).
| Property | Type | Description |
|---|---|---|
bytes | Uint8Array | |
fileName | string | |
mimeType | string | |
path | string | The logical Jolt path form field. |
token | string |
typeVersioned
type Versioned<T> = { ... }A versioned, decoded publication: what a read hands back to the app.
| Property | Type | Description |
|---|---|---|
contentId | string | |
latestSequence | number | |
ref | Reference | |
value | T |
Functions
functionapiErrorMessage
function apiErrorMessage(error: unknown): stringMap any error thrown by the SDK to a short human-readable message suitable for an app's error banner. Never throws.
| Parameter | Type | Notes |
|---|---|---|
error | unknown |
functioncreateJoltClient
function createJoltClient(options: JoltClientOptions): JoltClientBuild a JoltClient over a transport and a session-token source.
| Parameter | Type | Notes |
|---|---|---|
options | JoltClientOptions |
functionmakeId
function makeId(prefix: string): stringGenerate a collision-resistant id with an app-chosen prefix.
| Parameter | Type | Notes |
|---|---|---|
prefix | string |
modulejolt-sdk/transport-http
HTTP transport: reach a Jolt daemon over fetch.
Works in browsers and Node.js 18+. Point it at the daemon directly (new HttpTransport({ daemonUrl: "http://127.0.0.1:9862" })) or, for browser dev servers that proxy the daemon to dodge CORS, at proxy base paths (HttpTransport.viteProxy() uses /jolt-api and /jolt-daemon, the convention Spoke's vite config established).
Classes
classHttpTransport
class HttpTransport implements JoltTransportThe fetch-based transport: reaches the daemon directly by URL, or through dev-server proxy paths via HttpTransport.viteProxy.
new HttpTransport
new HttpTransport(options?: HttpTransportOptions): HttpTransport| Parameter | Type | Notes |
|---|---|---|
options | HttpTransportOptions | defaults to {} |
request
request<T>(base: ApiBase, path: string, req?: TransportRequest): Promise<T>Send a JSON request to base + path and parse the JSON response.
| Parameter | Type | Notes |
|---|---|---|
base | ApiBase | |
path | string | |
req | TransportRequest | defaults to {} |
upload
upload<T>(base: ApiBase, path: string, req: TransportUpload): Promise<T>Send a multipart file upload to base + path and parse the JSON response.
| Parameter | Type | Notes |
|---|---|---|
base | ApiBase | |
path | string | |
req | TransportUpload |
viteProxy
static viteProxy(options?: Omit<HttpTransportOptions, "bases" | "daemonUrl">): HttpTransportThe browser dev-server preset: requests go to the /jolt-api (app API) and /jolt-daemon (daemon API) proxy paths on the current origin.
| Parameter | Type | Notes |
|---|---|---|
options | Omit<HttpTransportOptions, "bases" | "daemonUrl"> | defaults to {} |
Type Aliases
typeHttpTransportOptions
type HttpTransportOptions = { ... }Configuration for HttpTransport.
| Property | Type | Description |
|---|---|---|
bases? | { app: string; daemon: string } | Explicit base paths/URLs per API surface, overriding daemonUrl. Useful behind dev-server proxies. |
daemonUrl? | string | Base URL of the daemon, e.g. http://127.0.0.1:9862. The transport derives /app/v1 and /api/v1 from it. |
defaultTimeoutMs? | number | Default timeout applied when a call passes none. |
modulejolt-sdk/transport-tauri
Tauri transport: reach the Jolt daemon through a desktop shell's Rust commands instead of direct HTTP, so the webview never needs network access to the daemon.
The host application must expose these Tauri commands (the contract Spoke established):
#[tauri::command]
async fn daemon_request(base_path: String, path: String, method: String,
body: Option<Value>, session_token: Option<String>)
-> Result<Value, String>;
#[tauri::command]
async fn daemon_publish_bytes(session_token: String, path: String,
bytes: Vec<u8>, file_name: String,
mime_type: String) -> Result<Value, String>;
#[tauri::command]
async fn daemon_append(session_token: String, path: String, bytes: Vec<u8>,
file_name: String, mime_type: String)
-> Result<Value, String>;See the app development guide for the full Rust implementation to copy.
Classes
classTauriTransport
class TauriTransport implements JoltTransportThe Tauri transport: routes every request through the host shell's Rust commands (tauri-plugin-jolt in plugin mode, or app-defined commands).
new TauriTransport
new TauriTransport(options?: TauriTransportOptions): TauriTransport| Parameter | Type | Notes |
|---|---|---|
options | TauriTransportOptions | defaults to {} |
request
request<T>(base: ApiBase, path: string, req?: TransportRequest): Promise<T>Send a JSON request to base + path and parse the JSON response.
| Parameter | Type | Notes |
|---|---|---|
base | ApiBase | |
path | string | |
req | TransportRequest | defaults to {} |
upload
upload<T>(base: ApiBase, path: string, req: TransportUpload): Promise<T>Send a multipart file upload to base + path and parse the JSON response.
| Parameter | Type | Notes |
|---|---|---|
base | ApiBase | |
path | string | |
req | TransportUpload |
Type Aliases
typeTauriTransportOptions
type TauriTransportOptions = { ... }Configuration for TauriTransport.
| Property | Type | Description |
|---|---|---|
plugin? | boolean | Invoke the commands provided by the tauri-plugin-jolt Rust plugin (plugin:jolt|daemon_request etc.) instead of app-defined commands. Recommended: add tauri_plugin_jolt::init() to your Tauri builder and the jolt:default capability, and no hand-written Rust proxy is needed. |
Functions
functionisTauriRuntime
function isTauriRuntime(): booleanTrue when running inside a Tauri webview. Use this to choose between TauriTransport and an HTTP transport in apps that also run in a plain browser during development.
modulejolt-sdk/testing
Deterministic in-memory fakes for testing Jolt applications.
createFakeJolt returns a fully working JoltClient implementation with no daemon and no network: publishes land in an in-memory store keyed by path, reads resolve against it, ingress sends are recorded, and incoming envelopes can be injected. Encryption is simulated (recipients are recorded, plaintext is stored), which is exactly what app-level tests need: they test their own schemas and flows, not HPKE.
References
re-exportreferenceKey
Re-export of index.referenceKey.
Type Aliases
typeFakeJolt
type FakeJolt = { ... }Handle returned by createFakeJolt.
| Property | Type | Description |
|---|---|---|
client | JoltClient | The fake client; pass it anywhere a JoltClient (or any of its sub-interfaces) is expected. |
encryptedRecipients | Map<string, string[]> | Every encrypted publish's recipients, keyed by path. |
identity | string | The local identity the fake publishes under. |
sent | RecordedSend[] | Every object sent with sendObject, in order. |
deliverIngress | (input: { body: unknown; schemaHint?: string; sender: string }) => IngressRecord | Inject a pending ingress envelope, as if a remote sender delivered it. Returns the created record so tests can accept/reject/open it. |
typeRecordedSend
type RecordedSend = { ... }An ingress send recorded by the fake.
| Property | Type | Description |
|---|---|---|
body | unknown | |
path | string | |
recipient | string |
Functions
functioncreateFakeJolt
function createFakeJolt(identity: string): FakeJoltCreate an in-memory fake Jolt for one identity.
const { client, deliverIngress, sent } = createFakeJolt("alice.jolt");
await client.publishJson("/myapp/profile", { name: "Alice" });
const got = await client.read(
{ identity: "alice.jolt", path: "/myapp/profile" },
(v) => v as { name: string }
);| Parameter | Type | Notes |
|---|---|---|
identity | string |