@subnoto/api-client
v2.0.5
Published
TypeScript SDK for Subnoto Public API
Downloads
1,451
Readme
Subnoto TypeScript SDK
TypeScript client for the Subnoto Public API with Oak tunnel encryption and HTTP signature authentication.
Installation
pnpm add @subnoto/api-clientUsage
import { SubnotoClient } from "@subnoto/api-client";
const client = new SubnotoClient({
apiBaseUrl: "https://enclave.subnoto.com",
accessKey: process.env.API_ACCESS_KEY,
secretKey: process.env.API_SECRET_KEY,
unattested: false
});
// Use openapi-fetch syntax
const { data, error } = await client.POST("/public/workspace/list", { body: {} });
const { data, error } = await client.POST("/public/utils/whoami", { body: {} });
const { data, error } = await client.POST("/public/contact/list", {
body: { workspaceUuid: "..." }
});Configuration
| Option | Type | Required | Description |
| ------------- | ------- | -------- | -------------------------------------- |
| apiBaseUrl | string | Yes | API base URL |
| accessKey | string | Yes | API access key |
| secretKey | string | Yes | API secret key |
| unattested | boolean | No | Use unattested mode (default: false) |
| attesterKey | Buffer | No | Public key for attestation |
Upload Helper
import { SubnotoClient } from "@subnoto/api-client";
import { readFileSync } from "fs";
const client = new SubnotoClient({
apiBaseUrl: "https://enclave.subnoto.com",
accessKey: process.env.API_ACCESS_KEY,
secretKey: process.env.API_SECRET_KEY
});
// Read your PDF file
const fileBuffer = readFileSync("path/to/document.pdf");
// Upload document - handles encryption and S3 upload automatically
const { envelopeUuid, documentUuid } = await client.uploadDocument({
workspaceUuid: "your-workspace-uuid",
fileBuffer: fileBuffer,
envelopeTitle: "My Document"
});
console.log("Document uploaded:", envelopeUuid, documentUuid);Documentation
The API documentation is available here.
