@knotree/platform-sdk
v0.1.0
Published
Knotree platform SDK for signing permanent public image URLs
Downloads
118
Readme
Knotree Platform SDK (Node.js / TypeScript)
TypeScript client for signing permanent public image URLs. Signing is local HMAC — no HTTP call to the Knotree API.
Compatible with the Go SDK (platform-sdk/go-sdk) and the platform public
delivery route (GET /i/{image_id}/{key_id}/{signature}).
Install
npm install @knotree/platform-sdkLocal development before publish:
npm install file:../platform-sdk/node-sdkUsage
Create a signing key in the Knotree dashboard (project → signing keys). The plaintext secret is shown once at creation.
import { createClient } from "@knotree/platform-sdk";
const client = createClient(
"ks_live_ABC12345", // lookup prefix (key id)
"ks_live_ABC12345abcdefghijklmnopqrstuv", // full plaintext secret
);
const url = client.signImageURL("img_abc123");
// https://apis.knotree.com/i/img_abc123/ks_live_ABC12345/<signature>The default public base URL is https://apis.knotree.com. Pass
{ publicBaseURL: "..." } when your deployment uses a different
IMAGE_PUBLIC_BASE_URL.
Low-level signer
import { canonical, sign, verify } from "@knotree/platform-sdk";
const sig = sign(secret, imageID, keyID);
verify(secret, imageID, keyID, sig); // trueRequirements
- Node.js 18+
Test
npm testBuild
npm run build