verdifax 0.2.0 → 0.2.3
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/README.md +5 -5
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ console.log(`Sealed run ${run.run_id}, manifest hash ${run.manifest.ManifestHash
|
|
|
39
39
|
// Verify the seal recomputes correctly.
|
|
40
40
|
const v = await client.verifyRun(run.run_id);
|
|
41
41
|
if (v.verified) {
|
|
42
|
-
console.log("✓ Manifest hash recomputes
|
|
42
|
+
console.log("✓ Manifest hash recomputes, run is intact.");
|
|
43
43
|
}
|
|
44
44
|
```
|
|
45
45
|
|
|
@@ -73,7 +73,7 @@ curl -X POST https://api.verdifax.com/admin/keys \
|
|
|
73
73
|
-d '{"name": "node-sdk-prod"}'
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
The response carries the secret **once
|
|
76
|
+
The response carries the secret **once**, store it immediately.
|
|
77
77
|
|
|
78
78
|
## Error handling
|
|
79
79
|
|
|
@@ -91,18 +91,18 @@ try {
|
|
|
91
91
|
} else if (err instanceof AuthError) {
|
|
92
92
|
// missing or invalid API key
|
|
93
93
|
} else if (err instanceof APIError) {
|
|
94
|
-
// every other non-2xx
|
|
94
|
+
// every other non-2xx, err.status carries the HTTP code
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
## Trust model
|
|
100
100
|
|
|
101
|
-
This SDK only mediates HTTP I/O
|
|
101
|
+
This SDK only mediates HTTP I/O, it does NOT verify sealed
|
|
102
102
|
manifests on its own. For offline verification with no Verdifax
|
|
103
103
|
dependency, use the [`verdifax-pepg-verify`](https://github.com/Verdifax/verdifax-orchestrator/tree/main/cmd/verdifax-pepg-verify)
|
|
104
104
|
CLI (signed binary distributed via GitHub Releases).
|
|
105
105
|
|
|
106
106
|
## License
|
|
107
107
|
|
|
108
|
-
MIT
|
|
108
|
+
MIT, see [LICENSE](LICENSE).
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* adds a new field, update this file alongside the OpenAPI to
|
|
7
7
|
* keep the SDK's surface in sync.
|
|
8
8
|
*/
|
|
9
|
-
/** A 64-character lowercase hex string
|
|
9
|
+
/** A 64-character lowercase hex string, the canonical §0
|
|
10
10
|
* SHA-256 encoding. Aliased rather than newtyped so callers
|
|
11
11
|
* pass plain strings without ceremony. */
|
|
12
12
|
type Hex64 = string;
|
|
@@ -59,7 +59,7 @@ interface ExecuteResponse {
|
|
|
59
59
|
* Sealed manifest. Field names match the orchestrator's Go-default
|
|
60
60
|
* JSON encoding (CapitalCamelCase).
|
|
61
61
|
*
|
|
62
|
-
* Subset of the canonical fields
|
|
62
|
+
* Subset of the canonical fields, see the orchestrator's
|
|
63
63
|
* `internal/pipeline/types.go` for the full struct. The fields
|
|
64
64
|
* listed here are the ones every Track-2 / Track-3 / Track-5
|
|
65
65
|
* surface depends on.
|
|
@@ -136,10 +136,10 @@ interface ClientConfig {
|
|
|
136
136
|
/** Friendly shape for {@link VerdifaxClient.attest}. Mirrors the
|
|
137
137
|
* Python SDK's `attest()` signature so polyglot teams have parity. */
|
|
138
138
|
interface AttestRequest {
|
|
139
|
-
/** Raw bytes
|
|
139
|
+
/** Raw bytes, auto-base64-encoded before sending. Mutually
|
|
140
140
|
* exclusive with `payload_text`. */
|
|
141
141
|
payload?: Buffer | Uint8Array;
|
|
142
|
-
/** Plain-text payload
|
|
142
|
+
/** Plain-text payload, sent as-is. Mutually exclusive with
|
|
143
143
|
* `payload`. */
|
|
144
144
|
payload_text?: string;
|
|
145
145
|
program_id: Hex64;
|
|
@@ -211,7 +211,7 @@ interface DCAEVerdict {
|
|
|
211
211
|
engine_version: string;
|
|
212
212
|
}
|
|
213
213
|
/** Body returned by `POST /admin/keys`. The `secret` field is
|
|
214
|
-
* shown ONCE
|
|
214
|
+
* shown ONCE, store it immediately. */
|
|
215
215
|
interface AdminCreateKeyResponse {
|
|
216
216
|
ok: boolean;
|
|
217
217
|
id: number;
|
|
@@ -220,7 +220,7 @@ interface AdminCreateKeyResponse {
|
|
|
220
220
|
hint: string;
|
|
221
221
|
}
|
|
222
222
|
/** Projection returned by {@link VerdifaxClient.adminListKeys}.
|
|
223
|
-
* Secrets are NEVER surfaced
|
|
223
|
+
* Secrets are NEVER surfaced, only metadata. */
|
|
224
224
|
interface AdminAPIKey {
|
|
225
225
|
id: number;
|
|
226
226
|
name: string;
|
|
@@ -261,7 +261,7 @@ interface AdminAPIKey {
|
|
|
261
261
|
*
|
|
262
262
|
* Idempotent GETs that hit a transient failure (502/503/504/429)
|
|
263
263
|
* are retried with exponential backoff + full jitter. Non-
|
|
264
|
-
* idempotent methods (POST, PUT, DELETE) are NOT retried
|
|
264
|
+
* idempotent methods (POST, PUT, DELETE) are NOT retried, replay
|
|
265
265
|
* is the caller's responsibility.
|
|
266
266
|
*/
|
|
267
267
|
declare class VerdifaxClient {
|
|
@@ -276,7 +276,7 @@ declare class VerdifaxClient {
|
|
|
276
276
|
version(): Promise<VerdifaxVersion>;
|
|
277
277
|
execute(req: ExecuteRequest): Promise<ExecuteResponse>;
|
|
278
278
|
/** High-level convenience wrapper around `execute()`. Accepts
|
|
279
|
-
* either a Buffer (for binary payloads
|
|
279
|
+
* either a Buffer (for binary payloads, auto-base64) or a
|
|
280
280
|
* string (for plain text). Validates the hex fields and
|
|
281
281
|
* routes the call through to the canonical /execute. */
|
|
282
282
|
attest(req: AttestRequest): Promise<ExecuteResponse>;
|
|
@@ -325,7 +325,7 @@ declare class VerdifaxClient {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
/**
|
|
328
|
-
* Environment-variable constructor
|
|
328
|
+
* Environment-variable constructor, mirrors the Python SDK's
|
|
329
329
|
* `from_env()` and the Go SDK's `FromEnv()` for polyglot parity.
|
|
330
330
|
*
|
|
331
331
|
* Variables consumed (identical names across SDKs):
|
|
@@ -340,14 +340,14 @@ declare class VerdifaxClient {
|
|
|
340
340
|
declare function fromEnv(): VerdifaxClient;
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
|
-
* Input-validation helpers
|
|
343
|
+
* Input-validation helpers, mirrors the Python SDK's
|
|
344
344
|
* `_validation.py` and the Go SDK's `validation.go` for
|
|
345
345
|
* cross-language parity.
|
|
346
346
|
*
|
|
347
347
|
* Every helper throws (rather than returning a boolean) so the
|
|
348
348
|
* SDK's type system surfaces the failure as a typed error.
|
|
349
349
|
*/
|
|
350
|
-
/** Throws unless `value` is exactly 64 lowercase hex characters
|
|
350
|
+
/** Throws unless `value` is exactly 64 lowercase hex characters ,
|
|
351
351
|
* the §0-canonical SHA-256 encoding the orchestrator expects for
|
|
352
352
|
* program_id, registry_record_hash, manifest_hash, and
|
|
353
353
|
* ciphertext_hash. */
|
|
@@ -380,14 +380,14 @@ declare function validateRouteId(value: string): void;
|
|
|
380
380
|
declare class VerdifaxError extends Error {
|
|
381
381
|
readonly name: string;
|
|
382
382
|
}
|
|
383
|
-
/** HTTP 401
|
|
383
|
+
/** HTTP 401, missing or invalid API key. */
|
|
384
384
|
declare class AuthError extends VerdifaxError {
|
|
385
385
|
readonly status: number;
|
|
386
386
|
readonly message: string;
|
|
387
387
|
readonly name: string;
|
|
388
388
|
constructor(status: number, message: string);
|
|
389
389
|
}
|
|
390
|
-
/** HTTP 404
|
|
390
|
+
/** HTTP 404, resource not found. Carries the path that 404'd
|
|
391
391
|
* for easier diagnosis. */
|
|
392
392
|
declare class NotFoundError extends VerdifaxError {
|
|
393
393
|
readonly path: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* adds a new field, update this file alongside the OpenAPI to
|
|
7
7
|
* keep the SDK's surface in sync.
|
|
8
8
|
*/
|
|
9
|
-
/** A 64-character lowercase hex string
|
|
9
|
+
/** A 64-character lowercase hex string, the canonical §0
|
|
10
10
|
* SHA-256 encoding. Aliased rather than newtyped so callers
|
|
11
11
|
* pass plain strings without ceremony. */
|
|
12
12
|
type Hex64 = string;
|
|
@@ -59,7 +59,7 @@ interface ExecuteResponse {
|
|
|
59
59
|
* Sealed manifest. Field names match the orchestrator's Go-default
|
|
60
60
|
* JSON encoding (CapitalCamelCase).
|
|
61
61
|
*
|
|
62
|
-
* Subset of the canonical fields
|
|
62
|
+
* Subset of the canonical fields, see the orchestrator's
|
|
63
63
|
* `internal/pipeline/types.go` for the full struct. The fields
|
|
64
64
|
* listed here are the ones every Track-2 / Track-3 / Track-5
|
|
65
65
|
* surface depends on.
|
|
@@ -136,10 +136,10 @@ interface ClientConfig {
|
|
|
136
136
|
/** Friendly shape for {@link VerdifaxClient.attest}. Mirrors the
|
|
137
137
|
* Python SDK's `attest()` signature so polyglot teams have parity. */
|
|
138
138
|
interface AttestRequest {
|
|
139
|
-
/** Raw bytes
|
|
139
|
+
/** Raw bytes, auto-base64-encoded before sending. Mutually
|
|
140
140
|
* exclusive with `payload_text`. */
|
|
141
141
|
payload?: Buffer | Uint8Array;
|
|
142
|
-
/** Plain-text payload
|
|
142
|
+
/** Plain-text payload, sent as-is. Mutually exclusive with
|
|
143
143
|
* `payload`. */
|
|
144
144
|
payload_text?: string;
|
|
145
145
|
program_id: Hex64;
|
|
@@ -211,7 +211,7 @@ interface DCAEVerdict {
|
|
|
211
211
|
engine_version: string;
|
|
212
212
|
}
|
|
213
213
|
/** Body returned by `POST /admin/keys`. The `secret` field is
|
|
214
|
-
* shown ONCE
|
|
214
|
+
* shown ONCE, store it immediately. */
|
|
215
215
|
interface AdminCreateKeyResponse {
|
|
216
216
|
ok: boolean;
|
|
217
217
|
id: number;
|
|
@@ -220,7 +220,7 @@ interface AdminCreateKeyResponse {
|
|
|
220
220
|
hint: string;
|
|
221
221
|
}
|
|
222
222
|
/** Projection returned by {@link VerdifaxClient.adminListKeys}.
|
|
223
|
-
* Secrets are NEVER surfaced
|
|
223
|
+
* Secrets are NEVER surfaced, only metadata. */
|
|
224
224
|
interface AdminAPIKey {
|
|
225
225
|
id: number;
|
|
226
226
|
name: string;
|
|
@@ -261,7 +261,7 @@ interface AdminAPIKey {
|
|
|
261
261
|
*
|
|
262
262
|
* Idempotent GETs that hit a transient failure (502/503/504/429)
|
|
263
263
|
* are retried with exponential backoff + full jitter. Non-
|
|
264
|
-
* idempotent methods (POST, PUT, DELETE) are NOT retried
|
|
264
|
+
* idempotent methods (POST, PUT, DELETE) are NOT retried, replay
|
|
265
265
|
* is the caller's responsibility.
|
|
266
266
|
*/
|
|
267
267
|
declare class VerdifaxClient {
|
|
@@ -276,7 +276,7 @@ declare class VerdifaxClient {
|
|
|
276
276
|
version(): Promise<VerdifaxVersion>;
|
|
277
277
|
execute(req: ExecuteRequest): Promise<ExecuteResponse>;
|
|
278
278
|
/** High-level convenience wrapper around `execute()`. Accepts
|
|
279
|
-
* either a Buffer (for binary payloads
|
|
279
|
+
* either a Buffer (for binary payloads, auto-base64) or a
|
|
280
280
|
* string (for plain text). Validates the hex fields and
|
|
281
281
|
* routes the call through to the canonical /execute. */
|
|
282
282
|
attest(req: AttestRequest): Promise<ExecuteResponse>;
|
|
@@ -325,7 +325,7 @@ declare class VerdifaxClient {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
/**
|
|
328
|
-
* Environment-variable constructor
|
|
328
|
+
* Environment-variable constructor, mirrors the Python SDK's
|
|
329
329
|
* `from_env()` and the Go SDK's `FromEnv()` for polyglot parity.
|
|
330
330
|
*
|
|
331
331
|
* Variables consumed (identical names across SDKs):
|
|
@@ -340,14 +340,14 @@ declare class VerdifaxClient {
|
|
|
340
340
|
declare function fromEnv(): VerdifaxClient;
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
|
-
* Input-validation helpers
|
|
343
|
+
* Input-validation helpers, mirrors the Python SDK's
|
|
344
344
|
* `_validation.py` and the Go SDK's `validation.go` for
|
|
345
345
|
* cross-language parity.
|
|
346
346
|
*
|
|
347
347
|
* Every helper throws (rather than returning a boolean) so the
|
|
348
348
|
* SDK's type system surfaces the failure as a typed error.
|
|
349
349
|
*/
|
|
350
|
-
/** Throws unless `value` is exactly 64 lowercase hex characters
|
|
350
|
+
/** Throws unless `value` is exactly 64 lowercase hex characters ,
|
|
351
351
|
* the §0-canonical SHA-256 encoding the orchestrator expects for
|
|
352
352
|
* program_id, registry_record_hash, manifest_hash, and
|
|
353
353
|
* ciphertext_hash. */
|
|
@@ -380,14 +380,14 @@ declare function validateRouteId(value: string): void;
|
|
|
380
380
|
declare class VerdifaxError extends Error {
|
|
381
381
|
readonly name: string;
|
|
382
382
|
}
|
|
383
|
-
/** HTTP 401
|
|
383
|
+
/** HTTP 401, missing or invalid API key. */
|
|
384
384
|
declare class AuthError extends VerdifaxError {
|
|
385
385
|
readonly status: number;
|
|
386
386
|
readonly message: string;
|
|
387
387
|
readonly name: string;
|
|
388
388
|
constructor(status: number, message: string);
|
|
389
389
|
}
|
|
390
|
-
/** HTTP 404
|
|
390
|
+
/** HTTP 404, resource not found. Carries the path that 404'd
|
|
391
391
|
* for easier diagnosis. */
|
|
392
392
|
declare class NotFoundError extends VerdifaxError {
|
|
393
393
|
readonly path: string;
|
package/dist/index.js
CHANGED
|
@@ -150,7 +150,7 @@ var VerdifaxClient = class {
|
|
|
150
150
|
return this.request("POST", "/execute", req);
|
|
151
151
|
}
|
|
152
152
|
/** High-level convenience wrapper around `execute()`. Accepts
|
|
153
|
-
* either a Buffer (for binary payloads
|
|
153
|
+
* either a Buffer (for binary payloads, auto-base64) or a
|
|
154
154
|
* string (for plain text). Validates the hex fields and
|
|
155
155
|
* routes the call through to the canonical /execute. */
|
|
156
156
|
async attest(req) {
|
|
@@ -260,7 +260,7 @@ var VerdifaxClient = class {
|
|
|
260
260
|
const buf = await resp.arrayBuffer();
|
|
261
261
|
return Buffer.from(buf);
|
|
262
262
|
}
|
|
263
|
-
// ── CRES
|
|
263
|
+
// ── CRES, deletion receipts (auth) ──────────────────────────
|
|
264
264
|
async listDeletionReceipts(runId) {
|
|
265
265
|
this.requireAPIKey();
|
|
266
266
|
if (runId <= 0) throw new VerdifaxError("verdifax: runId must be > 0");
|
|
@@ -342,7 +342,7 @@ var VerdifaxClient = class {
|
|
|
342
342
|
}
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
|
-
// ── HTTP plumbing
|
|
345
|
+
// ── HTTP plumbing, retry-aware ──────────────────────────────
|
|
346
346
|
async request(method, path, body) {
|
|
347
347
|
const url = this.baseURL + path;
|
|
348
348
|
const headers = {
|
package/dist/index.mjs
CHANGED
|
@@ -116,7 +116,7 @@ var VerdifaxClient = class {
|
|
|
116
116
|
return this.request("POST", "/execute", req);
|
|
117
117
|
}
|
|
118
118
|
/** High-level convenience wrapper around `execute()`. Accepts
|
|
119
|
-
* either a Buffer (for binary payloads
|
|
119
|
+
* either a Buffer (for binary payloads, auto-base64) or a
|
|
120
120
|
* string (for plain text). Validates the hex fields and
|
|
121
121
|
* routes the call through to the canonical /execute. */
|
|
122
122
|
async attest(req) {
|
|
@@ -226,7 +226,7 @@ var VerdifaxClient = class {
|
|
|
226
226
|
const buf = await resp.arrayBuffer();
|
|
227
227
|
return Buffer.from(buf);
|
|
228
228
|
}
|
|
229
|
-
// ── CRES
|
|
229
|
+
// ── CRES, deletion receipts (auth) ──────────────────────────
|
|
230
230
|
async listDeletionReceipts(runId) {
|
|
231
231
|
this.requireAPIKey();
|
|
232
232
|
if (runId <= 0) throw new VerdifaxError("verdifax: runId must be > 0");
|
|
@@ -308,7 +308,7 @@ var VerdifaxClient = class {
|
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
|
-
// ── HTTP plumbing
|
|
311
|
+
// ── HTTP plumbing, retry-aware ──────────────────────────────
|
|
312
312
|
async request(method, path, body) {
|
|
313
313
|
const url = this.baseURL + path;
|
|
314
314
|
const headers = {
|