@antseed/antseed-verifier 0.1.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.
Files changed (83) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +86 -0
  3. package/dist/adapters/aci.d.ts +4 -0
  4. package/dist/adapters/aci.d.ts.map +1 -0
  5. package/dist/adapters/aci.js +42 -0
  6. package/dist/adapters/aci.js.map +1 -0
  7. package/dist/adapters/chutes.d.ts +4 -0
  8. package/dist/adapters/chutes.d.ts.map +1 -0
  9. package/dist/adapters/chutes.js +72 -0
  10. package/dist/adapters/chutes.js.map +1 -0
  11. package/dist/adapters/index.d.ts +26 -0
  12. package/dist/adapters/index.d.ts.map +1 -0
  13. package/dist/adapters/index.js +19 -0
  14. package/dist/adapters/index.js.map +1 -0
  15. package/dist/antseed-node-types.d.ts +55 -0
  16. package/dist/antseed-node-types.d.ts.map +1 -0
  17. package/dist/antseed-node-types.js +8 -0
  18. package/dist/antseed-node-types.js.map +1 -0
  19. package/dist/capability.d.ts +50 -0
  20. package/dist/capability.d.ts.map +1 -0
  21. package/dist/capability.js +15 -0
  22. package/dist/capability.js.map +1 -0
  23. package/dist/caps/gpu-nvidia.d.ts +66 -0
  24. package/dist/caps/gpu-nvidia.d.ts.map +1 -0
  25. package/dist/caps/gpu-nvidia.js +142 -0
  26. package/dist/caps/gpu-nvidia.js.map +1 -0
  27. package/dist/caps/index.d.ts +7 -0
  28. package/dist/caps/index.d.ts.map +1 -0
  29. package/dist/caps/index.js +21 -0
  30. package/dist/caps/index.js.map +1 -0
  31. package/dist/caps/measured-image.d.ts +14 -0
  32. package/dist/caps/measured-image.d.ts.map +1 -0
  33. package/dist/caps/measured-image.js +46 -0
  34. package/dist/caps/measured-image.js.map +1 -0
  35. package/dist/caps/provider-claims.d.ts +52 -0
  36. package/dist/caps/provider-claims.d.ts.map +1 -0
  37. package/dist/caps/provider-claims.js +195 -0
  38. package/dist/caps/provider-claims.js.map +1 -0
  39. package/dist/caps/seller-bound.d.ts +9 -0
  40. package/dist/caps/seller-bound.d.ts.map +1 -0
  41. package/dist/caps/seller-bound.js +104 -0
  42. package/dist/caps/seller-bound.js.map +1 -0
  43. package/dist/caps/tee-tdx.d.ts +107 -0
  44. package/dist/caps/tee-tdx.d.ts.map +1 -0
  45. package/dist/caps/tee-tdx.js +210 -0
  46. package/dist/caps/tee-tdx.js.map +1 -0
  47. package/dist/collect/configfs.d.ts +6 -0
  48. package/dist/collect/configfs.d.ts.map +1 -0
  49. package/dist/collect/configfs.js +38 -0
  50. package/dist/collect/configfs.js.map +1 -0
  51. package/dist/collect/dstack.d.ts +8 -0
  52. package/dist/collect/dstack.d.ts.map +1 -0
  53. package/dist/collect/dstack.js +79 -0
  54. package/dist/collect/dstack.js.map +1 -0
  55. package/dist/collect/http.d.ts +25 -0
  56. package/dist/collect/http.d.ts.map +1 -0
  57. package/dist/collect/http.js +83 -0
  58. package/dist/collect/http.js.map +1 -0
  59. package/dist/index.d.ts +33 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +40 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/nras.d.ts +81 -0
  64. package/dist/nras.d.ts.map +1 -0
  65. package/dist/nras.js +190 -0
  66. package/dist/nras.js.map +1 -0
  67. package/dist/prover.d.ts +5 -0
  68. package/dist/prover.d.ts.map +1 -0
  69. package/dist/prover.js +204 -0
  70. package/dist/prover.js.map +1 -0
  71. package/dist/report-data.d.ts +47 -0
  72. package/dist/report-data.d.ts.map +1 -0
  73. package/dist/report-data.js +111 -0
  74. package/dist/report-data.js.map +1 -0
  75. package/dist/shared.d.ts +89 -0
  76. package/dist/shared.d.ts.map +1 -0
  77. package/dist/shared.js +158 -0
  78. package/dist/shared.js.map +1 -0
  79. package/dist/verifier.d.ts +21 -0
  80. package/dist/verifier.d.ts.map +1 -0
  81. package/dist/verifier.js +149 -0
  82. package/dist/verifier.js.map +1 -0
  83. package/package.json +42 -0
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Generic HTTP collector: it fetches a TDX quote from a seller-configured attestation endpoint.
3
+ * Everything provider-specific (host, path, JSON location of the quote) comes from the caller
4
+ * — no hardcoded hosts or schemas — so any HTTP attestation service wires up through config
5
+ * alone. The {nonce} placeholder in `urlTemplate` is replaced with the hex nonce. `field` is a
6
+ * dot-path to the base64 quote in the response (e.g. "quote" or "data.quote").
7
+ */
8
+ /** Resolve a dot-separated path (e.g. "data.quote") against a parsed JSON value. */
9
+ function pluck(obj, path) {
10
+ return path.split('.').reduce((acc, key) => {
11
+ if (acc && typeof acc === 'object' && key in acc) {
12
+ return acc[key];
13
+ }
14
+ return undefined;
15
+ }, obj);
16
+ }
17
+ /** Hard timeout on an outbound evidence fetch — a hung or slow provider cannot stall the round. */
18
+ const FETCH_TIMEOUT_MS = 20_000;
19
+ /** Reject an over-large declared response body so a hostile endpoint cannot force an OOM parse. */
20
+ const MAX_RESPONSE_BYTES = 4 * 1024 * 1024;
21
+ /** Replace {nonce}, fetch with a timeout and size guard, then parse JSON. */
22
+ async function fetchAttestJson(urlTemplate, nonce) {
23
+ const url = urlTemplate.replace(/\{nonce\}/g, Buffer.from(nonce).toString('hex'));
24
+ const resp = await fetch(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
25
+ if (!resp.ok) {
26
+ throw new Error(`http attestation endpoint returned HTTP ${resp.status}`);
27
+ }
28
+ const declared = Number(resp.headers?.get('content-length') ?? '0');
29
+ if (declared > MAX_RESPONSE_BYTES) {
30
+ throw new Error(`http attestation response too large (${declared} bytes)`);
31
+ }
32
+ return resp.json();
33
+ }
34
+ /**
35
+ * Fetch the provider evidence route once. It returns the base64-decoded quote and, when a pubkey
36
+ * field is named, the report_data-binding pubkey string. One fetch keeps the quote and the pubkey
37
+ * from the same response — a two-fetch split could pair a quote with a different instance's key.
38
+ */
39
+ export async function collectTdxAndPubkey(urlTemplate, nonce, quoteField, pubkeyField) {
40
+ const json = await fetchAttestJson(urlTemplate, nonce);
41
+ const q = pluck(json, quoteField);
42
+ if (typeof q !== 'string' || q.length === 0) {
43
+ throw new Error(`http attestation response has no base64 quote at "${quoteField}"`);
44
+ }
45
+ const quote = new Uint8Array(Buffer.from(q, 'base64'));
46
+ if (quote.length === 0) {
47
+ throw new Error(`http attestation quote at "${quoteField}" is not valid base64`);
48
+ }
49
+ if (!pubkeyField)
50
+ return { quote };
51
+ const pk = pluck(json, pubkeyField);
52
+ if (typeof pk !== 'string' || pk.length === 0) {
53
+ throw new Error(`http attestation response has no string at "${pubkeyField}"`);
54
+ }
55
+ return { quote, pubkey: pk };
56
+ }
57
+ export async function collectViaHttp(urlTemplate, nonce, field) {
58
+ const json = await fetchAttestJson(urlTemplate, nonce);
59
+ const value = pluck(json, field);
60
+ if (typeof value !== 'string' || value.length === 0) {
61
+ throw new Error(`http attestation response has no base64 quote at "${field}"`);
62
+ }
63
+ const quote = new Uint8Array(Buffer.from(value, 'base64'));
64
+ if (quote.length === 0) {
65
+ throw new Error(`http attestation quote at "${field}" is not valid base64`);
66
+ }
67
+ return quote;
68
+ }
69
+ /**
70
+ * Like collectViaHttp, but it returns the extracted field re-encoded as JSON bytes instead of
71
+ * base64-decoding it. Why separate: the TDX path wants a lone base64 quote decoded to raw bytes;
72
+ * the GPU path's field holds a structured value (e.g. { arch, evidence_list }) whose shape must
73
+ * survive intact to the NRAS submit, so the code keeps it as JSON rather than decode it.
74
+ */
75
+ export async function collectJsonFieldViaHttp(urlTemplate, nonce, field) {
76
+ const json = await fetchAttestJson(urlTemplate, nonce);
77
+ const value = pluck(json, field);
78
+ if (value === undefined || value === null) {
79
+ throw new Error(`http attestation response has no value at "${field}"`);
80
+ }
81
+ return new TextEncoder().encode(JSON.stringify(value));
82
+ }
83
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/collect/http.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oFAAoF;AACpF,SAAS,KAAK,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AK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,qDAAqD,KAAK,GAAG,CAAC,CAAA;IAChF,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC1D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,8BAA8B,KAAK,uBAAuB,CAAC,CAAA;IAC7E,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,WAAmB,EACnB,KAAiB,EACjB,KAAa;IAEb,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IACtD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAChC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,8CAA8C,KAAK,GAAG,CAAC,CAAA;IACzE,CAAC;IACD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;AACxD,CAAC"}
@@ -0,0 +1,33 @@
1
+ import verifierPlugin from './verifier.js';
2
+ /**
3
+ * One package, two halves — both named `antseed-verifier`. The monorepo
4
+ * plugin loader imports this module and picks the export matching the requested kind:
5
+ * - type:'verifier' -> the default export (buyer half)
6
+ * - type:'prover' -> the `prover` export (seller half; embedded, not a provider)
7
+ */
8
+ export default verifierPlugin;
9
+ export declare const prover: import("./antseed-node-types.js").Prover;
10
+ export type { AntseedPluginBase, AntseedVerifierPlugin, Prover, VerifyContext, VerifyResult, ClaimResult, SellerRequest, SellerResponse, } from './antseed-node-types.js';
11
+ export { generateTdxQuote } from './collect/configfs.js';
12
+ export { generateDstackQuote } from './collect/dstack.js';
13
+ export type { Capability, CapabilityVerifyInput, CapabilityCollectInput, } from './capability.js';
14
+ export { registerCapability, getCapability, listCapabilities, capabilityIds, } from './capability.js';
15
+ export { nodeTeeCapability, providerTeeCapability, sellerBoundCapability, measuredImageCapability, gpuNvidiaCapability, providerClaimsCapability, } from './caps/index.js';
16
+ export { PROVIDER_CLAIMS_CAP_ID, PROVIDER_CLAIMS_MENU, PROVIDER_REPORT_DATA_DOMAIN, claimsConfigKey, claimsReportData, } from './caps/provider-claims.js';
17
+ export type { ProviderClaimDefinition } from './caps/provider-claims.js';
18
+ export { readMeasuredImagePolicy, readRequiredCaps } from './verifier.js';
19
+ export { antseedRdV1, noncePubkeySha256V1, aciKeysetV1, getReportDataScheme, verifyReportData, REPORT_DATA_SCHEMES, } from './report-data.js';
20
+ export type { ReportDataScheme, BindingIngredients } from './report-data.js';
21
+ export { loadAdapter, adapterIds } from './adapters/index.js';
22
+ export type { ProviderAdapter, ProviderEvidence } from './adapters/index.js';
23
+ export type { ReportDataBinding } from './caps/tee-tdx.js';
24
+ export { runVerify } from './verifier.js';
25
+ export { makeTdxCap, defaultVerifyQuote, verifyTdxEvidence, isTcbAcceptable, NODE_TEE_CAP_ID, PROVIDER_TEE_CAP_ID, } from './caps/tee-tdx.js';
26
+ export type { VerifyQuoteFn, RawTdxVerification, ParsedTdxQuote, TdMeasurements } from './caps/tee-tdx.js';
27
+ export type { ApprovedMeasurement, MeasuredImagePolicy } from './caps/measured-image.js';
28
+ export { makeGpuNvidiaCap, makeNrasGpuVerify, nrasGpuVerify, localGpuVerify, defaultGpuVerify, } from './caps/gpu-nvidia.js';
29
+ export type { GpuVerifyFn, GpuVerification, NrasOptions } from './caps/gpu-nvidia.js';
30
+ export { NRAS_GPU_ATTEST_URL_DEFAULT, NRAS_JWKS_URL_DEFAULT, buildNrasRequest, verifyEar, } from './nras.js';
31
+ export type { NvidiaGpuEvidence, NrasEvidenceItem, NrasRequest, NrasSubmitFn, EarVerification } from './nras.js';
32
+ export { VERIFIER_ID, ATTEST_PATH, claimId, computeReportData, bundleDigest, sellerBoundPreimage, } from './shared.js';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,eAAe,CAAA;AAG1C;;;;;GAKG;AACH,eAAe,cAAc,CAAA;AAC7B,eAAO,MAAM,MAAM,0CAAe,CAAA;AAGlC,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,yBAAyB,CAAA;AAIhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAGzD,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,aAAa,GACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iBAAiB,CAAA;AAKxB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,GACjB,MAAM,2BAA2B,CAAA;AAClC,YAAY,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAIxE,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAKzE,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAK5E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAC7D,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC5E,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAG1D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC1G,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAGxF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,GACjB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACrF,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,GACV,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAGhH,OAAO,EACL,WAAW,EACX,WAAW,EACX,OAAO,EACP,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,GACpB,MAAM,aAAa,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ import verifierPlugin from './verifier.js';
2
+ import proverPlugin from './prover.js';
3
+ /**
4
+ * One package, two halves — both named `antseed-verifier`. The monorepo
5
+ * plugin loader imports this module and picks the export matching the requested kind:
6
+ * - type:'verifier' -> the default export (buyer half)
7
+ * - type:'prover' -> the `prover` export (seller half; embedded, not a provider)
8
+ */
9
+ export default verifierPlugin;
10
+ export const prover = proverPlugin;
11
+ // Self-hosted TDX quote minting — for provider tooling that adopts antseed-rd-v1.
12
+ // configfs-tsm (bare-metal or GCP TDX) and the dstack guest agent (Phala CVMs).
13
+ export { generateTdxQuote } from './collect/configfs.js';
14
+ export { generateDstackQuote } from './collect/dstack.js';
15
+ export { registerCapability, getCapability, listCapabilities, capabilityIds, } from './capability.js';
16
+ export { nodeTeeCapability, providerTeeCapability, sellerBoundCapability, measuredImageCapability, gpuNvidiaCapability, providerClaimsCapability, } from './caps/index.js';
17
+ // Provider-claims: the SDK-frozen claims menu (the per-version claim definitions buyers
18
+ // verify against) and the canonical provider report_data scheme (domain tag + the [0:32]
19
+ // commitment provider tooling computes when it binds a claims document into its TDX quote).
20
+ export { PROVIDER_CLAIMS_CAP_ID, PROVIDER_CLAIMS_MENU, PROVIDER_REPORT_DATA_DOMAIN, claimsConfigKey, claimsReportData, } from './caps/provider-claims.js';
21
+ // Buyer policy loaders (read from env): the measured-image allow-list, and the required-cap
22
+ // set that gates the overall verdict (default node-tee + seller-bound; overridable).
23
+ export { readMeasuredImagePolicy, readRequiredCaps } from './verifier.js';
24
+ // Report_data binding schemes — the frozen registry the buyer verifies provider quotes against.
25
+ // antseedRdV1 is the canonical compositional scheme (the node cap is its {peerId} instance);
26
+ // noncePubkeySha256V1 is the foreign Chutes construction, replicated only to verify their quotes.
27
+ export { antseedRdV1, noncePubkeySha256V1, aciKeysetV1, getReportDataScheme, verifyReportData, REPORT_DATA_SCHEMES, } from './report-data.js';
28
+ // In-process provider adapters — bridge a foreign provider's evidence API to the SDK's neutral
29
+ // shape, selected by ANTSEED_VERIFIER_PROVIDER_ADAPTER. The core stays provider-agnostic; each
30
+ // adapter is an isolated, lazily-loaded module (chutes, aci).
31
+ export { loadAdapter, adapterIds } from './adapters/index.js';
32
+ // Buyer-side orchestration and the injectable DCAP seam (useful for tooling and tests).
33
+ export { runVerify } from './verifier.js';
34
+ export { makeTdxCap, defaultVerifyQuote, verifyTdxEvidence, isTcbAcceptable, NODE_TEE_CAP_ID, PROVIDER_TEE_CAP_ID, } from './caps/tee-tdx.js';
35
+ // GPU-CC capability and its injectable buyer-side seam (NRAS or offline local).
36
+ export { makeGpuNvidiaCap, makeNrasGpuVerify, nrasGpuVerify, localGpuVerify, defaultGpuVerify, } from './caps/gpu-nvidia.js';
37
+ export { NRAS_GPU_ATTEST_URL_DEFAULT, NRAS_JWKS_URL_DEFAULT, buildNrasRequest, verifyEar, } from './nras.js';
38
+ // Shared constants and helpers.
39
+ export { VERIFIER_ID, ATTEST_PATH, claimId, computeReportData, bundleDigest, sellerBoundPreimage, } from './shared.js';
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,eAAe,CAAA;AAC1C,OAAO,YAAY,MAAM,aAAa,CAAA;AAEtC;;;;;GAKG;AACH,eAAe,cAAc,CAAA;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAA;AAclC,kFAAkF;AAClF,gFAAgF;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAQzD,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,aAAa,GACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iBAAiB,CAAA;AAExB,wFAAwF;AACxF,yFAAyF;AACzF,4FAA4F;AAC5F,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,GACjB,MAAM,2BAA2B,CAAA;AAGlC,4FAA4F;AAC5F,qFAAqF;AACrF,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEzE,gGAAgG;AAChG,6FAA6F;AAC7F,kGAAkG;AAClG,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,kBAAkB,CAAA;AAGzB,+FAA+F;AAC/F,+FAA+F;AAC/F,8DAA8D;AAC9D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAI7D,wFAAwF;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAI1B,gFAAgF;AAChF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,GACjB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,GACV,MAAM,WAAW,CAAA;AAGlB,gCAAgC;AAChC,OAAO,EACL,WAAW,EACX,WAAW,EACX,OAAO,EACP,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,GACpB,MAAM,aAAa,CAAA"}
package/dist/nras.d.ts ADDED
@@ -0,0 +1,81 @@
1
+ import type { JWTVerifyGetKey } from 'jose';
2
+ /**
3
+ * NRAS wire module — the single place the NVIDIA Remote Attestation Service request/response
4
+ * mapping lives, so a shift in NVIDIA's schema changes only this file. Everything the rest of
5
+ * the SDK needs (build a request, submit it, verify the returned EAR) is behind these exports.
6
+ *
7
+ * Sources for this mapping (July 2026):
8
+ * - NRAS API reference: https://docs.attestation.nvidia.com/api-docs/nras.html
9
+ * - Hopper single-GPU example: https://docs.nvidia.com/attestation/quick-start-guide/latest/attestation-examples/hopper_single_gpu.html
10
+ * - NRAS releases (v3 evidence_list rename + detached-EAR token): https://docs.nvidia.com/attestation/technical-docs-nras/latest/nras_releases.html
11
+ * - NVIDIA EAT claims (Intel Trust Authority mirror): https://docs.trustauthority.intel.com/main/articles/articles/ita/concept-gpu-attestation.html
12
+ *
13
+ * Why generic: NRAS is NVIDIA's own attestation service, not an AntSeed inference provider,
14
+ * so the NVIDIA host is a sensible default here (overridable by env). Nothing about any
15
+ * particular provider (hostnames, evidence field names) appears in this module.
16
+ */
17
+ /** NRAS v3 GPU attest endpoint. Overridable via ANTSEED_VERIFIER_NRAS_URL. */
18
+ export declare const NRAS_GPU_ATTEST_URL_DEFAULT = "https://nras.attestation.nvidia.com/v3/attest/gpu";
19
+ /** NRAS JWKS — the public keys a relying party verifies the EAR JWT against. Overridable via env. */
20
+ export declare const NRAS_JWKS_URL_DEFAULT = "https://nras.attestation.nvidia.com/.well-known/jwks.json";
21
+ /** One GPU's confidential-compute evidence: base64 SPDM attestation report + its cert chain. */
22
+ export interface NrasEvidenceItem {
23
+ evidence: string;
24
+ certificate: string;
25
+ }
26
+ /**
27
+ * The provider-produced GPU evidence blob (rides the provider's evidence route). Generic:
28
+ * `arch` (e.g. "HOPPER" or "BLACKWELL") and the per-GPU evidence come from the provider, never
29
+ * hardcoded here. This is the NRAS request body minus the buyer-supplied nonce.
30
+ */
31
+ export interface NvidiaGpuEvidence {
32
+ arch: string;
33
+ evidence_list: NrasEvidenceItem[];
34
+ }
35
+ /** The JSON body POSTed to NRAS (v3 uses the "evidence_list" field). */
36
+ export interface NrasRequest {
37
+ nonce: string;
38
+ arch: string;
39
+ evidence_list: NrasEvidenceItem[];
40
+ }
41
+ /** Injectable HTTP submit so tests never touch the network. Returns the parsed NRAS response. */
42
+ export type NrasSubmitFn = (url: string, body: NrasRequest) => Promise<unknown>;
43
+ /** Structured EAR verdict — the caller renders a human detail and maps it to a ClaimResult. */
44
+ export interface EarVerification {
45
+ ok: boolean;
46
+ /** Reason string (why it failed, or a success summary). */
47
+ reason: string;
48
+ /** Number of GPUs the EAR reported on (device token count). */
49
+ gpuCount: number;
50
+ /** CC-mode determination — see ccModeOf() for how it is derived and why it is fuzzy. */
51
+ ccMode: 'enabled' | 'disabled' | 'implied';
52
+ }
53
+ /**
54
+ * Build the NRAS request from provider evidence and the buyer's nonce. Fail-closed: it throws on
55
+ * anything malformed, so a missing or garbage evidence blob can never reach NRAS as a valid ask.
56
+ * The nonce is the buyer's 32 raw bytes rendered as 64 lowercase hex chars (NRAS "32-byte Hex").
57
+ */
58
+ export declare function buildNrasRequest(evidence: NvidiaGpuEvidence, nonce: Uint8Array): NrasRequest;
59
+ /** Default submit: POST JSON to NRAS with a hard timeout. Network or non-2xx errors bubble up (the caller marks them transient). */
60
+ export declare const defaultNrasSubmit: NrasSubmitFn;
61
+ /**
62
+ * Extract the JWT strings from an NRAS response. Handles a bare JWT string, and the v3 detached
63
+ * EAR array [ overall, { "GPU-0": jwt, ... } ] where each token may be wrapped as a
64
+ * ["JWT", token] content-type pair. Returns the overall token (if any) plus per-device tokens.
65
+ */
66
+ export declare function extractEarTokens(resp: unknown): {
67
+ overall?: string;
68
+ devices: Record<string, string>;
69
+ };
70
+ /**
71
+ * Verify the NRAS EAR against the buyer's nonce. It verifies every JWT's signature against the
72
+ * injected key resolver (NVIDIA JWKS in production, a test key in tests), then enforces:
73
+ * - the overall attestation result is success (x-nvidia-overall-att-result === true; when only
74
+ * per-device tokens are present, every device's measres === "success")
75
+ * - eat_nonce binds this exact buyer nonce (checked on the overall token, else on every device)
76
+ * - CC mode is not explicitly disabled on any device
77
+ * A bad signature or failed check is an attestation failure (not transient). It never verifies
78
+ * with a symmetric or "none" alg — jose derives the allowed alg from the resolved key.
79
+ */
80
+ export declare function verifyEar(resp: unknown, nonce: Uint8Array, getKey: JWTVerifyGetKey): Promise<EarVerification>;
81
+ //# sourceMappingURL=nras.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":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CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAmBrG;AAyCD;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,eAAe,CAAC,CA0C1B"}
package/dist/nras.js ADDED
@@ -0,0 +1,190 @@
1
+ /**
2
+ * NRAS wire module — the single place the NVIDIA Remote Attestation Service request/response
3
+ * mapping lives, so a shift in NVIDIA's schema changes only this file. Everything the rest of
4
+ * the SDK needs (build a request, submit it, verify the returned EAR) is behind these exports.
5
+ *
6
+ * Sources for this mapping (July 2026):
7
+ * - NRAS API reference: https://docs.attestation.nvidia.com/api-docs/nras.html
8
+ * - Hopper single-GPU example: https://docs.nvidia.com/attestation/quick-start-guide/latest/attestation-examples/hopper_single_gpu.html
9
+ * - NRAS releases (v3 evidence_list rename + detached-EAR token): https://docs.nvidia.com/attestation/technical-docs-nras/latest/nras_releases.html
10
+ * - NVIDIA EAT claims (Intel Trust Authority mirror): https://docs.trustauthority.intel.com/main/articles/articles/ita/concept-gpu-attestation.html
11
+ *
12
+ * Why generic: NRAS is NVIDIA's own attestation service, not an AntSeed inference provider,
13
+ * so the NVIDIA host is a sensible default here (overridable by env). Nothing about any
14
+ * particular provider (hostnames, evidence field names) appears in this module.
15
+ */
16
+ /** NRAS v3 GPU attest endpoint. Overridable via ANTSEED_VERIFIER_NRAS_URL. */
17
+ export const NRAS_GPU_ATTEST_URL_DEFAULT = 'https://nras.attestation.nvidia.com/v3/attest/gpu';
18
+ /** NRAS JWKS — the public keys a relying party verifies the EAR JWT against. Overridable via env. */
19
+ export const NRAS_JWKS_URL_DEFAULT = 'https://nras.attestation.nvidia.com/.well-known/jwks.json';
20
+ function isNonEmptyString(v) {
21
+ return typeof v === 'string' && v.length > 0;
22
+ }
23
+ /**
24
+ * Build the NRAS request from provider evidence and the buyer's nonce. Fail-closed: it throws on
25
+ * anything malformed, so a missing or garbage evidence blob can never reach NRAS as a valid ask.
26
+ * The nonce is the buyer's 32 raw bytes rendered as 64 lowercase hex chars (NRAS "32-byte Hex").
27
+ */
28
+ export function buildNrasRequest(evidence, nonce) {
29
+ if (!isNonEmptyString(evidence?.arch))
30
+ throw new Error('gpu evidence missing "arch"');
31
+ if (!Array.isArray(evidence.evidence_list) || evidence.evidence_list.length === 0) {
32
+ throw new Error('gpu evidence missing non-empty "evidence_list"');
33
+ }
34
+ for (const [i, item] of evidence.evidence_list.entries()) {
35
+ if (!isNonEmptyString(item?.evidence))
36
+ throw new Error(`gpu evidence_list[${i}] missing "evidence"`);
37
+ if (!isNonEmptyString(item?.certificate))
38
+ throw new Error(`gpu evidence_list[${i}] missing "certificate"`);
39
+ }
40
+ return {
41
+ nonce: Buffer.from(nonce).toString('hex'),
42
+ arch: evidence.arch,
43
+ evidence_list: evidence.evidence_list.map((e) => ({ evidence: e.evidence, certificate: e.certificate })),
44
+ };
45
+ }
46
+ /** Default submit: POST JSON to NRAS with a hard timeout. Network or non-2xx errors bubble up (the caller marks them transient). */
47
+ export const defaultNrasSubmit = async (url, body) => {
48
+ const resp = await fetch(url, {
49
+ method: 'POST',
50
+ headers: { 'content-type': 'application/json' },
51
+ body: JSON.stringify(body),
52
+ signal: AbortSignal.timeout(20_000),
53
+ });
54
+ if (!resp.ok)
55
+ throw new Error(`NRAS returned HTTP ${resp.status}`);
56
+ const declared = Number(resp.headers?.get('content-length') ?? '0');
57
+ if (declared > 4 * 1024 * 1024)
58
+ throw new Error(`NRAS response too large (${declared} bytes)`);
59
+ return resp.json();
60
+ };
61
+ /** Unwrap NRAS v3's ["JWT", token] content-type pair to the token; pass a bare string through. */
62
+ function jwtOf(v) {
63
+ if (isNonEmptyString(v))
64
+ return v;
65
+ if (Array.isArray(v) && v[0] === 'JWT' && isNonEmptyString(v[1]))
66
+ return v[1];
67
+ return undefined;
68
+ }
69
+ /**
70
+ * Extract the JWT strings from an NRAS response. Handles a bare JWT string, and the v3 detached
71
+ * EAR array [ overall, { "GPU-0": jwt, ... } ] where each token may be wrapped as a
72
+ * ["JWT", token] content-type pair. Returns the overall token (if any) plus per-device tokens.
73
+ */
74
+ export function extractEarTokens(resp) {
75
+ const bare = jwtOf(resp);
76
+ if (bare)
77
+ return { overall: bare, devices: {} };
78
+ if (Array.isArray(resp)) {
79
+ let overall;
80
+ const devices = {};
81
+ for (const el of resp) {
82
+ const tok = jwtOf(el);
83
+ if (tok) {
84
+ overall = tok;
85
+ continue;
86
+ }
87
+ if (el && typeof el === 'object') {
88
+ for (const [k, v] of Object.entries(el)) {
89
+ const dt = jwtOf(v);
90
+ if (dt)
91
+ devices[k] = dt;
92
+ }
93
+ }
94
+ }
95
+ return { overall, devices };
96
+ }
97
+ throw new Error('unrecognized NRAS response shape (expected a JWT string or a detached-EAR array)');
98
+ }
99
+ /**
100
+ * Candidate per-device claim names that carry a confidential-compute signal. NVIDIA's EAT does
101
+ * not document a single stable "cc-mode" boolean, so this checks a documented candidate set
102
+ * instead of inventing one. The authoritative CC signal is that `x-nvidia-overall-att-result`
103
+ * is true for evidence submitted to the /attest/gpu (CC) endpoint. Extend this list here if
104
+ * NVIDIA names the claim explicitly. It lives here so the policy in gpu-nvidia.ts stays clean.
105
+ */
106
+ const CC_MODE_CLAIM_CANDIDATES = [
107
+ 'x-nvidia-gpu-attestation-report-cc-mode',
108
+ 'x-nvidia-cc-mode',
109
+ 'x-nvidia-ccmode',
110
+ ];
111
+ /** Truthy for the common on/off encodings NVIDIA uses (booleans and "enabled"/"on" strings). */
112
+ function claimTruthy(v) {
113
+ if (typeof v === 'boolean')
114
+ return v;
115
+ if (typeof v === 'string')
116
+ return ['true', 'enabled', 'on', 'active'].includes(v.toLowerCase());
117
+ return false;
118
+ }
119
+ /** Tri-state CC-mode read: explicit true → 'enabled', explicit false → 'disabled', absent → undefined. */
120
+ function ccModeOf(payload) {
121
+ for (const key of CC_MODE_CLAIM_CANDIDATES) {
122
+ if (key in payload)
123
+ return claimTruthy(payload[key]) ? 'enabled' : 'disabled';
124
+ }
125
+ return undefined;
126
+ }
127
+ /** Per-device "this GPU passed its own measurement compare" — NVIDIA uses measres === "success". */
128
+ function deviceMeasuredOk(payload) {
129
+ return payload['measres'] === 'success';
130
+ }
131
+ /** Read the eat_nonce claim (NVIDIA emits it as lowercase hex), if present. */
132
+ function eatNonce(payload) {
133
+ const n = payload['eat_nonce'];
134
+ return typeof n === 'string' ? n.toLowerCase() : undefined;
135
+ }
136
+ /**
137
+ * Verify the NRAS EAR against the buyer's nonce. It verifies every JWT's signature against the
138
+ * injected key resolver (NVIDIA JWKS in production, a test key in tests), then enforces:
139
+ * - the overall attestation result is success (x-nvidia-overall-att-result === true; when only
140
+ * per-device tokens are present, every device's measres === "success")
141
+ * - eat_nonce binds this exact buyer nonce (checked on the overall token, else on every device)
142
+ * - CC mode is not explicitly disabled on any device
143
+ * A bad signature or failed check is an attestation failure (not transient). It never verifies
144
+ * with a symmetric or "none" alg — jose derives the allowed alg from the resolved key.
145
+ */
146
+ export async function verifyEar(resp, nonce, getKey) {
147
+ const fail = (reason) => ({ ok: false, reason, gpuCount: 0, ccMode: 'implied' });
148
+ const { overall, devices } = extractEarTokens(resp);
149
+ const deviceIds = Object.keys(devices);
150
+ if (!overall && deviceIds.length === 0)
151
+ return fail('NRAS response contained no EAR token');
152
+ const jose = await import('jose');
153
+ const expectedNonce = Buffer.from(nonce).toString('hex');
154
+ // Verify signatures and collect payloads. jose throws on a bad signature or an unexpected alg.
155
+ let overallPayload;
156
+ const devicePayloads = [];
157
+ try {
158
+ if (overall)
159
+ overallPayload = (await jose.jwtVerify(overall, getKey)).payload;
160
+ for (const id of deviceIds)
161
+ devicePayloads.push((await jose.jwtVerify(devices[id], getKey)).payload);
162
+ }
163
+ catch (err) {
164
+ return fail(`EAR signature verification failed: ${err instanceof Error ? err.message : String(err)}`);
165
+ }
166
+ // Overall attestation result: prefer the overall claim; else require every device measured-ok.
167
+ const overallResult = overallPayload
168
+ ? overallPayload['x-nvidia-overall-att-result'] === true
169
+ : devicePayloads.length > 0 && devicePayloads.every(deviceMeasuredOk);
170
+ if (!overallResult)
171
+ return fail('NRAS overall attestation result was not success');
172
+ // Nonce binding: the overall token carries eat_nonce in v3; fall back to every device token.
173
+ const nonceMatches = overallPayload && eatNonce(overallPayload) !== undefined
174
+ ? eatNonce(overallPayload) === expectedNonce
175
+ : devicePayloads.length > 0 && devicePayloads.every((p) => eatNonce(p) === expectedNonce);
176
+ if (!nonceMatches)
177
+ return fail('NRAS EAR nonce does not match this attestation round');
178
+ // CC mode: reject only an explicit disable; otherwise trust the overall CC-endpoint result.
179
+ let ccMode = 'implied';
180
+ for (const p of devicePayloads) {
181
+ const m = ccModeOf(p);
182
+ if (m === 'disabled')
183
+ return fail('a GPU reported confidential-compute mode disabled');
184
+ if (m === 'enabled')
185
+ ccMode = 'enabled';
186
+ }
187
+ const gpuCount = deviceIds.length || 1;
188
+ return { ok: true, reason: `${gpuCount} NVIDIA GPU${gpuCount === 1 ? '' : 's'}, CC mode ${ccMode}, NRAS-verified`, gpuCount, ccMode };
189
+ }
190
+ //# sourceMappingURL=nras.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nras.js","sourceRoot":"","sources":["../src/nras.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,2BAA2B,GAAG,mDAAmD,CAAA;AAC9F,qGAAqG;AACrG,MAAM,CAAC,MAAM,qBAAqB,GAAG,2DAA2D,CAAA;AAuChG,SAAS,gBAAgB,CAAC,CAAU;IAClC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAA2B,EAAE,KAAiB;IAC7E,IAAI,CAAC,gBAAgB,CAAC,QAA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AAA;QACtF,IAAI,CAAC,KAAK,SAAS;YAAE,MAAM,GAAG,SAAS,CAAA;IACzC,CAAC;IAED,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,IAAI,CAAC,CAAA;IACtC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,cAAc,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,aAAa,MAAM,iBAAiB,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;AACvI,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Prover } from './antseed-node-types.js';
2
+ import './caps/index.js';
3
+ declare const prover: Prover;
4
+ export default prover;
5
+ //# sourceMappingURL=prover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prover.d.ts","sourceRoot":"","sources":["../src/prover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,yBAAyB,CAAA;AACpF,OAAO,iBAAiB,CAAA;AA4JxB,QAAA,MAAM,MAAM,EAAE,MA4Db,CAAA;AAED,eAAe,MAAM,CAAA"}