@heossi/qnsi 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +12 -12
- package/dist/_activation/activation-client.d.ts +2 -2
- package/dist/_activation/activation-client.js +4 -4
- package/dist/_internal.d.ts +6 -6
- package/dist/_internal.js +8 -8
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +26 -2
- package/dist/audit.js.map +1 -1
- package/dist/autogen/executor.d.ts +7 -7
- package/dist/autogen/executor.js +5 -5
- package/dist/autogen/index.d.ts +4 -4
- package/dist/autogen/index.js +3 -3
- package/dist/browser/provider-setup.d.ts +2 -2
- package/dist/browser/sdk-package-version.d.ts +1 -1
- package/dist/browser/sdk-package-version.js +1 -1
- package/dist/cli/commands/test-utils.js +1 -1
- package/dist/cli/config.js +1 -1
- package/dist/cli/utils/backend-validator.js +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.js +1 -1
- package/dist/errors.d.ts +5 -5
- package/dist/errors.js +10 -10
- package/dist/index.d.ts +24 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/kms.js +4 -4
- package/dist/langchain/index.d.ts +9 -9
- package/dist/langchain/index.js +6 -6
- package/dist/langchain/toolkit.d.ts +7 -7
- package/dist/langchain/toolkit.js +13 -13
- package/dist/langchain/tools/audit.d.ts +4 -4
- package/dist/langchain/tools/audit.js +1 -1
- package/dist/langchain/tools/kms.d.ts +6 -6
- package/dist/langchain/tools/kms.js +2 -2
- package/dist/langchain/tools/vault.d.ts +3 -3
- package/dist/langchain/tools/vault.js +3 -3
- package/dist/langchain/vault-client.d.ts +1 -1
- package/dist/langchain/vault-client.js +3 -3
- package/dist/llamaindex/index.d.ts +4 -4
- package/dist/llamaindex/index.js +3 -3
- package/dist/llamaindex/vector-store.d.ts +7 -7
- package/dist/llamaindex/vector-store.js +5 -5
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +3 -3
- package/dist/webhooks.d.ts +5 -5
- package/dist/webhooks.js +15 -15
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -43,7 +43,7 @@ The previous TypeScript SDK family was fragmented across 11 packages (`@heossi/q
|
|
|
43
43
|
|
|
44
44
|
### Added
|
|
45
45
|
|
|
46
|
-
- `
|
|
46
|
+
- `QnsiClient({ apiKey, baseUrl?, timeoutMs? })` — top-level client. Lazily activates against `/billing/v1/sdk/activate` on first request, reports `sdkId="qnsp"` and `sdkVersion="0.1.0"`.
|
|
47
47
|
- Eleven service sub-clients sharing one HTTP pool + one activation cache:
|
|
48
48
|
- `qnsp.vault` (createSecret / getSecret / getSecretVersion / rotateSecret / deleteSecret / listSecretVersions)
|
|
49
49
|
- `qnsp.kms` (createKey / listKeys / getKey / rotateKey / deleteKey / sign / verify / wrap / unwrap)
|
package/README.md
CHANGED
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
The official **single-package** Node.js / TypeScript SDK for QNSI. Covers the full customer-facing platform — vault, KMS, audit, auth, tenant, access-control, billing, crypto-inventory, storage, search, and AI orchestrator — plus webhook signature verification. Mirrors the shape of the `qnsp` Python / Go / Rust SDKs byte-for-byte: same wire contracts, same algorithm names, same FIPS 203 / 204 / 205 posture.
|
|
7
7
|
|
|
8
|
-
> **Free tier available.** Free-forever account at <https://cloud.
|
|
8
|
+
> **Free tier available.** Free-forever account at <https://cloud.qnsi.heossi.com/auth> — 60-second signup, no credit card. Includes 10 GB PQC storage, 50 000 API calls/month, 20 KMS keys, 25 vault secrets.
|
|
9
9
|
|
|
10
10
|
## Why one package?
|
|
11
11
|
|
|
12
12
|
Previous TypeScript consumers had to install up to 11 separate `@heossi/qnsi-*-sdk` packages and keep their versions in sync. `@heossi/qnsi` collapses that into a single dependency with sub-namespaces:
|
|
13
13
|
|
|
14
14
|
```ts
|
|
15
|
-
import {
|
|
15
|
+
import { QnsiClient } from "@heossi/qnsi";
|
|
16
16
|
|
|
17
|
-
const qnsp = new
|
|
17
|
+
const qnsp = new QnsiClient({ apiKey: process.env.QNSP_API_KEY! });
|
|
18
18
|
|
|
19
19
|
await qnsp.vault.createSecret({ ... }); // was @heossi/qnsi-vault-sdk
|
|
20
20
|
await qnsp.kms.sign(keyId, data); // was @heossi/qnsi-kms-client
|
|
@@ -40,9 +40,9 @@ Requires Node.js ≥ 22.0.0. ESM-first; CommonJS consumers can `await import("@h
|
|
|
40
40
|
## Quick start
|
|
41
41
|
|
|
42
42
|
```ts
|
|
43
|
-
import {
|
|
43
|
+
import { QnsiClient } from "@heossi/qnsi";
|
|
44
44
|
|
|
45
|
-
const qnsp = new
|
|
45
|
+
const qnsp = new QnsiClient({ apiKey: process.env.QNSP_API_KEY! });
|
|
46
46
|
|
|
47
47
|
// Vault — PQC-encrypted secret storage
|
|
48
48
|
const secret = await qnsp.vault.createSecret({
|
|
@@ -142,7 +142,7 @@ try {
|
|
|
142
142
|
|
|
143
143
|
## Activation + tier introspection
|
|
144
144
|
|
|
145
|
-
`
|
|
145
|
+
`QnsiClient` performs a one-shot handshake against `/billing/v1/sdk/activate` on first use. The result is cached in memory; subsequent calls reuse it until ~60 s before expiry. You can inspect the current activation:
|
|
146
146
|
|
|
147
147
|
```ts
|
|
148
148
|
await qnsp.tenantId(); // resolved tenant
|
|
@@ -162,7 +162,7 @@ The per-service `@heossi/qnsi-*-sdk` packages on npm are now **deprecated** in f
|
|
|
162
162
|
|
|
163
163
|
| Before | After |
|
|
164
164
|
|---|---|
|
|
165
|
-
| `import { VaultClient } from "@heossi/qnsi-vault-sdk"` | `import {
|
|
165
|
+
| `import { VaultClient } from "@heossi/qnsi-vault-sdk"` | `import { QnsiClient } from "@heossi/qnsi"` then `qnsp.vault` |
|
|
166
166
|
| `import { KmsClient } from "@heossi/qnsi-kms-client"` | `qnsp.kms` |
|
|
167
167
|
| `import { AuthClient } from "@heossi/qnsi-auth-sdk"` | `qnsp.auth` |
|
|
168
168
|
| `import { TenantClient } from "@heossi/qnsi-tenant-sdk"` | `qnsp.tenant` |
|
|
@@ -182,14 +182,14 @@ import { VaultClient } from "@heossi/qnsi-vault-sdk";
|
|
|
182
182
|
import { KmsClient } from "@heossi/qnsi-kms-client";
|
|
183
183
|
import { AuditClient } from "@heossi/qnsi-audit-sdk";
|
|
184
184
|
|
|
185
|
-
const vault = new VaultClient({ apiKey, baseUrl: "https://api.
|
|
186
|
-
const kms = new KmsClient({ apiKey, baseUrl: "https://api.
|
|
187
|
-
const audit = new AuditClient({ apiKey, baseUrl: "https://api.
|
|
185
|
+
const vault = new VaultClient({ apiKey, baseUrl: "https://api.qnsi.heossi.com/proxy/vault", tier });
|
|
186
|
+
const kms = new KmsClient({ apiKey, baseUrl: "https://api.qnsi.heossi.com/proxy/kms", tier });
|
|
187
|
+
const audit = new AuditClient({ apiKey, baseUrl: "https://api.qnsi.heossi.com/proxy/audit", tier });
|
|
188
188
|
|
|
189
189
|
// After — one package, one activation, one client
|
|
190
|
-
import {
|
|
190
|
+
import { QnsiClient } from "@heossi/qnsi";
|
|
191
191
|
|
|
192
|
-
const qnsp = new
|
|
192
|
+
const qnsp = new QnsiClient({ apiKey });
|
|
193
193
|
// qnsp.vault, qnsp.kms, qnsp.audit, ... all share one connection pool + one activation cache
|
|
194
194
|
```
|
|
195
195
|
|
|
@@ -25,13 +25,13 @@ export declare class SdkActivationError_ extends Error {
|
|
|
25
25
|
* Configuration for SDK activation.
|
|
26
26
|
*/
|
|
27
27
|
export interface SdkActivationConfig {
|
|
28
|
-
/** QNSP API key (required — get one at https://cloud.
|
|
28
|
+
/** QNSP API key (required — get one at https://cloud.qnsi.heossi.com/signup) */
|
|
29
29
|
readonly apiKey: string;
|
|
30
30
|
/** SDK package identifier */
|
|
31
31
|
readonly sdkId: SdkIdentifier;
|
|
32
32
|
/** SDK version string */
|
|
33
33
|
readonly sdkVersion: string;
|
|
34
|
-
/** Override platform URL (defaults to https://api.
|
|
34
|
+
/** Override platform URL (defaults to https://api.qnsi.heossi.com) */
|
|
35
35
|
readonly platformUrl?: string | undefined;
|
|
36
36
|
/** Override activation timeout in ms (defaults to 15000) */
|
|
37
37
|
readonly timeoutMs?: number | undefined;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { SdkActivationErrorSchema, SdkActivationResponseSchema, } from "./types.js";
|
|
16
16
|
const ACTIVATION_PATH = "/billing/v1/sdk/activate";
|
|
17
|
-
const DEFAULT_PLATFORM_URL = "https://api.
|
|
17
|
+
const DEFAULT_PLATFORM_URL = "https://api.qnsi.heossi.com";
|
|
18
18
|
const ACTIVATION_TIMEOUT_MS = 15_000;
|
|
19
19
|
const REFRESH_BUFFER_SECONDS = 300; // Refresh 5 minutes before expiry
|
|
20
20
|
/**
|
|
@@ -61,9 +61,9 @@ function detectRuntime() {
|
|
|
61
61
|
export async function activateSdk(config) {
|
|
62
62
|
if (!config.apiKey || config.apiKey.trim().length === 0) {
|
|
63
63
|
throw new SdkActivationError_("INVALID_API_KEY", `QNSP ${config.sdkId}: apiKey is required. ` +
|
|
64
|
-
"Get your free API key at https://cloud.
|
|
64
|
+
"Get your free API key at https://cloud.qnsi.heossi.com/signup — " +
|
|
65
65
|
"no credit card required (FREE tier: 10 GB storage, 50,000 API calls/month). " +
|
|
66
|
-
`Docs: https://docs.
|
|
66
|
+
`Docs: https://docs.qnsi.heossi.com/sdk/${config.sdkId}`, 401);
|
|
67
67
|
}
|
|
68
68
|
const key = cacheKey(config);
|
|
69
69
|
const cached = activationCache.get(key);
|
|
@@ -114,7 +114,7 @@ export async function activateSdk(config) {
|
|
|
114
114
|
}
|
|
115
115
|
if (response.status === 401) {
|
|
116
116
|
throw new SdkActivationError_("INVALID_API_KEY", `QNSP ${config.sdkId}: Invalid API key. ` +
|
|
117
|
-
"Get your API key at https://cloud.
|
|
117
|
+
"Get your API key at https://cloud.qnsi.heossi.com/api-keys", 401);
|
|
118
118
|
}
|
|
119
119
|
if (response.status === 429) {
|
|
120
120
|
throw new SdkActivationError_("RATE_LIMITED", `QNSP ${config.sdkId}: Activation rate limited. Please retry after a short delay.`, 429);
|
package/dist/_internal.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared HTTP plumbing + activation cache.
|
|
3
3
|
*
|
|
4
|
-
* Internal — consumers should reach this only via `
|
|
4
|
+
* Internal — consumers should reach this only via `QnsiClient`. Each
|
|
5
5
|
* service module (vault, kms, audit, …) takes an `Internal` instance
|
|
6
6
|
* in its constructor and calls `internal.request(method, path, …)`.
|
|
7
7
|
*/
|
|
8
8
|
import { type SdkActivationResponse } from "./_activation/index.js";
|
|
9
9
|
export declare const SDK_ID = "qnsp";
|
|
10
10
|
export declare const SDK_VERSION = "0.3.0";
|
|
11
|
-
/** Public configuration accepted by `new
|
|
12
|
-
export interface
|
|
13
|
-
/** API key issued from <https://cloud.
|
|
11
|
+
/** Public configuration accepted by `new QnsiClient(opts)`. */
|
|
12
|
+
export interface QnsiClientOptions {
|
|
13
|
+
/** API key issued from <https://cloud.qnsi.heossi.com/api-keys>. Required. */
|
|
14
14
|
readonly apiKey: string;
|
|
15
|
-
/** Override the QNSP edge-gateway URL. Defaults to https://api.
|
|
15
|
+
/** Override the QNSP edge-gateway URL. Defaults to https://api.qnsi.heossi.com. */
|
|
16
16
|
readonly baseUrl?: string;
|
|
17
17
|
/** Per-request timeout in milliseconds. Defaults to 15 000. */
|
|
18
18
|
readonly timeoutMs?: number;
|
|
@@ -28,7 +28,7 @@ export declare class Internal {
|
|
|
28
28
|
readonly apiKey: string;
|
|
29
29
|
private cached;
|
|
30
30
|
private activationPromise;
|
|
31
|
-
constructor(opts:
|
|
31
|
+
constructor(opts: QnsiClientOptions);
|
|
32
32
|
/** Force the activation handshake to run now. */
|
|
33
33
|
ensureActivated(): Promise<SdkActivationResponse>;
|
|
34
34
|
/** The activated tenant id (for endpoints that require the tenant in the URL path). */
|
package/dist/_internal.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared HTTP plumbing + activation cache.
|
|
3
3
|
*
|
|
4
|
-
* Internal — consumers should reach this only via `
|
|
4
|
+
* Internal — consumers should reach this only via `QnsiClient`. Each
|
|
5
5
|
* service module (vault, kms, audit, …) takes an `Internal` instance
|
|
6
6
|
* in its constructor and calls `internal.request(method, path, …)`.
|
|
7
7
|
*/
|
|
8
8
|
import { activateSdk } from "./_activation/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import { QnsiApiError, QnsiAuthError, QnsiNetworkError } from "./errors.js";
|
|
10
10
|
export const SDK_ID = "qnsp";
|
|
11
|
-
// Bump in lockstep with packages/
|
|
11
|
+
// Bump in lockstep with packages/qnsi/package.json `version` (activation
|
|
12
12
|
// telemetry label). Same release contract as browser/sdk-package-version.ts.
|
|
13
13
|
export const SDK_VERSION = "0.3.0";
|
|
14
|
-
const DEFAULT_BASE_URL = "https://api.
|
|
14
|
+
const DEFAULT_BASE_URL = "https://api.qnsi.heossi.com";
|
|
15
15
|
const DEFAULT_TIMEOUT_MS = 15_000;
|
|
16
16
|
const EXPIRY_BUFFER_MS = 60_000; // refresh 60 s before expiry
|
|
17
17
|
export class Internal {
|
|
@@ -22,7 +22,7 @@ export class Internal {
|
|
|
22
22
|
activationPromise = null;
|
|
23
23
|
constructor(opts) {
|
|
24
24
|
if (!opts.apiKey || opts.apiKey.trim().length === 0) {
|
|
25
|
-
throw new
|
|
25
|
+
throw new QnsiAuthError("api key required (sign up at https://cloud.qnsi.heossi.com/auth)");
|
|
26
26
|
}
|
|
27
27
|
this.apiKey = opts.apiKey;
|
|
28
28
|
this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
@@ -107,7 +107,7 @@ export class Internal {
|
|
|
107
107
|
return JSON.parse(text);
|
|
108
108
|
}
|
|
109
109
|
catch {
|
|
110
|
-
throw new
|
|
110
|
+
throw new QnsiApiError("response is not valid JSON", response.status);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
async send(method, path, body, options) {
|
|
@@ -131,7 +131,7 @@ export class Internal {
|
|
|
131
131
|
return await fetch(url, init);
|
|
132
132
|
}
|
|
133
133
|
catch (err) {
|
|
134
|
-
throw new
|
|
134
|
+
throw new QnsiNetworkError(method, url, err);
|
|
135
135
|
}
|
|
136
136
|
finally {
|
|
137
137
|
clearTimeout(timer);
|
|
@@ -218,7 +218,7 @@ function parseApiError(status, raw) {
|
|
|
218
218
|
else if (typeof raw === "string" && raw.length > 0) {
|
|
219
219
|
message = raw;
|
|
220
220
|
}
|
|
221
|
-
return new
|
|
221
|
+
return new QnsiApiError(message, status, code, body);
|
|
222
222
|
}
|
|
223
223
|
function parseExpiresAt(response) {
|
|
224
224
|
const { expiresAt } = response;
|
package/dist/audit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAI/D,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAI/D,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AA+BD,qBAAa,WAAW;IACX,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,QAAQ;IAE/C,QAAQ,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC;IAI5E,YAAY,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC;IAS9F,UAAU,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC;CAG1C"}
|
package/dist/audit.js
CHANGED
|
@@ -3,16 +3,40 @@
|
|
|
3
3
|
* `apps/audit-service` (`/audit/v1`).
|
|
4
4
|
*/
|
|
5
5
|
const PATH_PREFIX = "/proxy/audit/v1";
|
|
6
|
+
/**
|
|
7
|
+
* Translate the ergonomic SDK event into the wire shape the audit-service
|
|
8
|
+
* actually accepts. This is the contract-translation boundary — callers keep
|
|
9
|
+
* passing `{ eventType, payload, tags }` unchanged.
|
|
10
|
+
*
|
|
11
|
+
* `normalizeBatch` (`apps/audit-service/src/services/audit-service.ts`) matches
|
|
12
|
+
* one of three strict schemas. The `_internal` client injects a top-level
|
|
13
|
+
* `tenantId` into every body, which **fails** the `legacyAttestation` schema
|
|
14
|
+
* (`{ eventType, timestamp?, severity?, payload? }`, `.strict()` → rejects
|
|
15
|
+
* `tenantId` → 0 events → HTTP 400). The only path that tolerates the injected
|
|
16
|
+
* `tenantId` is `legacySecurityAuditClientEventSchema`, which carries
|
|
17
|
+
* `{ eventType?, source?, tenantId?, details?, … }` and maps `details` → the
|
|
18
|
+
* stored event `payload` (and honours `tenantId` for tenant-scoping). So the
|
|
19
|
+
* caller's `payload` goes into `details`, and `tags` rides alongside as
|
|
20
|
+
* `details.tags`. Verified live: `{tenantId,eventType,source,details}` → 202;
|
|
21
|
+
* `{tenantId,eventType,payload}` → 400.
|
|
22
|
+
*/
|
|
23
|
+
function toWireEvent(req) {
|
|
24
|
+
const details = { ...req.payload };
|
|
25
|
+
if (req.tags && req.tags.length > 0) {
|
|
26
|
+
details["tags"] = [...req.tags];
|
|
27
|
+
}
|
|
28
|
+
return { eventType: req.eventType, source: "qnsi-sdk", details };
|
|
29
|
+
}
|
|
6
30
|
export class AuditClient {
|
|
7
31
|
internal;
|
|
8
32
|
constructor(internal) {
|
|
9
33
|
this.internal = internal;
|
|
10
34
|
}
|
|
11
35
|
logEvent(req, opts) {
|
|
12
|
-
return this.internal.request("POST", `${PATH_PREFIX}/events`, req, opts);
|
|
36
|
+
return this.internal.request("POST", `${PATH_PREFIX}/events`, toWireEvent(req), opts);
|
|
13
37
|
}
|
|
14
38
|
ingestEvents(events, opts) {
|
|
15
|
-
return this.internal.request("POST", `${PATH_PREFIX}/events/batch`, { events }, opts);
|
|
39
|
+
return this.internal.request("POST", `${PATH_PREFIX}/events/batch`, { events: events.map(toWireEvent) }, opts);
|
|
16
40
|
}
|
|
17
41
|
listEvents(query) {
|
|
18
42
|
return this.internal.request("GET", `${PATH_PREFIX}/events`, undefined, { query });
|
package/dist/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAQtC,MAAM,OAAO,WAAW;IACM;IAA7B,YAA6B,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAEnD,QAAQ,CAAC,GAAoB,EAAE,IAA6C;QAC3E,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,WAAW,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAQtC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,WAAW,CAAC,GAAoB;IAKxC,MAAM,OAAO,GAA4B,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC5D,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AAClE,CAAC;AAED,MAAM,OAAO,WAAW;IACM;IAA7B,YAA6B,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAEnD,QAAQ,CAAC,GAAoB,EAAE,IAA6C;QAC3E,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,WAAW,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;IACvF,CAAC;IAED,YAAY,CAAC,MAAkC,EAAE,IAA6C;QAC7F,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAC3B,MAAM,EACN,GAAG,WAAW,eAAe,EAC7B,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EACnC,IAAI,CACJ,CAAC;IACH,CAAC;IAED,UAAU,CAAC,KAA+B;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,WAAW,SAAS,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACpF,CAAC;CACD"}
|
|
@@ -86,9 +86,9 @@ export interface WorkloadDetail extends WorkloadSummary {
|
|
|
86
86
|
readonly artifacts: readonly WorkloadArtifactBinding[];
|
|
87
87
|
readonly schedulerMetadata: Record<string, unknown> | null;
|
|
88
88
|
}
|
|
89
|
-
export interface
|
|
89
|
+
export interface QnsiExecutorConfig {
|
|
90
90
|
/**
|
|
91
|
-
* QNSP API key. Get one at https://cloud.
|
|
91
|
+
* QNSP API key. Get one at https://cloud.qnsi.heossi.com/api-keys
|
|
92
92
|
* The API key carries the tenant ID — no separate tenantId needed.
|
|
93
93
|
*/
|
|
94
94
|
readonly apiKey: string;
|
|
@@ -100,7 +100,7 @@ export interface QnspExecutorConfig {
|
|
|
100
100
|
readonly tenantId?: string;
|
|
101
101
|
/**
|
|
102
102
|
* Base URL for the QNSP API.
|
|
103
|
-
* Defaults to https://api.
|
|
103
|
+
* Defaults to https://api.qnsi.heossi.com
|
|
104
104
|
*/
|
|
105
105
|
readonly baseUrl?: string;
|
|
106
106
|
/**
|
|
@@ -182,16 +182,16 @@ export interface ExecuteCodeResult {
|
|
|
182
182
|
*
|
|
183
183
|
* @example
|
|
184
184
|
* ```typescript
|
|
185
|
-
* import {
|
|
185
|
+
* import { QnsiExecutor } from "@heossi/qnsi/autogen";
|
|
186
186
|
*
|
|
187
|
-
* const executor = new
|
|
187
|
+
* const executor = new QnsiExecutor({ apiKey: process.env.QNSP_API_KEY });
|
|
188
188
|
* const result = await executor.execute({ code: "print('hi')", language: "python" });
|
|
189
189
|
* console.log(result.status, result.attestationProof);
|
|
190
190
|
* ```
|
|
191
191
|
*/
|
|
192
|
-
export declare class
|
|
192
|
+
export declare class QnsiExecutor {
|
|
193
193
|
#private;
|
|
194
|
-
constructor(config:
|
|
194
|
+
constructor(config: QnsiExecutorConfig);
|
|
195
195
|
/**
|
|
196
196
|
* Execute code inside a QNSP enclave and wait for the result.
|
|
197
197
|
*/
|
package/dist/autogen/executor.js
CHANGED
|
@@ -47,20 +47,20 @@ const LANGUAGE_COMMANDS = {
|
|
|
47
47
|
bash: ["bash", "-c"],
|
|
48
48
|
javascript: ["node", "-e"],
|
|
49
49
|
};
|
|
50
|
-
// ───
|
|
50
|
+
// ─── QnsiExecutor ─────────────────────────────────────────────────────────────
|
|
51
51
|
/**
|
|
52
52
|
* AutoGen-compatible code executor backed by QNSP AI orchestrator enclaves.
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```typescript
|
|
56
|
-
* import {
|
|
56
|
+
* import { QnsiExecutor } from "@heossi/qnsi/autogen";
|
|
57
57
|
*
|
|
58
|
-
* const executor = new
|
|
58
|
+
* const executor = new QnsiExecutor({ apiKey: process.env.QNSP_API_KEY });
|
|
59
59
|
* const result = await executor.execute({ code: "print('hi')", language: "python" });
|
|
60
60
|
* console.log(result.status, result.attestationProof);
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export class
|
|
63
|
+
export class QnsiExecutor {
|
|
64
64
|
#apiKey;
|
|
65
65
|
#baseUrl;
|
|
66
66
|
#containerImage;
|
|
@@ -84,7 +84,7 @@ export class QnspExecutor {
|
|
|
84
84
|
this.#pollIntervalMs = config.pollIntervalMs ?? 2_000;
|
|
85
85
|
this.#requestTimeoutMs = config.requestTimeoutMs ?? 30_000;
|
|
86
86
|
this.#apiKey = config.apiKey;
|
|
87
|
-
this.#baseUrl = (config.baseUrl ?? "https://api.
|
|
87
|
+
this.#baseUrl = (config.baseUrl ?? "https://api.qnsi.heossi.com").replace(/\/$/, "");
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Resolve the effective tenant ID — either from config or via SDK activation.
|
package/dist/autogen/index.d.ts
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
|
-
* import {
|
|
10
|
+
* import { QnsiExecutor } from "@heossi/qnsi/autogen";
|
|
11
11
|
*
|
|
12
|
-
* const executor = new
|
|
12
|
+
* const executor = new QnsiExecutor({ apiKey: process.env.QNSP_API_KEY });
|
|
13
13
|
* const result = await executor.execute({ code: "print('Hello')", language: "python" });
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
export type { ExecuteCodeRequest, ExecuteCodeResult,
|
|
17
|
-
export {
|
|
16
|
+
export type { ExecuteCodeRequest, ExecuteCodeResult, QnsiExecutorConfig, SubmitWorkloadRequest, WorkloadDetail, WorkloadStatus, } from "./executor.js";
|
|
17
|
+
export { QnsiExecutor } from "./executor.js";
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/autogen/index.js
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
|
-
* import {
|
|
10
|
+
* import { QnsiExecutor } from "@heossi/qnsi/autogen";
|
|
11
11
|
*
|
|
12
|
-
* const executor = new
|
|
12
|
+
* const executor = new QnsiExecutor({ apiKey: process.env.QNSP_API_KEY });
|
|
13
13
|
* const result = await executor.execute({ code: "print('Hello')", language: "python" });
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
export {
|
|
16
|
+
export { QnsiExecutor } from "./executor.js";
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -13,11 +13,11 @@ import type { PqcAlgorithm, PqcProvider } from "./pqc-types.js";
|
|
|
13
13
|
export type RuntimeEnvironment = "browser" | "node" | "edge";
|
|
14
14
|
/** Options for initializing the PQC provider. */
|
|
15
15
|
export interface InitializePqcProviderOptions {
|
|
16
|
-
/** QNSP API key — required. Get one at https://cloud.
|
|
16
|
+
/** QNSP API key — required. Get one at https://cloud.qnsi.heossi.com/signup */
|
|
17
17
|
readonly apiKey: string;
|
|
18
18
|
/** Optional subset of algorithms to enable. Defaults to all noble-supported. */
|
|
19
19
|
readonly algorithms?: readonly PqcAlgorithm[] | undefined;
|
|
20
|
-
/** Override platform URL (defaults to https://api.
|
|
20
|
+
/** Override platform URL (defaults to https://api.qnsi.heossi.com) */
|
|
21
21
|
readonly platformUrl?: string | undefined;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* must stay browser-safe — no `node:fs` runtime read — and a static JSON
|
|
7
7
|
* import would resolve outside the package `rootDir` (TS6059). This mirrors
|
|
8
8
|
* the same release-bump contract as `SDK_VERSION` in `../_internal.ts`:
|
|
9
|
-
* **bump this in lockstep with `packages/
|
|
9
|
+
* **bump this in lockstep with `packages/qnsi/package.json` `version`.**
|
|
10
10
|
*/
|
|
11
11
|
export declare const SDK_PACKAGE_VERSION = "0.3.0";
|
|
12
12
|
//# sourceMappingURL=sdk-package-version.d.ts.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* must stay browser-safe — no `node:fs` runtime read — and a static JSON
|
|
7
7
|
* import would resolve outside the package `rootDir` (TS6059). This mirrors
|
|
8
8
|
* the same release-bump contract as `SDK_VERSION` in `../_internal.ts`:
|
|
9
|
-
* **bump this in lockstep with `packages/
|
|
9
|
+
* **bump this in lockstep with `packages/qnsi/package.json` `version`.**
|
|
10
10
|
*/
|
|
11
11
|
export const SDK_PACKAGE_VERSION = "0.3.0";
|
|
12
12
|
//# sourceMappingURL=sdk-package-version.js.map
|
|
@@ -18,7 +18,7 @@ export function createMockResponse(data, status = 200, ok = true, headers = {})
|
|
|
18
18
|
}
|
|
19
19
|
export const mockConfig = {
|
|
20
20
|
edgeGatewayUrl: null,
|
|
21
|
-
cloudPortalUrl: "https://cloud.
|
|
21
|
+
cloudPortalUrl: "https://cloud.qnsi.heossi.com",
|
|
22
22
|
authServiceUrl: "http://localhost:8081",
|
|
23
23
|
serviceId: "test-service-id",
|
|
24
24
|
serviceSecret: "test-secret",
|
package/dist/cli/config.js
CHANGED
|
@@ -16,7 +16,7 @@ function deriveViaEdgeGateway(options) {
|
|
|
16
16
|
}
|
|
17
17
|
export function loadConfig(overrides) {
|
|
18
18
|
const edgeGatewayUrl = process.env["QNSP_EDGE_GATEWAY_URL"] ?? null;
|
|
19
|
-
const cloudPortalUrl = process.env["QNSP_CLOUD_PORTAL_URL"] ?? "https://cloud.
|
|
19
|
+
const cloudPortalUrl = process.env["QNSP_CLOUD_PORTAL_URL"] ?? "https://cloud.qnsi.heossi.com";
|
|
20
20
|
const defaults = {
|
|
21
21
|
edgeGatewayUrl,
|
|
22
22
|
cloudPortalUrl,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EXIT_CODES } from "../config.js";
|
|
2
2
|
import { printError } from "./output.js";
|
|
3
|
-
const CLOUD_PORTAL_URL = process.env["QNSP_CLOUD_PORTAL_URL"] ?? "https://cloud.
|
|
3
|
+
const CLOUD_PORTAL_URL = process.env["QNSP_CLOUD_PORTAL_URL"] ?? "https://cloud.qnsi.heossi.com";
|
|
4
4
|
export function handleBackendError(response, body) {
|
|
5
5
|
const error = body;
|
|
6
6
|
switch (response.status) {
|
package/dist/client.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* SDK shape byte-for-byte.
|
|
9
9
|
*/
|
|
10
10
|
import type { SdkActivationResponse } from "./_activation/index.js";
|
|
11
|
-
import { type
|
|
11
|
+
import { type QnsiClientOptions } from "./_internal.js";
|
|
12
12
|
import { AccessClient } from "./access.js";
|
|
13
13
|
import { AiClient } from "./ai.js";
|
|
14
14
|
import { AuditClient } from "./audit.js";
|
|
@@ -20,7 +20,7 @@ import { SearchClient } from "./search.js";
|
|
|
20
20
|
import { StorageClient } from "./storage.js";
|
|
21
21
|
import { TenantClient } from "./tenant.js";
|
|
22
22
|
import { VaultClient } from "./vault.js";
|
|
23
|
-
export declare class
|
|
23
|
+
export declare class QnsiClient {
|
|
24
24
|
readonly vault: VaultClient;
|
|
25
25
|
readonly kms: KmsClient;
|
|
26
26
|
readonly audit: AuditClient;
|
|
@@ -33,7 +33,7 @@ export declare class QnspClient {
|
|
|
33
33
|
readonly search: SearchClient;
|
|
34
34
|
readonly ai: AiClient;
|
|
35
35
|
private readonly internal;
|
|
36
|
-
constructor(options:
|
|
36
|
+
constructor(options: QnsiClientOptions);
|
|
37
37
|
/**
|
|
38
38
|
* Force the activation handshake to run now. Surfaces invalid-API-key
|
|
39
39
|
* errors at startup rather than on the first service call.
|
|
@@ -48,5 +48,5 @@ export declare class QnspClient {
|
|
|
48
48
|
/** Whether the tenant's plan enables a billing-side boolean feature. */
|
|
49
49
|
hasFeature(feature: string): Promise<boolean>;
|
|
50
50
|
}
|
|
51
|
-
export type {
|
|
51
|
+
export type { QnsiClientOptions } from "./_internal.js";
|
|
52
52
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.js
CHANGED
|
@@ -19,7 +19,7 @@ import { SearchClient } from "./search.js";
|
|
|
19
19
|
import { StorageClient } from "./storage.js";
|
|
20
20
|
import { TenantClient } from "./tenant.js";
|
|
21
21
|
import { VaultClient } from "./vault.js";
|
|
22
|
-
export class
|
|
22
|
+
export class QnsiClient {
|
|
23
23
|
vault;
|
|
24
24
|
kms;
|
|
25
25
|
audit;
|
package/dist/errors.d.ts
CHANGED
|
@@ -6,29 +6,29 @@
|
|
|
6
6
|
* the failure mode without parsing error messages.
|
|
7
7
|
*/
|
|
8
8
|
/** Base class — all QNSP SDK errors inherit. */
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class QnsiError extends Error {
|
|
10
10
|
constructor(message: string, options?: ErrorOptions);
|
|
11
11
|
}
|
|
12
12
|
/** DNS, TLS, timeout, or connection failure reaching the QNSP edge gateway. */
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class QnsiNetworkError extends QnsiError {
|
|
14
14
|
readonly op: string;
|
|
15
15
|
readonly url: string;
|
|
16
16
|
constructor(op: string, url: string, cause?: unknown);
|
|
17
17
|
}
|
|
18
18
|
/** API key rejected at activation. */
|
|
19
|
-
export declare class
|
|
19
|
+
export declare class QnsiAuthError extends QnsiError {
|
|
20
20
|
readonly code: string | null;
|
|
21
21
|
constructor(message: string, code?: string | null);
|
|
22
22
|
}
|
|
23
23
|
/** A QNSP service returned a 4xx/5xx with a structured body. */
|
|
24
|
-
export declare class
|
|
24
|
+
export declare class QnsiApiError extends QnsiError {
|
|
25
25
|
readonly statusCode: number;
|
|
26
26
|
readonly code: string | null;
|
|
27
27
|
readonly body: unknown;
|
|
28
28
|
constructor(message: string, statusCode: number, code?: string | null, body?: unknown);
|
|
29
29
|
}
|
|
30
30
|
/** HMAC mismatch, expired/future timestamp, malformed body, or missing fields. */
|
|
31
|
-
export declare class
|
|
31
|
+
export declare class QnsiWebhookError extends QnsiError {
|
|
32
32
|
readonly reason: string;
|
|
33
33
|
constructor(reason: string);
|
|
34
34
|
}
|
package/dist/errors.js
CHANGED
|
@@ -6,51 +6,51 @@
|
|
|
6
6
|
* the failure mode without parsing error messages.
|
|
7
7
|
*/
|
|
8
8
|
/** Base class — all QNSP SDK errors inherit. */
|
|
9
|
-
export class
|
|
9
|
+
export class QnsiError extends Error {
|
|
10
10
|
constructor(message, options) {
|
|
11
11
|
super(message, options);
|
|
12
|
-
this.name = "
|
|
12
|
+
this.name = "QnsiError";
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
/** DNS, TLS, timeout, or connection failure reaching the QNSP edge gateway. */
|
|
16
|
-
export class
|
|
16
|
+
export class QnsiNetworkError extends QnsiError {
|
|
17
17
|
op;
|
|
18
18
|
url;
|
|
19
19
|
constructor(op, url, cause) {
|
|
20
20
|
super(`qnsp: network error on ${op} ${url}: ${stringifyCause(cause)}`, { cause });
|
|
21
|
-
this.name = "
|
|
21
|
+
this.name = "QnsiNetworkError";
|
|
22
22
|
this.op = op;
|
|
23
23
|
this.url = url;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
/** API key rejected at activation. */
|
|
27
|
-
export class
|
|
27
|
+
export class QnsiAuthError extends QnsiError {
|
|
28
28
|
code;
|
|
29
29
|
constructor(message, code = null) {
|
|
30
30
|
super(`qnsp: auth error${code ? ` (${code})` : ""}: ${message}`);
|
|
31
|
-
this.name = "
|
|
31
|
+
this.name = "QnsiAuthError";
|
|
32
32
|
this.code = code;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
/** A QNSP service returned a 4xx/5xx with a structured body. */
|
|
36
|
-
export class
|
|
36
|
+
export class QnsiApiError extends QnsiError {
|
|
37
37
|
statusCode;
|
|
38
38
|
code;
|
|
39
39
|
body;
|
|
40
40
|
constructor(message, statusCode, code = null, body = null) {
|
|
41
41
|
super(`qnsp: api error ${statusCode}${code ? ` ${code}` : ""}: ${message}`);
|
|
42
|
-
this.name = "
|
|
42
|
+
this.name = "QnsiApiError";
|
|
43
43
|
this.statusCode = statusCode;
|
|
44
44
|
this.code = code;
|
|
45
45
|
this.body = body;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
/** HMAC mismatch, expired/future timestamp, malformed body, or missing fields. */
|
|
49
|
-
export class
|
|
49
|
+
export class QnsiWebhookError extends QnsiError {
|
|
50
50
|
reason;
|
|
51
51
|
constructor(reason) {
|
|
52
52
|
super(`qnsp: webhook error: ${reason}`);
|
|
53
|
-
this.name = "
|
|
53
|
+
this.name = "QnsiWebhookError";
|
|
54
54
|
this.reason = reason;
|
|
55
55
|
}
|
|
56
56
|
}
|