@premai/reticle 0.3.1 → 0.4.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@premai/reticle",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.4.1",
5
5
  "files": [
6
6
  "reticle_bg.wasm",
7
7
  "reticle.js",
package/reticle.d.ts CHANGED
@@ -17,6 +17,24 @@ export class AttestResult {
17
17
  modules(): Modules;
18
18
  }
19
19
 
20
+ /**
21
+ * A parsed certificate revocation list
22
+ */
23
+ export class CRL {
24
+ private constructor();
25
+ free(): void;
26
+ [Symbol.dispose](): void;
27
+ /**
28
+ * Passes if the certificates are not in the certificate revocation list
29
+ * Throws `AttestationError` on fail
30
+ */
31
+ check_chain(chain: VerifiedChain): void;
32
+ /**
33
+ * Parses a certificate revocation list from DER format binary data
34
+ */
35
+ static from_der(list: Uint8Array): CRL;
36
+ }
37
+
20
38
  export class Client {
21
39
  private constructor();
22
40
  free(): void;
@@ -27,23 +45,23 @@ export class Client {
27
45
  * - Iterates through each module and performs end-to-end attestation
28
46
  * - Returns the list of attested modules
29
47
  */
30
- attest(query?: QueryParams | null): Promise<AttestResult>;
48
+ attest(): Promise<AttestResult>;
31
49
  /**
32
50
  * Completes end-to-end nvidia attestation. Generates nonce and validates claims all in one
33
51
  */
34
- attest_nvidia(query?: QueryParams | null): Promise<ResponseHeaders>;
52
+ attest_nvidia(): Promise<ResponseHeaders>;
35
53
  /**
36
54
  * Performs end-to-end sev-snp attestation. Generates nonce and validates claims all in one
37
55
  */
38
- attest_sev(query?: QueryParams | null): Promise<void>;
56
+ attest_sev(): Promise<void>;
39
57
  /**
40
58
  * Performs end-to-end tdx attestation. Generates nonce and validates claims all in one
41
59
  */
42
- attest_tdx(query?: QueryParams | null): Promise<void>;
60
+ attest_tdx(): Promise<void>;
43
61
  /**
44
62
  * Gather available attestable modules from remote attestation endpoint
45
63
  */
46
- request_modules(query?: QueryParams | null): Promise<Modules>;
64
+ request_modules(): Promise<Modules>;
47
65
  /**
48
66
  * Requests and parses an Nvidia EATToken attestation from the attestation server
49
67
  *
@@ -52,7 +70,7 @@ export class Client {
52
70
  * or measurement checks on the attestation. If you want to perform end-to-end attestation
53
71
  * please refer to [`Self::attest_nvidia`]
54
72
  */
55
- request_nvidia(nonce: NvidiaNonce, query: QueryParams): Promise<NvidiaAttestResult>;
73
+ request_nvidia(nonce: NvidiaNonce): Promise<NvidiaAttestResult>;
56
74
  /**
57
75
  * Requests and parses a SEV-SNP attestation from the attestation server.
58
76
  *
@@ -61,7 +79,7 @@ export class Client {
61
79
  * or measurement checks on the attestation. If you want to perform end-to-end attestation
62
80
  * please refer to [`Self::attest_sev`]
63
81
  */
64
- request_sev(nonce: SevNonce, query: QueryParams): Promise<ParsedAttestation>;
82
+ request_sev(nonce: SevNonce): Promise<ParsedAttestation>;
65
83
  /**
66
84
  * Requests and parses a TDX quote
67
85
  *
@@ -70,7 +88,8 @@ export class Client {
70
88
  * or measurement checks on the attestation. If you want to perform end-to-end attestation
71
89
  * please refer to [`Self::attest_tdx`]
72
90
  */
73
- request_tdx(nonce: TdxNonce, query: QueryParams): Promise<TdxQuote>;
91
+ request_tdx(nonce: TdxNonce): Promise<TdxQuote>;
92
+ set_query(query_params: QueryParams): void;
74
93
  }
75
94
 
76
95
  export class ClientBuilder {
@@ -107,205 +126,174 @@ export enum CpuModule {
107
126
  Tdx = 1,
108
127
  }
109
128
 
110
- export class GatewayError {
129
+ export class DecodedClaims {
111
130
  private constructor();
112
131
  free(): void;
113
132
  [Symbol.dispose](): void;
114
- message: string;
115
- }
116
-
117
- export enum GpuModule {
118
- Nvidia = 0,
119
133
  }
120
134
 
121
- export class Modules {
135
+ export class EATToken {
122
136
  private constructor();
123
137
  free(): void;
124
138
  [Symbol.dispose](): void;
125
- cpu(): CpuModule;
126
- gpu(): GpuModule | undefined;
127
- has_gpu(): boolean;
139
+ static parse(from: string): EATToken;
140
+ verify(keys: KeyChain, nonce: NvidiaNonce): DecodedClaims;
128
141
  }
129
142
 
130
- export class NvidiaAttestResult {
143
+ export class ExportPem {
131
144
  private constructor();
132
145
  free(): void;
133
146
  [Symbol.dispose](): void;
147
+ ark: Uint8Array;
148
+ ask: Uint8Array;
149
+ vek: Uint8Array;
134
150
  }
135
151
 
136
- export class Pcs {
152
+ export class GatewayError {
153
+ private constructor();
137
154
  free(): void;
138
155
  [Symbol.dispose](): void;
139
- fetch_collateral(quote: TdxQuote): Promise<Collateral>;
140
- constructor(base_url: string);
156
+ message: string;
141
157
  }
142
158
 
143
- /**
144
- * Generic per-request query parameters.
145
- *
146
- * The `nonce` key is reserved and will be rejected.
147
- */
148
- export class QueryParams {
159
+ export enum GpuModule {
160
+ Nvidia = 0,
161
+ }
162
+
163
+ export class Kds {
149
164
  free(): void;
150
165
  [Symbol.dispose](): void;
151
- constructor();
166
+ fetch_certificates(attestation: ParsedAttestation): Promise<VerifiedChain>;
152
167
  /**
153
- * Appends a query parameter.
154
- *
155
- * Reserved keywords for specific queries will get overwritten
168
+ * Fetches the certificate revocation list from AMD's KDS
156
169
  */
157
- with(key: string, value: string): QueryParams;
170
+ fetch_crl(attestation: ParsedAttestation): Promise<CRL>;
171
+ constructor(cache_url: string);
158
172
  }
159
173
 
160
- export class QuoteVerifier {
174
+ export class KeyChain {
175
+ private constructor();
161
176
  free(): void;
162
177
  [Symbol.dispose](): void;
163
- constructor(collateral: Collateral, quote: TdxQuote);
164
- verify(nonce: TdxNonce): void;
165
178
  }
166
179
 
167
- export class ResponseHeaders {
180
+ export class Modules {
168
181
  private constructor();
169
182
  free(): void;
170
183
  [Symbol.dispose](): void;
171
- get(name: string): string | undefined;
172
- keys(): string[];
184
+ cpu(): CpuModule;
185
+ gpu(): GpuModule | undefined;
186
+ has_gpu(): boolean;
173
187
  }
174
188
 
175
- export class TcbLevels {
189
+ export class NvidiaAttestResult {
176
190
  private constructor();
177
191
  free(): void;
178
192
  [Symbol.dispose](): void;
179
193
  }
180
194
 
181
- export class TdxNonce {
195
+ export class NvidiaNonce {
196
+ private constructor();
182
197
  free(): void;
183
198
  [Symbol.dispose](): void;
184
- constructor();
199
+ static generate(): NvidiaNonce;
185
200
  to_hex(): string;
186
201
  }
187
202
 
188
- export class TdxQuote {
203
+ /**
204
+ * Represents a parsed attestation report with some already
205
+ * parsed commonly accessed fields
206
+ */
207
+ export class ParsedAttestation {
189
208
  private constructor();
190
209
  free(): void;
191
210
  [Symbol.dispose](): void;
211
+ cpu_fam_id(): number;
212
+ cpu_mod_id(): number;
192
213
  /**
193
- * Attempts to parse a quote from DCAP bytes.
214
+ * Parses and constructs a new attestation report from a stream of binary data
194
215
  */
195
- static from_bytes(quote: Uint8Array): TdxQuote;
216
+ static new(bytes: Uint8Array): ParsedAttestation;
217
+ /**
218
+ * Verifies the attestation report against a certificate chain
219
+ */
220
+ verify(chain: VerifiedChain, nonce: SevNonce): void;
196
221
  }
197
222
 
198
- declare class DecodedClaims {
199
- private constructor();
223
+ export class Pcs {
200
224
  free(): void;
201
225
  [Symbol.dispose](): void;
226
+ fetch_collateral(quote: TdxQuote): Promise<Collateral>;
227
+ constructor(base_url: string);
202
228
  }
203
229
 
204
- declare class EATToken {
205
- private constructor();
230
+ /**
231
+ * Generic per-request query parameters.
232
+ *
233
+ * The `nonce` key is reserved and will be rejected.
234
+ */
235
+ export class QueryParams {
206
236
  free(): void;
207
237
  [Symbol.dispose](): void;
208
- static parse(from: string): EATToken;
209
- verify(keys: KeyChain, nonce: NvidiaNonce): DecodedClaims;
238
+ constructor();
239
+ /**
240
+ * Appends a query parameter.
241
+ *
242
+ * Reserved keywords for specific queries will get overwritten
243
+ */
244
+ with(key: string, value: string): QueryParams;
210
245
  }
211
246
 
212
- declare class KeyChain {
213
- private constructor();
247
+ export class QuoteVerifier {
214
248
  free(): void;
215
249
  [Symbol.dispose](): void;
250
+ constructor(collateral: Collateral, quote: TdxQuote);
251
+ verify(nonce: TdxNonce): void;
216
252
  }
217
253
 
218
- declare class NvidiaNonce {
254
+ export class ResponseHeaders {
219
255
  private constructor();
220
256
  free(): void;
221
257
  [Symbol.dispose](): void;
222
- static generate(): NvidiaNonce;
223
- to_hex(): string;
258
+ get(name: string): string | undefined;
259
+ keys(): string[];
224
260
  }
225
261
 
226
- /**
227
- * Same as [`KeyChain:fetch_keychain`], put in for better wasm compatibility
228
- */
229
- declare function fetch_keychain(): Promise<KeyChain>;
230
-
231
- export let nvidia: {
232
- DecodedClaims: typeof DecodedClaims,
233
- EATToken: typeof EATToken,
234
- KeyChain: typeof KeyChain,
235
- NvidiaNonce: typeof NvidiaNonce,
236
- fetch_keychain: typeof fetch_keychain,
237
- };
238
-
239
- /**
240
- * A parsed certificate revocation list
241
- */
242
- declare class CRL {
262
+ export class SevNonce {
243
263
  private constructor();
244
264
  free(): void;
245
265
  [Symbol.dispose](): void;
246
- /**
247
- * Passes if the certificates are not in the certificate revocation list
248
- * Throws `AttestationError` on fail
249
- */
250
- check_chain(chain: VerifiedChain): void;
251
- /**
252
- * Parses a certificate revocation list from DER format binary data
253
- */
254
- static from_der(list: Uint8Array): CRL;
266
+ static generate(): SevNonce;
267
+ to_hex(): string;
255
268
  }
256
269
 
257
- declare class ExportPem {
270
+ export class TcbLevels {
258
271
  private constructor();
259
272
  free(): void;
260
273
  [Symbol.dispose](): void;
261
- ark: Uint8Array;
262
- ask: Uint8Array;
263
- vek: Uint8Array;
264
274
  }
265
275
 
266
- declare class Kds {
276
+ export class TdxNonce {
267
277
  free(): void;
268
278
  [Symbol.dispose](): void;
269
- fetch_certificates(attestation: ParsedAttestation): Promise<VerifiedChain>;
270
- /**
271
- * Fetches the certificate revocation list from AMD's KDS
272
- */
273
- fetch_crl(attestation: ParsedAttestation): Promise<CRL>;
274
- constructor(cache_url: string);
279
+ constructor();
280
+ to_hex(): string;
275
281
  }
276
282
 
277
- /**
278
- * Represents a parsed attestation report with some already
279
- * parsed commonly accessed fields
280
- */
281
- declare class ParsedAttestation {
283
+ export class TdxQuote {
282
284
  private constructor();
283
285
  free(): void;
284
286
  [Symbol.dispose](): void;
285
- cpu_fam_id(): number;
286
- cpu_mod_id(): number;
287
287
  /**
288
- * Parses and constructs a new attestation report from a stream of binary data
289
- */
290
- static new(bytes: Uint8Array): ParsedAttestation;
291
- /**
292
- * Verifies the attestation report against a certificate chain
288
+ * Attempts to parse a quote from DCAP bytes.
293
289
  */
294
- verify(chain: VerifiedChain, nonce: SevNonce): void;
295
- }
296
-
297
- declare class SevNonce {
298
- private constructor();
299
- free(): void;
300
- [Symbol.dispose](): void;
301
- static generate(): SevNonce;
302
- to_hex(): string;
290
+ static from_bytes(quote: Uint8Array): TdxQuote;
303
291
  }
304
292
 
305
293
  /**
306
294
  * A chain which has been cryptographically verified
307
295
  */
308
- declare class VerifiedChain {
296
+ export class VerifiedChain {
309
297
  private constructor();
310
298
  free(): void;
311
299
  [Symbol.dispose](): void;
@@ -317,11 +305,7 @@ declare class VerifiedChain {
317
305
  to_pem(): ExportPem;
318
306
  }
319
307
 
320
- export let sev: {
321
- CRL: typeof CRL,
322
- ExportPem: typeof ExportPem,
323
- Kds: typeof Kds,
324
- ParsedAttestation: typeof ParsedAttestation,
325
- SevNonce: typeof SevNonce,
326
- VerifiedChain: typeof VerifiedChain,
327
- };
308
+ /**
309
+ * Same as [`KeyChain:fetch_keychain`], put in for better wasm compatibility
310
+ */
311
+ export function fetch_keychain(): Promise<KeyChain>;
package/reticle.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./reticle_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- AttestHeaders, AttestResult, Client, ClientBuilder, Collateral, CpuModule, GatewayError, GpuModule, Modules, NvidiaAttestResult, Pcs, QueryParams, QuoteVerifier, ResponseHeaders, TcbLevels, TdxNonce, TdxQuote
8
+ AttestHeaders, AttestResult, CRL, Client, ClientBuilder, Collateral, CpuModule, DecodedClaims, EATToken, ExportPem, GatewayError, GpuModule, Kds, KeyChain, Modules, NvidiaAttestResult, NvidiaNonce, ParsedAttestation, Pcs, QueryParams, QuoteVerifier, ResponseHeaders, SevNonce, TcbLevels, TdxNonce, TdxQuote, VerifiedChain, fetch_keychain
9
9
  } from "./reticle_bg.js";