Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

SDK Overview

@dataprism/sdk is the client-side core of DataPrism, in TypeScript, embeddable anywhere: browser, Node backend, or a script. It exposes a single API for three jobs:

  • Drive the decentralized network: create prisms, read and write data slots, whether or not the user pays network fees themselves.
  • Encrypt and decrypt: keys derived from a signature, never stored.
  • Store files: chunking, Reed-Solomon erasure coding, multi-cloud dispersion, and quorum-based reconstruction.

It is ESM, strict TypeScript, and pulls in no heavy cloud SDK. Dependencies: viem (peer, 2.0 or later), @noble/curves, @noble/ciphers, @noble/hashes.

Install

npm install @dataprism/sdk viem

Quick start

import { DataPrismClient, DataPrismNetwork, DEMO } from "@dataprism/sdk";
 
const network = new DataPrismNetwork(DEMO, "https://rpc.example.com");
 
// direct mode (default): the user's account pays network fees
const client = new DataPrismClient(network, { walletClient });
 
// api mode: a relayer fronts the fees, reimbursed in DPC
const client = new DataPrismClient(network, {
  walletClient,
  apiUrl,
  mode: "api",
});
 
// read-only: no account at all
const client = new DataPrismClient(network);

The entry point is DataPrismClient, a lazy facade that builds its sub-clients on first access:

GetterTypeNeeds an account
readerNetworkReaderno
executionExecutionLayeryes
signerDataPrismSigneryes
prism(std, cloudId?)PrismManageryes

Layered architecture

                 YOUR APPLICATION

   ┌───────────────────▼───────────────────────────────────────┐
   │ STANDARD   CloudStandard / CloudReader   prism slots       │
   ├────────────────────────────────────────────────────────────┤
   │ CRYPTO     DataPrismKey   keys + seal/open                 │
   ├────────────────────────────────────────────────────────────┤
   │ FILES      FilePipeline + ReedSolomon                      │
   │ STORAGE    StorageProvider (signed URLs, Memory)           │
   ├────────────────────────────────────────────────────────────┤
   │ EXECUTION  ExecutionLayer (direct | api)   writes          │
   │ READING    NetworkReader      SIGNING  DataPrismSigner     │
   ├────────────────────────────────────────────────────────────┤
   │ NETWORK    DataPrismNetwork (network id, RPC, addresses)   │
   └────────────────────────────────────────────────────────────┘

        DataPrism decentralized network  ←  encrypted indexes

   Storage providers (S3 / R2 / Scaleway …)  ←  file shards

Golden rule: each layer only knows the one directly beneath it. Your application talks to the top; the network and the buckets sit at the bottom.

Importable modules (subpaths)

Everything is re-exported from the root @dataprism/sdk, and each module is also importable on its own subpath.

import { DataPrismClient } from "@dataprism/sdk"; // facade
import { DataPrismNetwork, DEMO } from "@dataprism/sdk/network";
import { walletExecution } from "@dataprism/sdk/execution";
import { DataPrismSigner } from "@dataprism/sdk/signing";
import { ApiWriter } from "@dataprism/sdk/api";
import { DataPrismKey } from "@dataprism/sdk/crypto";
import { CloudStandard, CloudReader } from "@dataprism/sdk/standard";
import { PrismManager } from "@dataprism/sdk/prism";
import { initProviders, signedUrlRegistry } from "@dataprism/sdk/storage";
import { FilePipeline } from "@dataprism/sdk/files";
SubpathRoleMain exportsDocs
/networkthe "where" (network, RPC, addresses) plus low-level readsDataPrismNetwork, DEMO, NetworkReader, computeCloudIdClient & networks, Reading
/executionunified write layerExecutionLayer, WalletExecution, ApiExecutionWriting & execution
/signingtyped request signaturesDataPrismSigner, hashBytes32Array, hashPayloadsArrayWriting & execution
/apidelegated execution REST clientApiWriter, extractCloudIdWriting & execution
/cryptoprism keys and encryptionDataPrismKey, seal, openKeys & encryption
/standardprism slots (codec plus decrypting reads)CloudStandard, CloudReader, SLOT_IDSCloud Standard slots
/prismhigh-level prism lifecyclePrismManagerCloud Standard slots
/storagestorage connectorsStorageProvider, MemoryProvider, SignedUrlProvider, initProvidersStorage providers
/filesfile pipelineFilePipeline, ReedSolomon, FastCDCChunker, convergentSealFile pipeline

End-to-end at a glance

Create your project in the dashboard, then open its SDK tab and copy the two values every integration starts from: the Project ID (cloudId) and the Secret key.

// 1. Project ID and Secret key, copied from the project's SDK tab
const cloudId = "<project-id>";
const key = DataPrismKey.fromSecret(secretKey, {
  curve: "secp256k1",
  algorithm: "aes-256-gcm",
});
const std = new CloudStandard(key);
 
// 2. Initialize providers from non-secret project metadata. The access token
// authenticates only to your own signing service and is never stored in the prism.
const storage = initProviders(
  await std.reader(client.reader, cloudId).providers(),
  signedUrlRegistry({
    getSignerHeaders: async () => ({
      authorization: `Bearer ${await getStorageToken()}`,
    }),
  }),
);
 
// 3. upload a file (dispersed multi-cloud); the index is written to the network
const pipeline = new FilePipeline({
  providers: storage,
  standard: std,
  execution: client.execution,
  cloudId,
});
await pipeline.upload("report.pdf", bytes, {
  chunkSize: 65536,
  dataShards: 4,
  parityShards: 2,
});
 
// 4. read it back
const view = std.reader(client.reader, cloudId);
const index = await view.file("report.pdf");
const bytes = await pipeline.download(index);

Prisms can also be created entirely from code, and keys can be derived from an account signature instead of pasted; see Cloud Standard slots and Keys & encryption. Each step is detailed in the pages that follow. If you are new to the concepts, start with Prisms & the Cloud Standard.

Copyright © 2026 DataPrism.