This is the reference client for the GhostDeploy Universal Node Hosting API, gds.api/1 (GDS-1 §10,
spec/api/openapi.yaml). It runs on Node 18+ and has no runtime dependencies. It uses only node:tls,
node:http and node:crypto.
Security model
- HTTPS only, with a pinned certificate. The client does not use
https.request and does not trust any CA.
- It opens the TLS connection itself with
tls.connect.
- On
secureConnect it compares the SHA-256 of the peer's DER certificate with the pinned fingerprint, in
constant time.
- Only after the pin matches does it hand the socket to
node:http (createConnection).
- No request bytes are written before that, including the bearer token.
- On a mismatch it throws
FingerprintMismatchError. The fingerprint is mandatory and the check cannot be
disabled.
- No proxy, no shared agent. Every request gets its own freshly pinned connection.
- Errors. Server errors throw
APIError with .status and .code, which is the gds.api/1 code. A 429 response
is retried with backoff.
- PoP verification.
verifyPop() always runs every check, including the ed25519 signature. Node's built-in
crypto provides ed25519.
Usage
import { Client, verifyPop } from "@ghostdeploy/client";
const c = new Client({ baseUrl: "https://203.0.113.10:8790", fingerprint: "57dc07ba...dd3", token: "gd_<id>_<secret>" });
await c.capabilities(); // works without a token
await c.listInstances(); await c.getInstance("alice"); await c.status("alice"); await c.events("alice", 50);
await c.profiles(); await c.benchmark(); await c.offers(); await c.openapi();
const op = await c.stop("alice"); // start / restart / startSigners / backup / action(name, action)
await c.waitOperation(op, { timeoutMs: 300_000 });
await c.deploy({ name: "carol", profile: "cold-smartnode", chain_id: 20778 });
await c.deleteInstance("carol");
await c.smartnodeKeygen("alice", "v1");
const pkg = await c.smartnodePop("alice", "v1", "0xYourOwnerAddress");
verifyPop(pkg, { expectedOwner: "0xYourOwnerAddress", expectedChainId: 20778 }); // BEFORE signing
verifyPop checks the following:
- The calldata is exactly
0x01 || RLP([vote_pubkey, pop]). For a rotate it is
0x06 || RLP([rotated_id, vote_pubkey, pop]).
validator_id == sha256(vote_pubkey).
to is the Smartnode registry.
- The optional owner, chain and genesis expectations match.
- The ed25519 signature over
sha256("PQAI-G4-POP-V1" || chainID[32] || genesis[32] || owner[20] || key[32]) is
valid.
Build and test
cd sdk/typescript
npm install # dev only: typescript + @types/node
npm test # tsc, then node --test on dist/test/*.test.js
npm run test:src # Node 22.18+/23.6+: run the .ts sources directly (type stripping), no build step
The sources use only erasable TypeScript syntax and import with .ts extensions. rewriteRelativeImportExtensions
turns those imports into .js in dist/.
test/integration.test.ts builds sdk/testserver with go build and runs the real internal/api server on
127.0.0.1, with a throwaway root and the embedded 20778 manifest. It touches no network and runs no system commands.
It is skipped when Go is missing. Set GHOSTDEPLOY_GO to choose a toolchain.