@certkor/certone 0.0.0-stage → 0.1.1

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.
Files changed (103) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +140 -2
  3. package/dist/cjs/binary.d.ts +8 -0
  4. package/dist/cjs/binary.d.ts.map +1 -0
  5. package/dist/cjs/binary.js +39 -0
  6. package/dist/cjs/binary.js.map +1 -0
  7. package/dist/cjs/client.d.ts +66 -0
  8. package/dist/cjs/client.d.ts.map +1 -0
  9. package/dist/cjs/client.js +401 -0
  10. package/dist/cjs/client.js.map +1 -0
  11. package/dist/cjs/common.d.ts +7 -0
  12. package/dist/cjs/common.d.ts.map +1 -0
  13. package/dist/cjs/common.js +22 -0
  14. package/dist/cjs/common.js.map +1 -0
  15. package/dist/cjs/errors.d.ts +53 -0
  16. package/dist/cjs/errors.d.ts.map +1 -0
  17. package/dist/cjs/errors.js +74 -0
  18. package/dist/cjs/errors.js.map +1 -0
  19. package/dist/cjs/index.d.ts +8 -0
  20. package/dist/cjs/index.d.ts.map +1 -0
  21. package/dist/cjs/index.js +27 -0
  22. package/dist/cjs/index.js.map +1 -0
  23. package/dist/cjs/index.node.d.ts +7 -0
  24. package/dist/cjs/index.node.d.ts.map +1 -0
  25. package/dist/cjs/index.node.js +26 -0
  26. package/dist/cjs/index.node.js.map +1 -0
  27. package/dist/cjs/package.json +1 -0
  28. package/dist/cjs/sha256.d.ts +13 -0
  29. package/dist/cjs/sha256.d.ts.map +1 -0
  30. package/dist/cjs/sha256.js +25 -0
  31. package/dist/cjs/sha256.js.map +1 -0
  32. package/dist/cjs/sha256.node.d.ts +13 -0
  33. package/dist/cjs/sha256.node.d.ts.map +1 -0
  34. package/dist/cjs/sha256.node.js +40 -0
  35. package/dist/cjs/sha256.node.js.map +1 -0
  36. package/dist/cjs/types.d.ts +234 -0
  37. package/dist/cjs/types.d.ts.map +1 -0
  38. package/dist/cjs/types.js +12 -0
  39. package/dist/cjs/types.js.map +1 -0
  40. package/dist/cjs/validate.d.ts +24 -0
  41. package/dist/cjs/validate.d.ts.map +1 -0
  42. package/dist/cjs/validate.js +202 -0
  43. package/dist/cjs/validate.js.map +1 -0
  44. package/dist/cjs/version.d.ts +3 -0
  45. package/dist/cjs/version.d.ts.map +1 -0
  46. package/dist/cjs/version.js +6 -0
  47. package/dist/cjs/version.js.map +1 -0
  48. package/dist/esm/binary.d.ts +8 -0
  49. package/dist/esm/binary.d.ts.map +1 -0
  50. package/dist/esm/binary.js +34 -0
  51. package/dist/esm/binary.js.map +1 -0
  52. package/dist/esm/client.d.ts +66 -0
  53. package/dist/esm/client.d.ts.map +1 -0
  54. package/dist/esm/client.js +397 -0
  55. package/dist/esm/client.js.map +1 -0
  56. package/dist/esm/common.d.ts +7 -0
  57. package/dist/esm/common.d.ts.map +1 -0
  58. package/dist/esm/common.js +6 -0
  59. package/dist/esm/common.js.map +1 -0
  60. package/dist/esm/errors.d.ts +53 -0
  61. package/dist/esm/errors.d.ts.map +1 -0
  62. package/dist/esm/errors.js +69 -0
  63. package/dist/esm/errors.js.map +1 -0
  64. package/dist/esm/index.d.ts +8 -0
  65. package/dist/esm/index.d.ts.map +1 -0
  66. package/dist/esm/index.js +8 -0
  67. package/dist/esm/index.js.map +1 -0
  68. package/dist/esm/index.node.d.ts +7 -0
  69. package/dist/esm/index.node.d.ts.map +1 -0
  70. package/dist/esm/index.node.js +7 -0
  71. package/dist/esm/index.node.js.map +1 -0
  72. package/dist/esm/sha256.d.ts +13 -0
  73. package/dist/esm/sha256.d.ts.map +1 -0
  74. package/dist/esm/sha256.js +21 -0
  75. package/dist/esm/sha256.js.map +1 -0
  76. package/dist/esm/sha256.node.d.ts +13 -0
  77. package/dist/esm/sha256.node.d.ts.map +1 -0
  78. package/dist/esm/sha256.node.js +36 -0
  79. package/dist/esm/sha256.node.js.map +1 -0
  80. package/dist/esm/types.d.ts +234 -0
  81. package/dist/esm/types.d.ts.map +1 -0
  82. package/dist/esm/types.js +11 -0
  83. package/dist/esm/types.js.map +1 -0
  84. package/dist/esm/validate.d.ts +24 -0
  85. package/dist/esm/validate.d.ts.map +1 -0
  86. package/dist/esm/validate.js +193 -0
  87. package/dist/esm/validate.js.map +1 -0
  88. package/dist/esm/version.d.ts +3 -0
  89. package/dist/esm/version.d.ts.map +1 -0
  90. package/dist/esm/version.js +3 -0
  91. package/dist/esm/version.js.map +1 -0
  92. package/package.json +83 -4
  93. package/src/binary.ts +35 -0
  94. package/src/client.ts +480 -0
  95. package/src/common.ts +48 -0
  96. package/src/errors.ts +105 -0
  97. package/src/index.node.ts +6 -0
  98. package/src/index.ts +7 -0
  99. package/src/sha256.node.ts +36 -0
  100. package/src/sha256.ts +26 -0
  101. package/src/types.ts +260 -0
  102. package/src/validate.ts +214 -0
  103. package/src/version.ts +2 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,8CAA4B;AAC5B,yCAAqD;AAA5C,wGAAA,WAAW,OAAA;AAAE,sGAAA,SAAS,OAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `@certkor/certone` for Node.js (selected by the `node` export condition). Identical API to the
3
+ * browser entry; SHA-256 uses `node:crypto` so it works on Node 18 and streams large Blobs.
4
+ */
5
+ export * from "./common.js";
6
+ export { inputDigest, sha256Hex } from "./sha256.node.js";
7
+ //# sourceMappingURL=index.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../../src/index.node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.sha256Hex = exports.inputDigest = void 0;
18
+ /**
19
+ * `@certkor/certone` for Node.js (selected by the `node` export condition). Identical API to the
20
+ * browser entry; SHA-256 uses `node:crypto` so it works on Node 18 and streams large Blobs.
21
+ */
22
+ __exportStar(require("./common.js"), exports);
23
+ var sha256_node_js_1 = require("./sha256.node.js");
24
+ Object.defineProperty(exports, "inputDigest", { enumerable: true, get: function () { return sha256_node_js_1.inputDigest; } });
25
+ Object.defineProperty(exports, "sha256Hex", { enumerable: true, get: function () { return sha256_node_js_1.sha256Hex; } });
26
+ //# sourceMappingURL=index.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.node.js","sourceRoot":"","sources":["../../src/index.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,8CAA4B;AAC5B,mDAA0D;AAAjD,6GAAA,WAAW,OAAA;AAAE,2GAAA,SAAS,OAAA"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * SHA-256 via the Web Crypto API (browsers, Deno, Bun, Node.js >= 19 global `crypto`).
3
+ * The Node.js entry point replaces this with `node:crypto`, which also streams Blobs.
4
+ */
5
+ import type { BinaryInput } from "./types.js";
6
+ /** Hex-encoded SHA-256 of the input bytes. */
7
+ export declare function sha256Hex(data: BinaryInput): Promise<string>;
8
+ /**
9
+ * The `input_digest` for `ingestReport`: `sha256:<hex>` over the exact snapshot bytes, which binds
10
+ * the attestation to that input.
11
+ */
12
+ export declare function inputDigest(data: BinaryInput): Promise<string>;
13
+ //# sourceMappingURL=sha256.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["../../src/sha256.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,8CAA8C;AAC9C,wBAAsB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAQlE;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAEpE"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * SHA-256 via the Web Crypto API (browsers, Deno, Bun, Node.js >= 19 global `crypto`).
4
+ * The Node.js entry point replaces this with `node:crypto`, which also streams Blobs.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.sha256Hex = sha256Hex;
8
+ exports.inputDigest = inputDigest;
9
+ const binary_js_1 = require("./binary.js");
10
+ /** Hex-encoded SHA-256 of the input bytes. */
11
+ async function sha256Hex(data) {
12
+ const subtle = globalThis.crypto?.subtle;
13
+ if (subtle === undefined) {
14
+ throw new TypeError("Web Crypto (crypto.subtle) is unavailable: use a secure context (https) or the Node.js build");
15
+ }
16
+ return (0, binary_js_1.toHex)(await subtle.digest("SHA-256", await (0, binary_js_1.toBytes)(data)));
17
+ }
18
+ /**
19
+ * The `input_digest` for `ingestReport`: `sha256:<hex>` over the exact snapshot bytes, which binds
20
+ * the attestation to that input.
21
+ */
22
+ async function inputDigest(data) {
23
+ return `sha256:${await sha256Hex(data)}`;
24
+ }
25
+ //# sourceMappingURL=sha256.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.js","sourceRoot":"","sources":["../../src/sha256.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAMH,8BAQC;AAMD,kCAEC;AApBD,2CAA6C;AAG7C,8CAA8C;AACvC,KAAK,UAAU,SAAS,CAAC,IAAiB;IAC/C,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC;IACzC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,SAAS,CACjB,8FAA8F,CAC/F,CAAC;IACJ,CAAC;IACD,OAAO,IAAA,iBAAK,EAAC,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,IAAiB;IACjD,OAAO,UAAU,MAAM,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * SHA-256 via `node:crypto`: works on every supported Node.js release (Node 18 has no global
3
+ * `crypto`) and hashes Blobs as a stream, so large snapshots are not buffered twice.
4
+ */
5
+ import type { BinaryInput } from "./types.js";
6
+ /** Hex-encoded SHA-256 of the input bytes. */
7
+ export declare function sha256Hex(data: BinaryInput): Promise<string>;
8
+ /**
9
+ * The `input_digest` for `ingestReport`: `sha256:<hex>` over the exact snapshot bytes, which binds
10
+ * the attestation to that input.
11
+ */
12
+ export declare function inputDigest(data: BinaryInput): Promise<string>;
13
+ //# sourceMappingURL=sha256.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.node.d.ts","sourceRoot":"","sources":["../../src/sha256.node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,8CAA8C;AAC9C,wBAAsB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBlE;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAEpE"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * SHA-256 via `node:crypto`: works on every supported Node.js release (Node 18 has no global
4
+ * `crypto`) and hashes Blobs as a stream, so large snapshots are not buffered twice.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.sha256Hex = sha256Hex;
8
+ exports.inputDigest = inputDigest;
9
+ const node_crypto_1 = require("node:crypto");
10
+ /** Hex-encoded SHA-256 of the input bytes. */
11
+ async function sha256Hex(data) {
12
+ const hash = (0, node_crypto_1.createHash)("sha256");
13
+ if (data instanceof Blob) {
14
+ const reader = data.stream().getReader();
15
+ for (;;) {
16
+ const { done, value } = await reader.read();
17
+ if (done)
18
+ break;
19
+ hash.update(value);
20
+ }
21
+ }
22
+ else if (data instanceof ArrayBuffer) {
23
+ hash.update(new Uint8Array(data));
24
+ }
25
+ else if (ArrayBuffer.isView(data)) {
26
+ hash.update(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
27
+ }
28
+ else {
29
+ throw new TypeError("expected a Blob, ArrayBuffer or ArrayBufferView (Uint8Array, Buffer, ...)");
30
+ }
31
+ return hash.digest("hex");
32
+ }
33
+ /**
34
+ * The `input_digest` for `ingestReport`: `sha256:<hex>` over the exact snapshot bytes, which binds
35
+ * the attestation to that input.
36
+ */
37
+ async function inputDigest(data) {
38
+ return `sha256:${await sha256Hex(data)}`;
39
+ }
40
+ //# sourceMappingURL=sha256.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.node.js","sourceRoot":"","sources":["../../src/sha256.node.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAOH,8BAiBC;AAMD,kCAEC;AA9BD,6CAAyC;AAIzC,8CAA8C;AACvC,KAAK,UAAU,SAAS,CAAC,IAAiB;IAC/C,MAAM,IAAI,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC;QACzC,SAAS,CAAC;YACR,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAC5C,IAAI,IAAI;gBAAE,MAAM;YAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;SAAM,IAAI,IAAI,YAAY,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;SAAM,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7E,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,SAAS,CAAC,2EAA2E,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,IAAiB;IACjD,OAAO,UAAU,MAAM,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,234 @@
1
+ /**
2
+ * Wire types for the CertOne control-plane API.
3
+ *
4
+ * Response objects keep the API's snake_case field names, exactly as documented in
5
+ * `SPEC.md` and the conformance fixtures, so they can be logged, stored and compared with the
6
+ * REST payloads one-to-one. Timestamps are ISO-8601 strings as sent by the API. Unions that the
7
+ * server may extend (for example scan statuses) accept any string while still offering the known
8
+ * values to editors.
9
+ */
10
+ /** A string union that still accepts values a newer control plane may introduce. */
11
+ export type OpenUnion<T extends string> = T | (string & Record<never, never>);
12
+ /** Lifecycle of a scan run. `succeeded` and `failed` are terminal. */
13
+ export type ScanStatus = OpenUnion<"queued" | "running" | "succeeded" | "failed">;
14
+ export type ScanKind = OpenUnion<"check" | "process" | "correct">;
15
+ /** Engine verdict for a report. */
16
+ export type VerdictStatus = OpenUnion<"pass" | "fail">;
17
+ export type Severity = OpenUnion<"low" | "medium" | "high">;
18
+ /** Lowest severity that makes the verdict fail; `none` never fails. */
19
+ export type FailOn = "low" | "medium" | "high" | "none";
20
+ /** The surface a submission came from (the server maps unknown values to `api`). */
21
+ export type Environment = "ci" | "jupyter" | "vscode" | "edge" | "api" | "cloud" | "cli";
22
+ /** `GET /v1/scans/{id}` (fixture `scan.json`). */
23
+ export interface ScanRun {
24
+ readonly id: string;
25
+ readonly kind: ScanKind;
26
+ readonly status: ScanStatus;
27
+ readonly snapshot_ref: string | null;
28
+ readonly created_by: string | null;
29
+ readonly created_at: string;
30
+ readonly finished_at: string | null;
31
+ /** Why the scan failed, when `status === "failed"`. */
32
+ readonly error: string | null;
33
+ }
34
+ /**
35
+ * A report record (fixture `report.json`). `id` is the record id used by `getReportDocument` and
36
+ * `getAttestation`; `report_id` is the engine's own report identifier.
37
+ */
38
+ export interface Report {
39
+ readonly id: string;
40
+ readonly scan_run_id: string;
41
+ readonly report_id: string;
42
+ readonly verdict_status: VerdictStatus;
43
+ readonly fail_on: FailOn;
44
+ readonly total_issues: number;
45
+ readonly by_severity: Readonly<Record<string, number>>;
46
+ readonly country_code: string | null;
47
+ readonly created_at: string;
48
+ }
49
+ /** `POST /v1/checks` and `POST /v1/checks/report` (fixtures `check_result.json`, `ingest_result.json`). */
50
+ export interface CheckResult {
51
+ readonly scan_run: ScanRun;
52
+ /** `null` when the submission was queued for the worker pool: use `waitForReport(scan_run.id)`. */
53
+ readonly report: Report | null;
54
+ readonly queued: boolean;
55
+ }
56
+ /** `POST /v1/process`: a `CheckResult` plus the processing unit's job telemetry when it ran inline. */
57
+ export interface ProcessResult extends CheckResult {
58
+ readonly jobs?: Readonly<Record<string, number>>;
59
+ readonly health?: Readonly<Record<string, unknown>>;
60
+ readonly energy?: Readonly<Record<string, number>>;
61
+ }
62
+ /** One regulatory citation attached to an issue. */
63
+ export interface RegulatoryReference {
64
+ readonly framework: string;
65
+ readonly article?: string;
66
+ readonly [key: string]: unknown;
67
+ }
68
+ /** One finding in the engine report document (`compliance-issue.schema.json`). */
69
+ export interface ReportIssue {
70
+ readonly issue_id: string;
71
+ readonly description: string;
72
+ readonly severity: Severity;
73
+ readonly detected_by: string;
74
+ readonly compliance_topic?: string;
75
+ /** The AI-system component the issue concerns (input | model | output | pipeline | config). */
76
+ readonly component?: string;
77
+ readonly regulatory_references: readonly RegulatoryReference[];
78
+ readonly location: Readonly<Record<string, unknown>>;
79
+ readonly suggested_fix?: string;
80
+ readonly rule_path?: string;
81
+ readonly [key: string]: unknown;
82
+ }
83
+ export interface ReportVerdict {
84
+ readonly status: VerdictStatus;
85
+ readonly fail_on: FailOn;
86
+ readonly reason?: string;
87
+ readonly [key: string]: unknown;
88
+ }
89
+ export interface ReportSummary {
90
+ readonly total_issues: number;
91
+ readonly by_severity: Readonly<Record<string, number>>;
92
+ readonly by_topic?: Readonly<Record<string, number>>;
93
+ readonly by_component?: Readonly<Record<string, number>>;
94
+ readonly rules_evaluated?: number;
95
+ readonly rules_triggered?: number;
96
+ readonly [key: string]: unknown;
97
+ }
98
+ /**
99
+ * The full engine report (`GET /v1/reports/{id}/document`, fixture `report_document_excerpt.json`).
100
+ * Only the stable core is typed; every other section is available as `unknown`.
101
+ */
102
+ export interface ReportDocument {
103
+ readonly report_id: string;
104
+ readonly verdict: ReportVerdict;
105
+ readonly summary: ReportSummary;
106
+ readonly issues: readonly ReportIssue[];
107
+ readonly [key: string]: unknown;
108
+ }
109
+ /**
110
+ * The conditional compliance attestation for a passing report
111
+ * (`GET /v1/reports/{id}/attestation`, fixture `attestation.json`).
112
+ */
113
+ export interface Attestation {
114
+ readonly attestation_id: string;
115
+ readonly input_version: string;
116
+ readonly issued_at: string;
117
+ readonly signature: string;
118
+ readonly signature_algorithm: string;
119
+ readonly test_status?: Readonly<Record<string, unknown>>;
120
+ readonly issuance?: Readonly<Record<string, unknown>>;
121
+ readonly conditional_validity?: {
122
+ readonly valid: boolean;
123
+ readonly covers?: readonly string[];
124
+ readonly [key: string]: unknown;
125
+ };
126
+ readonly fingerprint?: {
127
+ readonly algorithm: string;
128
+ readonly value: string;
129
+ readonly [key: string]: unknown;
130
+ };
131
+ readonly log?: readonly unknown[];
132
+ readonly [key: string]: unknown;
133
+ }
134
+ /** An AI system and its rolled-up posture (`GET /v1/systems`, fixture `systems.json`). */
135
+ export interface AISystem {
136
+ readonly id: string;
137
+ readonly slug: string;
138
+ readonly name: string;
139
+ readonly lifecycle: string;
140
+ readonly owner_team_id: string | null;
141
+ readonly description: string | null;
142
+ readonly created_at: string;
143
+ readonly regions: readonly string[];
144
+ readonly environments: readonly string[];
145
+ readonly standards: readonly string[];
146
+ readonly scans: number;
147
+ readonly open_issues: number;
148
+ readonly last_verdict: VerdictStatus | null;
149
+ readonly attested: boolean;
150
+ readonly attestation_status: OpenUnion<"valid" | "revoked" | "none">;
151
+ readonly risk: OpenUnion<"low" | "medium" | "high" | "unknown">;
152
+ readonly last_evaluated: string | null;
153
+ }
154
+ /**
155
+ * A snapshot or any other binary input: a `Blob` (or `File`), an `ArrayBuffer`, or a typed-array
156
+ * view such as `Uint8Array` (a Node.js `Buffer` is one).
157
+ */
158
+ export type BinaryInput = Blob | ArrayBuffer | ArrayBufferView;
159
+ /** Per-call transport options accepted by every operation. */
160
+ export interface RequestOptions {
161
+ /** Cancels the call; the promise rejects with a `CertOneError` of kind `aborted`. */
162
+ readonly signal?: AbortSignal | undefined;
163
+ /** Overrides the client's per-request timeout (milliseconds) for this call. */
164
+ readonly timeoutMs?: number | undefined;
165
+ }
166
+ /** Multipart form fields for `submitCheck` (all optional; the server applies the defaults shown). */
167
+ export interface ScanOptions extends RequestOptions {
168
+ /** AI system name (auto-registered on first scan). Default: derived by the server. */
169
+ readonly asset?: string | undefined;
170
+ /** Default `api`. */
171
+ readonly environment?: Environment | undefined;
172
+ /** Origin region, for example `EU` or `US`. Default `ZZ`. */
173
+ readonly countryCode?: string | undefined;
174
+ /** Default `high`. */
175
+ readonly failOn?: FailOn | undefined;
176
+ /** Policy packs (array or comma-separated). Default: auto-matched from the AI BOM. */
177
+ readonly packs?: string | readonly string[] | undefined;
178
+ /** Stable source reference, for example `git:org/repo@sha`. */
179
+ readonly snapshotRef?: string | undefined;
180
+ /** Commit the scan is about. */
181
+ readonly commitHash?: string | undefined;
182
+ /** File name sent for the `snapshot` part. Default `snapshot.tar.gz`. */
183
+ readonly filename?: string | undefined;
184
+ }
185
+ /** `submitProcess` options: the scan options plus the confidential-compute backend. */
186
+ export interface ProcessOptions extends ScanOptions {
187
+ /** Confidential-compute backend id (`GET /v1/capabilities/tee`). Default `amd_sev_snp`. */
188
+ readonly tee?: OpenUnion<"amd_sev_snp" | "intel_tdx"> | undefined;
189
+ }
190
+ /** Fields sent with a run-at-source report (`POST /v1/checks/report`). */
191
+ export interface IngestOptions extends RequestOptions {
192
+ readonly asset?: string | undefined;
193
+ /** Default `api`. */
194
+ readonly environment?: Environment | undefined;
195
+ /** Default `ZZ`. */
196
+ readonly countryCode?: string | undefined;
197
+ readonly snapshotRef?: string | undefined;
198
+ /**
199
+ * `sha256:<hex>` of the exact artifact the report covers; binds the attestation to that input.
200
+ * Compute it with `inputDigest(snapshotBytes)`.
201
+ */
202
+ readonly inputDigest?: string | undefined;
203
+ /** Repository full name (`owner/name`) the report is about. */
204
+ readonly repo?: string | undefined;
205
+ readonly commitHash?: string | undefined;
206
+ }
207
+ /** `waitForReport` options. */
208
+ export interface WaitOptions {
209
+ /** Overall deadline in milliseconds. Default 900 000 (15 min). */
210
+ readonly timeoutMs?: number | undefined;
211
+ /** Delay between polls in milliseconds. Default 2 000. */
212
+ readonly intervalMs?: number | undefined;
213
+ /** Cancels the wait; rejects with a `CertOneError` of kind `aborted`. */
214
+ readonly signal?: AbortSignal | undefined;
215
+ /** Per-poll request timeout; defaults to the client's request timeout. */
216
+ readonly requestTimeoutMs?: number | undefined;
217
+ }
218
+ /** A `fetch`-compatible function (inject one for tests, proxies, retries or custom TLS agents). */
219
+ export type FetchLike = (input: string, init: RequestInit) => Promise<Response>;
220
+ /** Supplies the bearer token per request, so short-lived OIDC tokens can be refreshed. */
221
+ export type TokenProvider = () => string | Promise<string>;
222
+ export interface CertOneClientOptions {
223
+ /** Control-plane base URL, for example `https://api.yourco.com`. */
224
+ readonly baseUrl: string;
225
+ /** Tenant API key (`ck_...`) or OIDC ID token, or a function returning one. Never logged. */
226
+ readonly token?: string | TokenProvider | undefined;
227
+ /** Per-request timeout in milliseconds. Default 30 000. */
228
+ readonly timeoutMs?: number | undefined;
229
+ /** `fetch` implementation. Default: the global `fetch` (Node >= 18, browsers). */
230
+ readonly fetch?: FetchLike | undefined;
231
+ /** Extra headers sent with every request (for example tracing or proxy headers). */
232
+ readonly headers?: Readonly<Record<string, string>> | undefined;
233
+ }
234
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oFAAoF;AACpF,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAE9E,sEAAsE;AACtE,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC,CAAC;AAElF,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;AAElE,mCAAmC;AACnC,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,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AA+B;AAC/B,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC1C,0EAA0E;IAC1E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChD;AAED,mGAAmG;AACnG,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEhF,0FAA0F;AAC1F,MAAM,MAAM,aAAa,GAAG,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,6FAA6F;IAC7F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IACpD,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,kFAAkF;IAClF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACvC,oFAAoF;IACpF,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;CACjE"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Wire types for the CertOne control-plane API.
4
+ *
5
+ * Response objects keep the API's snake_case field names, exactly as documented in
6
+ * `SPEC.md` and the conformance fixtures, so they can be logged, stored and compared with the
7
+ * REST payloads one-to-one. Timestamps are ISO-8601 strings as sent by the API. Unions that the
8
+ * server may extend (for example scan statuses) accept any string while still offering the known
9
+ * values to editors.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Runtime checks for API responses.
3
+ *
4
+ * A 2xx body that does not have the documented shape (a misrouted proxy, an incompatible control
5
+ * plane version) is rejected with `CertOneError(kind: "invalid_response")` at the SDK boundary
6
+ * instead of surfacing later as an `undefined` deep inside the caller's code. Only the documented,
7
+ * stable fields are checked; additional fields are kept as-is so newer servers stay compatible.
8
+ */
9
+ import type { AISystem, Attestation, CheckResult, ProcessResult, Report, ReportDocument, ScanRun } from "./types.js";
10
+ /** Validate a `GET /v1/scans/{id}` body. */
11
+ export declare function parseScanRun(value: unknown): ScanRun;
12
+ /** Validate a report record (`GET /v1/scans/{id}/report`, `GET /v1/reports/{id}`). */
13
+ export declare function parseReport(value: unknown): Report;
14
+ /** Validate a `POST /v1/checks` or `POST /v1/checks/report` body. */
15
+ export declare function parseCheckResult(value: unknown): CheckResult;
16
+ /** Validate a `POST /v1/process` body. */
17
+ export declare function parseProcessResult(value: unknown): ProcessResult;
18
+ /** Validate the core of a full engine report document (`GET /v1/reports/{id}/document`). */
19
+ export declare function parseReportDocument(value: unknown): ReportDocument;
20
+ /** Validate a `GET /v1/reports/{id}/attestation` body. */
21
+ export declare function parseAttestation(value: unknown): Attestation;
22
+ /** Validate a `GET /v1/systems` body. */
23
+ export declare function parseSystems(value: unknown): AISystem[];
24
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,aAAa,EACb,MAAM,EACN,cAAc,EACd,OAAO,EACR,MAAM,YAAY,CAAC;AAoGpB,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEpD;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAElD;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAE5D;AAED,0CAA0C;AAC1C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAEhE;AAED,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CA0BlE;AAED,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAkB5D;AAED,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,EAAE,CAwBvD"}