Skip to main content

streamClient

Initialize with initializeFromShyConfig — see the Web SDK overview for the common setup pattern.

Non-standard options for this client: deriveSealerKey, signMessage, getIdentityAttestation.

Initialize

const client = initializeFromShyConfig(shyconfig, {
getAuthHeaders: async () => ({ Authorization: `Bearer ${token}` }),
deriveSealerKey: async () => derivedKeyMaterial,
signMessage: async (msg) => ({ pubKeyHex, sigBytes })
});

const state = client.initialize();
// → { stream: { provider }, requiredFlows, identity, deployment, ... }

Bucket lifecycle

Streams are grouped into storage buckets for period-close attestation, identical to storeClient.

await client.createBucket({ bucketID: "stream-session-001", allowedCategories: ["stream_event"] });
const buckets = await client.listBuckets();
await client.closeBucket({ bucketID: "stream-session-001", closingHeight: 88400 });
const closure = await client.getBucketClosure("stream-session-001");

Stream events and clips

await client.createStreamEvent({
bucketID: "stream-session-001",
payload: { event: "stream_start", streamID: "s-001", timestamp: Date.now() },
category: "stream_event"
});

await client.createStreamClip({
bucketID: "stream-session-001",
payload: { clipID: "clip-042", duration_ms: 8400, ref: "ipfs://clip-ref" },
category: "stream_clip"
});

Both store sealed records via storeClient.storeSecret under the two-list invariant.

Seal a video segment

await client.sealVideoSegment({
bucketID: "stream-session-001",
streamID: "s-001",
sequence: 42,
segment: uint8ArrayOfTSPayload,
mimeType: "video/mp2t",
codec: "h264",
startedAt: Date.now()
});

The segment payload is AES-GCM sealed client-side. The canonical layer stores only ciphertext — the stream operator cannot observe segment content from canonical state. Decryption requires the participant-derived sealer key, accessible only via the reconciling authority under the established reveal flow.

Low-latency sealing

const { sealSegment } = client.createLowLatencySegmentSealer({ bucketID: "stream-session-001", streamID: "s-001" });

// In the video pipeline:
await sealSegment({ sequence: 0, segment: chunk });
await sealSegment({ sequence: 1, segment: chunk });

The low-latency sealer pre-fetches bucket context and caches the sealer key derivation across segments to minimize per-segment overhead in live stream pipelines.

Local sealing helpers

const sealed = await client.sealPayload(plaintext);
const plain = await client.openPayload(sealed);

Direct access to the underlying storeClient sealing primitives for custom payload types.

Structural guarantee

shystream-v1 is a 3-party sealer-governed embodiment. Stream segment content is never accessible from canonical state — enumeration of "which participant produced which stream" is structurally impossible without collusion between the authentication provider and reconciling authority. No rescission pathway exists; erasure means sealer key deletion by the reconciling authority.