@aptos-labs/inference-verifier 0.1.0 → 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.
- package/README.md +84 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
# @aptos-labs/inference-verifier
|
|
2
2
|
|
|
3
|
-
`
|
|
4
|
-
|
|
3
|
+
`@aptos-labs/inference-verifier` verifies attestation documents from the Aptos confidential inference router. It validates Intel TDX evidence, signed release provenance, and hardware measurements using the collateral included in the document and the package's bundled trust roots. Verification runs locally without contacting Intel, GitHub, Sigstore, or the attestation collateral service (ATC).
|
|
4
|
+
|
|
5
|
+
The package is implemented in TypeScript, is distributed as an ECMAScript module (ESM), and requires Node.js 22 or later. Browser runtimes are not supported.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @aptos-labs/inference-verifier
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
[`@aptos-labs/inference-sdk`](https://www.npmjs.com/package/@aptos-labs/inference-sdk) integrates this verifier with attestation retrieval and TLS pinning. Use the verifier directly when implementing those parts of the client yourself.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Call `verifyRouterDocument` with the received document bytes, the nonce used to request that document, the trusted source repository, and the current time:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { verifyRouterDocument } from "@aptos-labs/inference-verifier";
|
|
21
|
+
|
|
22
|
+
const evidence = verifyRouterDocument(
|
|
23
|
+
bytes,
|
|
24
|
+
nonce,
|
|
25
|
+
"aptos-labs/confidential-inference-router",
|
|
26
|
+
Math.floor(Date.now() / 1000),
|
|
27
|
+
);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The function is synchronous and returns a `RouterEvidence` object after all checks pass.
|
|
31
|
+
|
|
32
|
+
| Parameter | Type | Description |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| `bytes` | `Uint8Array` | Complete UTF-8 JSON attestation document in the Tinfoil v3 format, including its collateral. The maximum size is 4 MiB. |
|
|
35
|
+
| `nonce` | `Uint8Array` | The 32-byte nonce generated by the caller and sent in the attestation request. |
|
|
36
|
+
| `repo` | `string` | Trusted GitHub repository in `owner/repo` format, without a URL prefix or `@tag` suffix. |
|
|
37
|
+
| `nowSecs` | `number` | Current Unix time in seconds, used to check Intel certificate, revocation-list, and collateral validity. |
|
|
38
|
+
|
|
39
|
+
Generate a fresh random nonce for each attestation request and retain it for verification. The repository and verification time come from the caller's configuration and clock; the document does not establish those trusted inputs.
|
|
40
|
+
|
|
41
|
+
To require a specific release, compare `evidence.releaseTag` with the expected tag after verification. The SDK performs this comparison when its `configRepo` option includes an `@tag` suffix.
|
|
42
|
+
|
|
43
|
+
## Verification policy
|
|
44
|
+
|
|
45
|
+
The verifier accepts Intel TDX quote version 4 for the router's GPU-less `small_0d_v011` hardware profile. Verification covers:
|
|
46
|
+
|
|
47
|
+
- The document structure and the quote's binding to the request nonce, TLS key fingerprint, and HPKE key.
|
|
48
|
+
- Intel DCAP signatures, certificate chains, revocation lists, and collateral validity, with an `UpToDate` trusted computing base (TCB) status.
|
|
49
|
+
- The required TDX module measurements, security versions, attributes, and zero-valued RTMR3.
|
|
50
|
+
- Sigstore release provenance from a GitHub-hosted Actions workflow on a tag in the trusted repository, with RTMR1 and RTMR2 matching the quote.
|
|
51
|
+
- A signed hardware catalog from `tinfoilsh/hardware-measurements`, with MRTD and RTMR0 matching the accepted profile.
|
|
52
|
+
|
|
53
|
+
The policy does not require host-specific platform endorsements or release freshness witnesses. A nonce binds the evidence to a request, but does not establish that the attested release is the latest release or remains approved for deployment. Historical releases can pass verification when they satisfy the repository and measurement checks and the Intel collateral is valid.
|
|
54
|
+
|
|
55
|
+
## Returned evidence
|
|
56
|
+
|
|
57
|
+
The package exports the `RouterEvidence` type with the following fields:
|
|
58
|
+
|
|
59
|
+
| Field | Description |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `tlsPublicKey` | SHA-256 fingerprint of the TLS public key's DER-encoded SubjectPublicKeyInfo (SPKI), represented as lowercase hexadecimal. |
|
|
62
|
+
| `hpkePublicKey` | The 32-byte X25519 HPKE public key, represented as lowercase hexadecimal. |
|
|
63
|
+
| `mrtd` | The trust domain's initial measurement, represented as lowercase hexadecimal. |
|
|
64
|
+
| `rtmrs` | A tuple containing RTMR0 through RTMR3, each represented as lowercase hexadecimal. |
|
|
65
|
+
| `hardware` | Matched hardware profile and catalog digest in `profile@digest` format. |
|
|
66
|
+
| `releaseDigest` | SHA-256 subject digest from the verified release provenance. |
|
|
67
|
+
| `releaseTag` | Release tag established by the verified GitHub Actions identity. |
|
|
68
|
+
| `codeMeasurement` | Measurement predicate type and register values from the signed code provenance, ordered as SNP, RTMR1, and RTMR2. |
|
|
69
|
+
| `tcbStatus` | Verified Intel TCB status. Successful verification requires `UpToDate`. |
|
|
70
|
+
| `collateralExpiresAt` | Earlier of the Intel TCB information and quoting enclave identity `nextUpdate` timestamps, in Unix seconds. |
|
|
71
|
+
|
|
72
|
+
The caller is responsible for comparing `tlsPublicKey` with the SPKI fingerprint of the TLS connection that delivered the document, and for enforcing that pin on subsequent connections while retaining normal certificate and hostname validation. The verifier does not manage connections or cached sessions. Certificate and revocation-list expiry are checked during verification; they are not included in `collateralExpiresAt`.
|
|
73
|
+
|
|
74
|
+
## Error handling
|
|
75
|
+
|
|
76
|
+
Validation failures raise `VerificationError`, which the package exports alongside the `VerificationCategory` type. The error's `message` describes the failure, and its `category` identifies the failed check:
|
|
77
|
+
|
|
78
|
+
| Category | Description |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| `envelope` | Invalid document structure, unsupported document format, or a nonce or report-data mismatch. |
|
|
81
|
+
| `encoding` | Invalid JSON, UTF-8, or binary-field encoding. |
|
|
82
|
+
| `dcap` | Invalid Intel quote, signature, certificate chain, revocation data, or collateral. |
|
|
83
|
+
| `tdx` | TDX measurements, attributes, security versions, or TCB status fail the required policy. |
|
|
84
|
+
| `provenance` | Missing or invalid Sigstore evidence, an unexpected publisher, or code measurements that do not match the quote. |
|
|
85
|
+
| `policy` | Unsupported repository format, CPU or device evidence, missing required keys, or an unrecognized hardware profile. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/inference-verifier",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Offline attestation verifier for the Aptos inference router.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "24.10.1",
|
|
34
34
|
"typescript": "5.9.3",
|
|
35
|
-
"vitest": "
|
|
35
|
+
"vitest": "5.1.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsc -p tsconfig.json",
|