Installation & Setup

The Vault SDK targets modern ESM runtimes (Node >= 18 and all evergreen browsers).

Add the package

# with pnpm (recommended)
pnpm add @thirdweb-dev/vault-sdk
# or npm
npm install @thirdweb-dev/vault-sdk
# or Yarn
yarn add @thirdweb-dev/vault-sdk

Peer dependencies

The SDK has no required peer-dependencies, but it expects the fetch Web API to be globally available (Node 18 provides it by default).

If you run on an older Node version, install a fetch polyfill:

npm install undici --save
// polyfill global fetch (Node < 18)
import { fetch, Headers, Request, Response } from "undici";
// @ts-ignore
globalThis.fetch = fetch;

Initialise a client instance

All requests go through a VaultClient that holds your Vault's base URL and the enclave public key:

import { createVaultClient } from "@thirdweb-dev/vault-sdk";
const vault = await createVaultClient({
// Get this from your thirdweb dashboard
secretKey: "PROJECT_SECRET_KEY",
});

createVaultClient uses your secret key to establish a connection to the thirdweb vault instance. You can also specify a baseUrl that points to your own vault instance. Cache the resulting vault object and reuse it for all subsequent operations.

Tip: If you run multiple Vault instances (dev, staging, prod) create one VaultClient per instance.


Next: explore the API Reference or jump straight into the guides.