@premai/reticle 0.4.0 → 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/reticle_main.js CHANGED
@@ -72,6 +72,57 @@ class AttestResult {
72
72
  if (Symbol.dispose) AttestResult.prototype[Symbol.dispose] = AttestResult.prototype.free;
73
73
  exports.AttestResult = AttestResult;
74
74
 
75
+ /**
76
+ * A parsed certificate revocation list
77
+ */
78
+ class CRL {
79
+ static __wrap(ptr) {
80
+ ptr = ptr >>> 0;
81
+ const obj = Object.create(CRL.prototype);
82
+ obj.__wbg_ptr = ptr;
83
+ CRLFinalization.register(obj, obj.__wbg_ptr, obj);
84
+ return obj;
85
+ }
86
+ __destroy_into_raw() {
87
+ const ptr = this.__wbg_ptr;
88
+ this.__wbg_ptr = 0;
89
+ CRLFinalization.unregister(this);
90
+ return ptr;
91
+ }
92
+ free() {
93
+ const ptr = this.__destroy_into_raw();
94
+ wasm.__wbg_crl_free(ptr, 0);
95
+ }
96
+ /**
97
+ * Passes if the certificates are not in the certificate revocation list
98
+ * Throws `AttestationError` on fail
99
+ * @param {VerifiedChain} chain
100
+ */
101
+ check_chain(chain) {
102
+ _assertClass(chain, VerifiedChain);
103
+ const ret = wasm.crl_check_chain(this.__wbg_ptr, chain.__wbg_ptr);
104
+ if (ret[1]) {
105
+ throw takeFromExternrefTable0(ret[0]);
106
+ }
107
+ }
108
+ /**
109
+ * Parses a certificate revocation list from DER format binary data
110
+ * @param {Uint8Array} list
111
+ * @returns {CRL}
112
+ */
113
+ static from_der(list) {
114
+ const ptr0 = passArray8ToWasm0(list, wasm.__wbindgen_malloc);
115
+ const len0 = WASM_VECTOR_LEN;
116
+ const ret = wasm.crl_from_der(ptr0, len0);
117
+ if (ret[2]) {
118
+ throw takeFromExternrefTable0(ret[1]);
119
+ }
120
+ return CRL.__wrap(ret[0]);
121
+ }
122
+ }
123
+ if (Symbol.dispose) CRL.prototype[Symbol.dispose] = CRL.prototype.free;
124
+ exports.CRL = CRL;
125
+
75
126
  class Client {
76
127
  static __wrap(ptr) {
77
128
  ptr = ptr >>> 0;
@@ -313,6 +364,151 @@ const CpuModule = Object.freeze({
313
364
  });
314
365
  exports.CpuModule = CpuModule;
315
366
 
367
+ class DecodedClaims {
368
+ static __wrap(ptr) {
369
+ ptr = ptr >>> 0;
370
+ const obj = Object.create(DecodedClaims.prototype);
371
+ obj.__wbg_ptr = ptr;
372
+ DecodedClaimsFinalization.register(obj, obj.__wbg_ptr, obj);
373
+ return obj;
374
+ }
375
+ __destroy_into_raw() {
376
+ const ptr = this.__wbg_ptr;
377
+ this.__wbg_ptr = 0;
378
+ DecodedClaimsFinalization.unregister(this);
379
+ return ptr;
380
+ }
381
+ free() {
382
+ const ptr = this.__destroy_into_raw();
383
+ wasm.__wbg_decodedclaims_free(ptr, 0);
384
+ }
385
+ }
386
+ if (Symbol.dispose) DecodedClaims.prototype[Symbol.dispose] = DecodedClaims.prototype.free;
387
+ exports.DecodedClaims = DecodedClaims;
388
+
389
+ class EATToken {
390
+ static __wrap(ptr) {
391
+ ptr = ptr >>> 0;
392
+ const obj = Object.create(EATToken.prototype);
393
+ obj.__wbg_ptr = ptr;
394
+ EATTokenFinalization.register(obj, obj.__wbg_ptr, obj);
395
+ return obj;
396
+ }
397
+ __destroy_into_raw() {
398
+ const ptr = this.__wbg_ptr;
399
+ this.__wbg_ptr = 0;
400
+ EATTokenFinalization.unregister(this);
401
+ return ptr;
402
+ }
403
+ free() {
404
+ const ptr = this.__destroy_into_raw();
405
+ wasm.__wbg_eattoken_free(ptr, 0);
406
+ }
407
+ /**
408
+ * @param {string} from
409
+ * @returns {EATToken}
410
+ */
411
+ static parse(from) {
412
+ const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
413
+ const len0 = WASM_VECTOR_LEN;
414
+ const ret = wasm.eattoken_parse(ptr0, len0);
415
+ if (ret[2]) {
416
+ throw takeFromExternrefTable0(ret[1]);
417
+ }
418
+ return EATToken.__wrap(ret[0]);
419
+ }
420
+ /**
421
+ * @param {KeyChain} keys
422
+ * @param {NvidiaNonce} nonce
423
+ * @returns {DecodedClaims}
424
+ */
425
+ verify(keys, nonce) {
426
+ const ptr = this.__destroy_into_raw();
427
+ _assertClass(keys, KeyChain);
428
+ _assertClass(nonce, NvidiaNonce);
429
+ const ret = wasm.eattoken_verify(ptr, keys.__wbg_ptr, nonce.__wbg_ptr);
430
+ if (ret[2]) {
431
+ throw takeFromExternrefTable0(ret[1]);
432
+ }
433
+ return DecodedClaims.__wrap(ret[0]);
434
+ }
435
+ }
436
+ if (Symbol.dispose) EATToken.prototype[Symbol.dispose] = EATToken.prototype.free;
437
+ exports.EATToken = EATToken;
438
+
439
+ class ExportPem {
440
+ static __wrap(ptr) {
441
+ ptr = ptr >>> 0;
442
+ const obj = Object.create(ExportPem.prototype);
443
+ obj.__wbg_ptr = ptr;
444
+ ExportPemFinalization.register(obj, obj.__wbg_ptr, obj);
445
+ return obj;
446
+ }
447
+ __destroy_into_raw() {
448
+ const ptr = this.__wbg_ptr;
449
+ this.__wbg_ptr = 0;
450
+ ExportPemFinalization.unregister(this);
451
+ return ptr;
452
+ }
453
+ free() {
454
+ const ptr = this.__destroy_into_raw();
455
+ wasm.__wbg_exportpem_free(ptr, 0);
456
+ }
457
+ /**
458
+ * @returns {Uint8Array}
459
+ */
460
+ get ark() {
461
+ const ret = wasm.__wbg_get_exportpem_ark(this.__wbg_ptr);
462
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
463
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
464
+ return v1;
465
+ }
466
+ /**
467
+ * @returns {Uint8Array}
468
+ */
469
+ get ask() {
470
+ const ret = wasm.__wbg_get_exportpem_ask(this.__wbg_ptr);
471
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
472
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
473
+ return v1;
474
+ }
475
+ /**
476
+ * @returns {Uint8Array}
477
+ */
478
+ get vek() {
479
+ const ret = wasm.__wbg_get_exportpem_vek(this.__wbg_ptr);
480
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
481
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
482
+ return v1;
483
+ }
484
+ /**
485
+ * @param {Uint8Array} arg0
486
+ */
487
+ set ark(arg0) {
488
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
489
+ const len0 = WASM_VECTOR_LEN;
490
+ wasm.__wbg_set_exportpem_ark(this.__wbg_ptr, ptr0, len0);
491
+ }
492
+ /**
493
+ * @param {Uint8Array} arg0
494
+ */
495
+ set ask(arg0) {
496
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
497
+ const len0 = WASM_VECTOR_LEN;
498
+ wasm.__wbg_set_exportpem_ask(this.__wbg_ptr, ptr0, len0);
499
+ }
500
+ /**
501
+ * @param {Uint8Array} arg0
502
+ */
503
+ set vek(arg0) {
504
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
505
+ const len0 = WASM_VECTOR_LEN;
506
+ wasm.__wbg_set_exportpem_vek(this.__wbg_ptr, ptr0, len0);
507
+ }
508
+ }
509
+ if (Symbol.dispose) ExportPem.prototype[Symbol.dispose] = ExportPem.prototype.free;
510
+ exports.ExportPem = ExportPem;
511
+
316
512
  class GatewayError {
317
513
  static __wrap(ptr) {
318
514
  ptr = ptr >>> 0;
@@ -366,6 +562,76 @@ const GpuModule = Object.freeze({
366
562
  });
367
563
  exports.GpuModule = GpuModule;
368
564
 
565
+ class Kds {
566
+ __destroy_into_raw() {
567
+ const ptr = this.__wbg_ptr;
568
+ this.__wbg_ptr = 0;
569
+ KdsFinalization.unregister(this);
570
+ return ptr;
571
+ }
572
+ free() {
573
+ const ptr = this.__destroy_into_raw();
574
+ wasm.__wbg_kds_free(ptr, 0);
575
+ }
576
+ /**
577
+ * @param {ParsedAttestation} attestation
578
+ * @returns {Promise<VerifiedChain>}
579
+ */
580
+ fetch_certificates(attestation) {
581
+ _assertClass(attestation, ParsedAttestation);
582
+ const ret = wasm.kds_fetch_certificates(this.__wbg_ptr, attestation.__wbg_ptr);
583
+ return ret;
584
+ }
585
+ /**
586
+ * Fetches the certificate revocation list from AMD's KDS
587
+ * @param {ParsedAttestation} attestation
588
+ * @returns {Promise<CRL>}
589
+ */
590
+ fetch_crl(attestation) {
591
+ _assertClass(attestation, ParsedAttestation);
592
+ const ret = wasm.kds_fetch_crl(this.__wbg_ptr, attestation.__wbg_ptr);
593
+ return ret;
594
+ }
595
+ /**
596
+ * @param {string} cache_url
597
+ */
598
+ constructor(cache_url) {
599
+ const ptr0 = passStringToWasm0(cache_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
600
+ const len0 = WASM_VECTOR_LEN;
601
+ const ret = wasm.kds_new(ptr0, len0);
602
+ if (ret[2]) {
603
+ throw takeFromExternrefTable0(ret[1]);
604
+ }
605
+ this.__wbg_ptr = ret[0] >>> 0;
606
+ KdsFinalization.register(this, this.__wbg_ptr, this);
607
+ return this;
608
+ }
609
+ }
610
+ if (Symbol.dispose) Kds.prototype[Symbol.dispose] = Kds.prototype.free;
611
+ exports.Kds = Kds;
612
+
613
+ class KeyChain {
614
+ static __wrap(ptr) {
615
+ ptr = ptr >>> 0;
616
+ const obj = Object.create(KeyChain.prototype);
617
+ obj.__wbg_ptr = ptr;
618
+ KeyChainFinalization.register(obj, obj.__wbg_ptr, obj);
619
+ return obj;
620
+ }
621
+ __destroy_into_raw() {
622
+ const ptr = this.__wbg_ptr;
623
+ this.__wbg_ptr = 0;
624
+ KeyChainFinalization.unregister(this);
625
+ return ptr;
626
+ }
627
+ free() {
628
+ const ptr = this.__destroy_into_raw();
629
+ wasm.__wbg_keychain_free(ptr, 0);
630
+ }
631
+ }
632
+ if (Symbol.dispose) KeyChain.prototype[Symbol.dispose] = KeyChain.prototype.free;
633
+ exports.KeyChain = KeyChain;
634
+
369
635
  class Modules {
370
636
  static __wrap(ptr) {
371
637
  ptr = ptr >>> 0;
@@ -431,210 +697,30 @@ class NvidiaAttestResult {
431
697
  if (Symbol.dispose) NvidiaAttestResult.prototype[Symbol.dispose] = NvidiaAttestResult.prototype.free;
432
698
  exports.NvidiaAttestResult = NvidiaAttestResult;
433
699
 
434
- class Pcs {
435
- __destroy_into_raw() {
436
- const ptr = this.__wbg_ptr;
437
- this.__wbg_ptr = 0;
438
- PcsFinalization.unregister(this);
439
- return ptr;
440
- }
441
- free() {
442
- const ptr = this.__destroy_into_raw();
443
- wasm.__wbg_pcs_free(ptr, 0);
444
- }
445
- /**
446
- * @param {TdxQuote} quote
447
- * @returns {Promise<Collateral>}
448
- */
449
- fetch_collateral(quote) {
450
- _assertClass(quote, TdxQuote);
451
- const ret = wasm.pcs_fetch_collateral(this.__wbg_ptr, quote.__wbg_ptr);
452
- return ret;
453
- }
454
- /**
455
- * @param {string} base_url
456
- */
457
- constructor(base_url) {
458
- const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
459
- const len0 = WASM_VECTOR_LEN;
460
- const ret = wasm.pcs_new(ptr0, len0);
461
- if (ret[2]) {
462
- throw takeFromExternrefTable0(ret[1]);
463
- }
464
- this.__wbg_ptr = ret[0] >>> 0;
465
- PcsFinalization.register(this, this.__wbg_ptr, this);
466
- return this;
467
- }
468
- }
469
- if (Symbol.dispose) Pcs.prototype[Symbol.dispose] = Pcs.prototype.free;
470
- exports.Pcs = Pcs;
471
-
472
- /**
473
- * Generic per-request query parameters.
474
- *
475
- * The `nonce` key is reserved and will be rejected.
476
- */
477
- class QueryParams {
478
- static __wrap(ptr) {
479
- ptr = ptr >>> 0;
480
- const obj = Object.create(QueryParams.prototype);
481
- obj.__wbg_ptr = ptr;
482
- QueryParamsFinalization.register(obj, obj.__wbg_ptr, obj);
483
- return obj;
484
- }
485
- __destroy_into_raw() {
486
- const ptr = this.__wbg_ptr;
487
- this.__wbg_ptr = 0;
488
- QueryParamsFinalization.unregister(this);
489
- return ptr;
490
- }
491
- free() {
492
- const ptr = this.__destroy_into_raw();
493
- wasm.__wbg_queryparams_free(ptr, 0);
494
- }
495
- constructor() {
496
- const ret = wasm.queryparams_new();
497
- this.__wbg_ptr = ret >>> 0;
498
- QueryParamsFinalization.register(this, this.__wbg_ptr, this);
499
- return this;
500
- }
501
- /**
502
- * Appends a query parameter.
503
- *
504
- * Reserved keywords for specific queries will get overwritten
505
- * @param {string} key
506
- * @param {string} value
507
- * @returns {QueryParams}
508
- */
509
- with(key, value) {
510
- const ptr = this.__destroy_into_raw();
511
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
512
- const len0 = WASM_VECTOR_LEN;
513
- const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
514
- const len1 = WASM_VECTOR_LEN;
515
- const ret = wasm.queryparams_with(ptr, ptr0, len0, ptr1, len1);
516
- return QueryParams.__wrap(ret);
517
- }
518
- }
519
- if (Symbol.dispose) QueryParams.prototype[Symbol.dispose] = QueryParams.prototype.free;
520
- exports.QueryParams = QueryParams;
521
-
522
- class QuoteVerifier {
523
- __destroy_into_raw() {
524
- const ptr = this.__wbg_ptr;
525
- this.__wbg_ptr = 0;
526
- QuoteVerifierFinalization.unregister(this);
527
- return ptr;
528
- }
529
- free() {
530
- const ptr = this.__destroy_into_raw();
531
- wasm.__wbg_quoteverifier_free(ptr, 0);
532
- }
533
- /**
534
- * @param {Collateral} collateral
535
- * @param {TdxQuote} quote
536
- */
537
- constructor(collateral, quote) {
538
- _assertClass(collateral, Collateral);
539
- var ptr0 = collateral.__destroy_into_raw();
540
- _assertClass(quote, TdxQuote);
541
- var ptr1 = quote.__destroy_into_raw();
542
- const ret = wasm.quoteverifier_new(ptr0, ptr1);
543
- this.__wbg_ptr = ret >>> 0;
544
- QuoteVerifierFinalization.register(this, this.__wbg_ptr, this);
545
- return this;
546
- }
547
- /**
548
- * @param {TdxNonce} nonce
549
- */
550
- verify(nonce) {
551
- _assertClass(nonce, TdxNonce);
552
- const ret = wasm.quoteverifier_verify(this.__wbg_ptr, nonce.__wbg_ptr);
553
- if (ret[1]) {
554
- throw takeFromExternrefTable0(ret[0]);
555
- }
556
- }
557
- }
558
- if (Symbol.dispose) QuoteVerifier.prototype[Symbol.dispose] = QuoteVerifier.prototype.free;
559
- exports.QuoteVerifier = QuoteVerifier;
560
-
561
- class ResponseHeaders {
700
+ class NvidiaNonce {
562
701
  static __wrap(ptr) {
563
702
  ptr = ptr >>> 0;
564
- const obj = Object.create(ResponseHeaders.prototype);
703
+ const obj = Object.create(NvidiaNonce.prototype);
565
704
  obj.__wbg_ptr = ptr;
566
- ResponseHeadersFinalization.register(obj, obj.__wbg_ptr, obj);
705
+ NvidiaNonceFinalization.register(obj, obj.__wbg_ptr, obj);
567
706
  return obj;
568
707
  }
569
708
  __destroy_into_raw() {
570
709
  const ptr = this.__wbg_ptr;
571
710
  this.__wbg_ptr = 0;
572
- ResponseHeadersFinalization.unregister(this);
711
+ NvidiaNonceFinalization.unregister(this);
573
712
  return ptr;
574
713
  }
575
714
  free() {
576
715
  const ptr = this.__destroy_into_raw();
577
- wasm.__wbg_responseheaders_free(ptr, 0);
578
- }
579
- /**
580
- * @param {string} name
581
- * @returns {string | undefined}
582
- */
583
- get(name) {
584
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
585
- const len0 = WASM_VECTOR_LEN;
586
- const ret = wasm.responseheaders_get(this.__wbg_ptr, ptr0, len0);
587
- let v2;
588
- if (ret[0] !== 0) {
589
- v2 = getStringFromWasm0(ret[0], ret[1]).slice();
590
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
591
- }
592
- return v2;
716
+ wasm.__wbg_nvidianonce_free(ptr, 0);
593
717
  }
594
718
  /**
595
- * @returns {string[]}
719
+ * @returns {NvidiaNonce}
596
720
  */
597
- keys() {
598
- const ret = wasm.responseheaders_keys(this.__wbg_ptr);
599
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
600
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
601
- return v1;
602
- }
603
- }
604
- if (Symbol.dispose) ResponseHeaders.prototype[Symbol.dispose] = ResponseHeaders.prototype.free;
605
- exports.ResponseHeaders = ResponseHeaders;
606
-
607
- class TcbLevels {
608
- __destroy_into_raw() {
609
- const ptr = this.__wbg_ptr;
610
- this.__wbg_ptr = 0;
611
- TcbLevelsFinalization.unregister(this);
612
- return ptr;
613
- }
614
- free() {
615
- const ptr = this.__destroy_into_raw();
616
- wasm.__wbg_tcblevels_free(ptr, 0);
617
- }
618
- }
619
- if (Symbol.dispose) TcbLevels.prototype[Symbol.dispose] = TcbLevels.prototype.free;
620
- exports.TcbLevels = TcbLevels;
621
-
622
- class TdxNonce {
623
- __destroy_into_raw() {
624
- const ptr = this.__wbg_ptr;
625
- this.__wbg_ptr = 0;
626
- TdxNonceFinalization.unregister(this);
627
- return ptr;
628
- }
629
- free() {
630
- const ptr = this.__destroy_into_raw();
631
- wasm.__wbg_tdxnonce_free(ptr, 0);
632
- }
633
- constructor() {
634
- const ret = wasm.tdxnonce_generate();
635
- this.__wbg_ptr = ret >>> 0;
636
- TdxNonceFinalization.register(this, this.__wbg_ptr, this);
637
- return this;
721
+ static generate() {
722
+ const ret = wasm.nvidianonce_generate();
723
+ return NvidiaNonce.__wrap(ret);
638
724
  }
639
725
  /**
640
726
  * @returns {string}
@@ -643,7 +729,7 @@ class TdxNonce {
643
729
  let deferred1_0;
644
730
  let deferred1_1;
645
731
  try {
646
- const ret = wasm.tdxnonce_to_hex(this.__wbg_ptr);
732
+ const ret = wasm.nvidianonce_to_hex(this.__wbg_ptr);
647
733
  deferred1_0 = ret[0];
648
734
  deferred1_1 = ret[1];
649
735
  return getStringFromWasm0(ret[0], ret[1]);
@@ -652,430 +738,248 @@ class TdxNonce {
652
738
  }
653
739
  }
654
740
  }
655
- if (Symbol.dispose) TdxNonce.prototype[Symbol.dispose] = TdxNonce.prototype.free;
656
- exports.TdxNonce = TdxNonce;
741
+ if (Symbol.dispose) NvidiaNonce.prototype[Symbol.dispose] = NvidiaNonce.prototype.free;
742
+ exports.NvidiaNonce = NvidiaNonce;
657
743
 
658
- class TdxQuote {
744
+ /**
745
+ * Represents a parsed attestation report with some already
746
+ * parsed commonly accessed fields
747
+ */
748
+ class ParsedAttestation {
659
749
  static __wrap(ptr) {
660
750
  ptr = ptr >>> 0;
661
- const obj = Object.create(TdxQuote.prototype);
751
+ const obj = Object.create(ParsedAttestation.prototype);
662
752
  obj.__wbg_ptr = ptr;
663
- TdxQuoteFinalization.register(obj, obj.__wbg_ptr, obj);
753
+ ParsedAttestationFinalization.register(obj, obj.__wbg_ptr, obj);
664
754
  return obj;
665
755
  }
666
756
  __destroy_into_raw() {
667
757
  const ptr = this.__wbg_ptr;
668
758
  this.__wbg_ptr = 0;
669
- TdxQuoteFinalization.unregister(this);
759
+ ParsedAttestationFinalization.unregister(this);
670
760
  return ptr;
671
761
  }
672
762
  free() {
673
763
  const ptr = this.__destroy_into_raw();
674
- wasm.__wbg_tdxquote_free(ptr, 0);
764
+ wasm.__wbg_parsedattestation_free(ptr, 0);
675
765
  }
676
766
  /**
677
- * Attempts to parse a quote from DCAP bytes.
678
- * @param {Uint8Array} quote
679
- * @returns {TdxQuote}
767
+ * @returns {number}
680
768
  */
681
- static from_bytes(quote) {
682
- const ptr0 = passArray8ToWasm0(quote, wasm.__wbindgen_malloc);
683
- const len0 = WASM_VECTOR_LEN;
684
- const ret = wasm.tdxquote_from_bytes(ptr0, len0);
685
- if (ret[2]) {
686
- throw takeFromExternrefTable0(ret[1]);
687
- }
688
- return TdxQuote.__wrap(ret[0]);
689
- }
690
- }
691
- if (Symbol.dispose) TdxQuote.prototype[Symbol.dispose] = TdxQuote.prototype.free;
692
- exports.TdxQuote = TdxQuote;
693
-
694
- class DecodedClaims {
695
- static __wrap(ptr) {
696
- ptr = ptr >>> 0;
697
- const obj = Object.create(DecodedClaims.prototype);
698
- obj.__wbg_ptr = ptr;
699
- DecodedClaimsFinalization.register(obj, obj.__wbg_ptr, obj);
700
- return obj;
701
- }
702
- __destroy_into_raw() {
703
- const ptr = this.__wbg_ptr;
704
- this.__wbg_ptr = 0;
705
- DecodedClaimsFinalization.unregister(this);
706
- return ptr;
707
- }
708
- free() {
709
- const ptr = this.__destroy_into_raw();
710
- wasm.__wbg_nvidia__decodedclaims_free(ptr, 0);
711
- }
712
- }
713
- if (Symbol.dispose) DecodedClaims.prototype[Symbol.dispose] = DecodedClaims.prototype.free;
714
-
715
- class EATToken {
716
- static __wrap(ptr) {
717
- ptr = ptr >>> 0;
718
- const obj = Object.create(EATToken.prototype);
719
- obj.__wbg_ptr = ptr;
720
- EATTokenFinalization.register(obj, obj.__wbg_ptr, obj);
721
- return obj;
722
- }
723
- __destroy_into_raw() {
724
- const ptr = this.__wbg_ptr;
725
- this.__wbg_ptr = 0;
726
- EATTokenFinalization.unregister(this);
727
- return ptr;
728
- }
729
- free() {
730
- const ptr = this.__destroy_into_raw();
731
- wasm.__wbg_nvidia__eattoken_free(ptr, 0);
769
+ cpu_fam_id() {
770
+ const ret = wasm.parsedattestation_cpu_fam_id(this.__wbg_ptr);
771
+ return ret;
732
772
  }
733
773
  /**
734
- * @param {string} from
735
- * @returns {EATToken}
774
+ * @returns {number}
736
775
  */
737
- static parse(from) {
738
- const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
739
- const len0 = WASM_VECTOR_LEN;
740
- const ret = wasm.eattoken_parse(ptr0, len0);
741
- if (ret[2]) {
742
- throw takeFromExternrefTable0(ret[1]);
743
- }
744
- return EATToken.__wrap(ret[0]);
776
+ cpu_mod_id() {
777
+ const ret = wasm.parsedattestation_cpu_mod_id(this.__wbg_ptr);
778
+ return ret;
745
779
  }
746
780
  /**
747
- * @param {KeyChain} keys
748
- * @param {NvidiaNonce} nonce
749
- * @returns {DecodedClaims}
781
+ * Parses and constructs a new attestation report from a stream of binary data
782
+ * @param {Uint8Array} bytes
783
+ * @returns {ParsedAttestation}
750
784
  */
751
- verify(keys, nonce) {
752
- const ptr = this.__destroy_into_raw();
753
- _assertClass(keys, KeyChain);
754
- _assertClass(nonce, NvidiaNonce);
755
- const ret = wasm.eattoken_verify(ptr, keys.__wbg_ptr, nonce.__wbg_ptr);
785
+ static new(bytes) {
786
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
787
+ const len0 = WASM_VECTOR_LEN;
788
+ const ret = wasm.parsedattestation_new(ptr0, len0);
756
789
  if (ret[2]) {
757
790
  throw takeFromExternrefTable0(ret[1]);
758
791
  }
759
- return DecodedClaims.__wrap(ret[0]);
760
- }
761
- }
762
- if (Symbol.dispose) EATToken.prototype[Symbol.dispose] = EATToken.prototype.free;
763
-
764
- class KeyChain {
765
- static __wrap(ptr) {
766
- ptr = ptr >>> 0;
767
- const obj = Object.create(KeyChain.prototype);
768
- obj.__wbg_ptr = ptr;
769
- KeyChainFinalization.register(obj, obj.__wbg_ptr, obj);
770
- return obj;
771
- }
772
- __destroy_into_raw() {
773
- const ptr = this.__wbg_ptr;
774
- this.__wbg_ptr = 0;
775
- KeyChainFinalization.unregister(this);
776
- return ptr;
777
- }
778
- free() {
779
- const ptr = this.__destroy_into_raw();
780
- wasm.__wbg_nvidia__keychain_free(ptr, 0);
781
- }
782
- }
783
- if (Symbol.dispose) KeyChain.prototype[Symbol.dispose] = KeyChain.prototype.free;
784
-
785
- class NvidiaNonce {
786
- static __wrap(ptr) {
787
- ptr = ptr >>> 0;
788
- const obj = Object.create(NvidiaNonce.prototype);
789
- obj.__wbg_ptr = ptr;
790
- NvidiaNonceFinalization.register(obj, obj.__wbg_ptr, obj);
791
- return obj;
792
- }
793
- __destroy_into_raw() {
794
- const ptr = this.__wbg_ptr;
795
- this.__wbg_ptr = 0;
796
- NvidiaNonceFinalization.unregister(this);
797
- return ptr;
798
- }
799
- free() {
800
- const ptr = this.__destroy_into_raw();
801
- wasm.__wbg_nvidia__nvidianonce_free(ptr, 0);
802
- }
803
- /**
804
- * @returns {NvidiaNonce}
805
- */
806
- static generate() {
807
- const ret = wasm.nvidianonce_generate();
808
- return NvidiaNonce.__wrap(ret);
792
+ return ParsedAttestation.__wrap(ret[0]);
809
793
  }
810
794
  /**
811
- * @returns {string}
795
+ * Verifies the attestation report against a certificate chain
796
+ * @param {VerifiedChain} chain
797
+ * @param {SevNonce} nonce
812
798
  */
813
- to_hex() {
814
- let deferred1_0;
815
- let deferred1_1;
816
- try {
817
- const ret = wasm.nvidianonce_to_hex(this.__wbg_ptr);
818
- deferred1_0 = ret[0];
819
- deferred1_1 = ret[1];
820
- return getStringFromWasm0(ret[0], ret[1]);
821
- } finally {
822
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
799
+ verify(chain, nonce) {
800
+ _assertClass(chain, VerifiedChain);
801
+ _assertClass(nonce, SevNonce);
802
+ const ret = wasm.parsedattestation_verify(this.__wbg_ptr, chain.__wbg_ptr, nonce.__wbg_ptr);
803
+ if (ret[1]) {
804
+ throw takeFromExternrefTable0(ret[0]);
823
805
  }
824
806
  }
825
807
  }
826
- if (Symbol.dispose) NvidiaNonce.prototype[Symbol.dispose] = NvidiaNonce.prototype.free;
827
-
828
- /**
829
- * Same as [`KeyChain:fetch_keychain`], put in for better wasm compatibility
830
- * @returns {Promise<KeyChain>}
831
- */
832
- function fetch_keychain() {
833
- const ret = wasm.nvidia__fetch_keychain();
834
- return ret;
835
- }
836
-
837
- const nvidia = {};
838
- nvidia.DecodedClaims = DecodedClaims;
839
- nvidia.EATToken = EATToken;
840
- nvidia.KeyChain = KeyChain;
841
- nvidia.NvidiaNonce = NvidiaNonce;
842
- nvidia.fetch_keychain = fetch_keychain;
843
- exports.nvidia = nvidia;
808
+ if (Symbol.dispose) ParsedAttestation.prototype[Symbol.dispose] = ParsedAttestation.prototype.free;
809
+ exports.ParsedAttestation = ParsedAttestation;
844
810
 
845
- /**
846
- * A parsed certificate revocation list
847
- */
848
- class CRL {
849
- static __wrap(ptr) {
850
- ptr = ptr >>> 0;
851
- const obj = Object.create(CRL.prototype);
852
- obj.__wbg_ptr = ptr;
853
- CRLFinalization.register(obj, obj.__wbg_ptr, obj);
854
- return obj;
855
- }
811
+ class Pcs {
856
812
  __destroy_into_raw() {
857
813
  const ptr = this.__wbg_ptr;
858
814
  this.__wbg_ptr = 0;
859
- CRLFinalization.unregister(this);
815
+ PcsFinalization.unregister(this);
860
816
  return ptr;
861
817
  }
862
818
  free() {
863
819
  const ptr = this.__destroy_into_raw();
864
- wasm.__wbg_sev__crl_free(ptr, 0);
820
+ wasm.__wbg_pcs_free(ptr, 0);
865
821
  }
866
822
  /**
867
- * Passes if the certificates are not in the certificate revocation list
868
- * Throws `AttestationError` on fail
869
- * @param {VerifiedChain} chain
823
+ * @param {TdxQuote} quote
824
+ * @returns {Promise<Collateral>}
870
825
  */
871
- check_chain(chain) {
872
- _assertClass(chain, VerifiedChain);
873
- const ret = wasm.crl_check_chain(this.__wbg_ptr, chain.__wbg_ptr);
874
- if (ret[1]) {
875
- throw takeFromExternrefTable0(ret[0]);
876
- }
826
+ fetch_collateral(quote) {
827
+ _assertClass(quote, TdxQuote);
828
+ const ret = wasm.pcs_fetch_collateral(this.__wbg_ptr, quote.__wbg_ptr);
829
+ return ret;
877
830
  }
878
831
  /**
879
- * Parses a certificate revocation list from DER format binary data
880
- * @param {Uint8Array} list
881
- * @returns {CRL}
832
+ * @param {string} base_url
882
833
  */
883
- static from_der(list) {
884
- const ptr0 = passArray8ToWasm0(list, wasm.__wbindgen_malloc);
834
+ constructor(base_url) {
835
+ const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
885
836
  const len0 = WASM_VECTOR_LEN;
886
- const ret = wasm.crl_from_der(ptr0, len0);
837
+ const ret = wasm.pcs_new(ptr0, len0);
887
838
  if (ret[2]) {
888
839
  throw takeFromExternrefTable0(ret[1]);
889
840
  }
890
- return CRL.__wrap(ret[0]);
841
+ this.__wbg_ptr = ret[0] >>> 0;
842
+ PcsFinalization.register(this, this.__wbg_ptr, this);
843
+ return this;
891
844
  }
892
845
  }
893
- if (Symbol.dispose) CRL.prototype[Symbol.dispose] = CRL.prototype.free;
846
+ if (Symbol.dispose) Pcs.prototype[Symbol.dispose] = Pcs.prototype.free;
847
+ exports.Pcs = Pcs;
894
848
 
895
- class ExportPem {
849
+ /**
850
+ * Generic per-request query parameters.
851
+ *
852
+ * The `nonce` key is reserved and will be rejected.
853
+ */
854
+ class QueryParams {
896
855
  static __wrap(ptr) {
897
856
  ptr = ptr >>> 0;
898
- const obj = Object.create(ExportPem.prototype);
857
+ const obj = Object.create(QueryParams.prototype);
899
858
  obj.__wbg_ptr = ptr;
900
- ExportPemFinalization.register(obj, obj.__wbg_ptr, obj);
859
+ QueryParamsFinalization.register(obj, obj.__wbg_ptr, obj);
901
860
  return obj;
902
861
  }
903
862
  __destroy_into_raw() {
904
863
  const ptr = this.__wbg_ptr;
905
864
  this.__wbg_ptr = 0;
906
- ExportPemFinalization.unregister(this);
865
+ QueryParamsFinalization.unregister(this);
907
866
  return ptr;
908
867
  }
909
868
  free() {
910
869
  const ptr = this.__destroy_into_raw();
911
- wasm.__wbg_sev__exportpem_free(ptr, 0);
912
- }
913
- /**
914
- * @returns {Uint8Array}
915
- */
916
- get ark() {
917
- const ret = wasm.__wbg_get_sev__exportpem_ark(this.__wbg_ptr);
918
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
919
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
920
- return v1;
921
- }
922
- /**
923
- * @returns {Uint8Array}
924
- */
925
- get ask() {
926
- const ret = wasm.__wbg_get_sev__exportpem_ask(this.__wbg_ptr);
927
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
928
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
929
- return v1;
930
- }
931
- /**
932
- * @returns {Uint8Array}
933
- */
934
- get vek() {
935
- const ret = wasm.__wbg_get_sev__exportpem_vek(this.__wbg_ptr);
936
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
937
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
938
- return v1;
939
- }
940
- /**
941
- * @param {Uint8Array} arg0
942
- */
943
- set ark(arg0) {
944
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
945
- const len0 = WASM_VECTOR_LEN;
946
- wasm.__wbg_set_sev__exportpem_ark(this.__wbg_ptr, ptr0, len0);
870
+ wasm.__wbg_queryparams_free(ptr, 0);
947
871
  }
948
- /**
949
- * @param {Uint8Array} arg0
950
- */
951
- set ask(arg0) {
952
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
953
- const len0 = WASM_VECTOR_LEN;
954
- wasm.__wbg_set_sev__exportpem_ask(this.__wbg_ptr, ptr0, len0);
872
+ constructor() {
873
+ const ret = wasm.queryparams_new();
874
+ this.__wbg_ptr = ret >>> 0;
875
+ QueryParamsFinalization.register(this, this.__wbg_ptr, this);
876
+ return this;
955
877
  }
956
878
  /**
957
- * @param {Uint8Array} arg0
879
+ * Appends a query parameter.
880
+ *
881
+ * Reserved keywords for specific queries will get overwritten
882
+ * @param {string} key
883
+ * @param {string} value
884
+ * @returns {QueryParams}
958
885
  */
959
- set vek(arg0) {
960
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
886
+ with(key, value) {
887
+ const ptr = this.__destroy_into_raw();
888
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
961
889
  const len0 = WASM_VECTOR_LEN;
962
- wasm.__wbg_set_sev__exportpem_vek(this.__wbg_ptr, ptr0, len0);
890
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
891
+ const len1 = WASM_VECTOR_LEN;
892
+ const ret = wasm.queryparams_with(ptr, ptr0, len0, ptr1, len1);
893
+ return QueryParams.__wrap(ret);
963
894
  }
964
895
  }
965
- if (Symbol.dispose) ExportPem.prototype[Symbol.dispose] = ExportPem.prototype.free;
896
+ if (Symbol.dispose) QueryParams.prototype[Symbol.dispose] = QueryParams.prototype.free;
897
+ exports.QueryParams = QueryParams;
966
898
 
967
- class Kds {
899
+ class QuoteVerifier {
968
900
  __destroy_into_raw() {
969
901
  const ptr = this.__wbg_ptr;
970
902
  this.__wbg_ptr = 0;
971
- KdsFinalization.unregister(this);
903
+ QuoteVerifierFinalization.unregister(this);
972
904
  return ptr;
973
905
  }
974
906
  free() {
975
907
  const ptr = this.__destroy_into_raw();
976
- wasm.__wbg_sev__kds_free(ptr, 0);
977
- }
978
- /**
979
- * @param {ParsedAttestation} attestation
980
- * @returns {Promise<VerifiedChain>}
981
- */
982
- fetch_certificates(attestation) {
983
- _assertClass(attestation, ParsedAttestation);
984
- const ret = wasm.kds_fetch_certificates(this.__wbg_ptr, attestation.__wbg_ptr);
985
- return ret;
908
+ wasm.__wbg_quoteverifier_free(ptr, 0);
986
909
  }
987
910
  /**
988
- * Fetches the certificate revocation list from AMD's KDS
989
- * @param {ParsedAttestation} attestation
990
- * @returns {Promise<CRL>}
911
+ * @param {Collateral} collateral
912
+ * @param {TdxQuote} quote
991
913
  */
992
- fetch_crl(attestation) {
993
- _assertClass(attestation, ParsedAttestation);
994
- const ret = wasm.kds_fetch_crl(this.__wbg_ptr, attestation.__wbg_ptr);
995
- return ret;
914
+ constructor(collateral, quote) {
915
+ _assertClass(collateral, Collateral);
916
+ var ptr0 = collateral.__destroy_into_raw();
917
+ _assertClass(quote, TdxQuote);
918
+ var ptr1 = quote.__destroy_into_raw();
919
+ const ret = wasm.quoteverifier_new(ptr0, ptr1);
920
+ this.__wbg_ptr = ret >>> 0;
921
+ QuoteVerifierFinalization.register(this, this.__wbg_ptr, this);
922
+ return this;
996
923
  }
997
924
  /**
998
- * @param {string} cache_url
925
+ * @param {TdxNonce} nonce
999
926
  */
1000
- constructor(cache_url) {
1001
- const ptr0 = passStringToWasm0(cache_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1002
- const len0 = WASM_VECTOR_LEN;
1003
- const ret = wasm.kds_new(ptr0, len0);
1004
- if (ret[2]) {
1005
- throw takeFromExternrefTable0(ret[1]);
927
+ verify(nonce) {
928
+ _assertClass(nonce, TdxNonce);
929
+ const ret = wasm.quoteverifier_verify(this.__wbg_ptr, nonce.__wbg_ptr);
930
+ if (ret[1]) {
931
+ throw takeFromExternrefTable0(ret[0]);
1006
932
  }
1007
- this.__wbg_ptr = ret[0] >>> 0;
1008
- KdsFinalization.register(this, this.__wbg_ptr, this);
1009
- return this;
1010
933
  }
1011
934
  }
1012
- if (Symbol.dispose) Kds.prototype[Symbol.dispose] = Kds.prototype.free;
935
+ if (Symbol.dispose) QuoteVerifier.prototype[Symbol.dispose] = QuoteVerifier.prototype.free;
936
+ exports.QuoteVerifier = QuoteVerifier;
1013
937
 
1014
- /**
1015
- * Represents a parsed attestation report with some already
1016
- * parsed commonly accessed fields
1017
- */
1018
- class ParsedAttestation {
938
+ class ResponseHeaders {
1019
939
  static __wrap(ptr) {
1020
940
  ptr = ptr >>> 0;
1021
- const obj = Object.create(ParsedAttestation.prototype);
941
+ const obj = Object.create(ResponseHeaders.prototype);
1022
942
  obj.__wbg_ptr = ptr;
1023
- ParsedAttestationFinalization.register(obj, obj.__wbg_ptr, obj);
943
+ ResponseHeadersFinalization.register(obj, obj.__wbg_ptr, obj);
1024
944
  return obj;
1025
945
  }
1026
946
  __destroy_into_raw() {
1027
947
  const ptr = this.__wbg_ptr;
1028
948
  this.__wbg_ptr = 0;
1029
- ParsedAttestationFinalization.unregister(this);
949
+ ResponseHeadersFinalization.unregister(this);
1030
950
  return ptr;
1031
951
  }
1032
952
  free() {
1033
953
  const ptr = this.__destroy_into_raw();
1034
- wasm.__wbg_sev__parsedattestation_free(ptr, 0);
1035
- }
1036
- /**
1037
- * @returns {number}
1038
- */
1039
- cpu_fam_id() {
1040
- const ret = wasm.parsedattestation_cpu_fam_id(this.__wbg_ptr);
1041
- return ret;
1042
- }
1043
- /**
1044
- * @returns {number}
1045
- */
1046
- cpu_mod_id() {
1047
- const ret = wasm.parsedattestation_cpu_mod_id(this.__wbg_ptr);
1048
- return ret;
954
+ wasm.__wbg_responseheaders_free(ptr, 0);
1049
955
  }
1050
956
  /**
1051
- * Parses and constructs a new attestation report from a stream of binary data
1052
- * @param {Uint8Array} bytes
1053
- * @returns {ParsedAttestation}
957
+ * @param {string} name
958
+ * @returns {string | undefined}
1054
959
  */
1055
- static new(bytes) {
1056
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
960
+ get(name) {
961
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1057
962
  const len0 = WASM_VECTOR_LEN;
1058
- const ret = wasm.parsedattestation_new(ptr0, len0);
1059
- if (ret[2]) {
1060
- throw takeFromExternrefTable0(ret[1]);
963
+ const ret = wasm.responseheaders_get(this.__wbg_ptr, ptr0, len0);
964
+ let v2;
965
+ if (ret[0] !== 0) {
966
+ v2 = getStringFromWasm0(ret[0], ret[1]).slice();
967
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1061
968
  }
1062
- return ParsedAttestation.__wrap(ret[0]);
969
+ return v2;
1063
970
  }
1064
971
  /**
1065
- * Verifies the attestation report against a certificate chain
1066
- * @param {VerifiedChain} chain
1067
- * @param {SevNonce} nonce
972
+ * @returns {string[]}
1068
973
  */
1069
- verify(chain, nonce) {
1070
- _assertClass(chain, VerifiedChain);
1071
- _assertClass(nonce, SevNonce);
1072
- const ret = wasm.parsedattestation_verify(this.__wbg_ptr, chain.__wbg_ptr, nonce.__wbg_ptr);
1073
- if (ret[1]) {
1074
- throw takeFromExternrefTable0(ret[0]);
1075
- }
974
+ keys() {
975
+ const ret = wasm.responseheaders_keys(this.__wbg_ptr);
976
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
977
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
978
+ return v1;
1076
979
  }
1077
980
  }
1078
- if (Symbol.dispose) ParsedAttestation.prototype[Symbol.dispose] = ParsedAttestation.prototype.free;
981
+ if (Symbol.dispose) ResponseHeaders.prototype[Symbol.dispose] = ResponseHeaders.prototype.free;
982
+ exports.ResponseHeaders = ResponseHeaders;
1079
983
 
1080
984
  class SevNonce {
1081
985
  static __wrap(ptr) {
@@ -1093,7 +997,7 @@ class SevNonce {
1093
997
  }
1094
998
  free() {
1095
999
  const ptr = this.__destroy_into_raw();
1096
- wasm.__wbg_sev__sevnonce_free(ptr, 0);
1000
+ wasm.__wbg_sevnonce_free(ptr, 0);
1097
1001
  }
1098
1002
  /**
1099
1003
  * @returns {SevNonce}
@@ -1119,6 +1023,94 @@ class SevNonce {
1119
1023
  }
1120
1024
  }
1121
1025
  if (Symbol.dispose) SevNonce.prototype[Symbol.dispose] = SevNonce.prototype.free;
1026
+ exports.SevNonce = SevNonce;
1027
+
1028
+ class TcbLevels {
1029
+ __destroy_into_raw() {
1030
+ const ptr = this.__wbg_ptr;
1031
+ this.__wbg_ptr = 0;
1032
+ TcbLevelsFinalization.unregister(this);
1033
+ return ptr;
1034
+ }
1035
+ free() {
1036
+ const ptr = this.__destroy_into_raw();
1037
+ wasm.__wbg_tcblevels_free(ptr, 0);
1038
+ }
1039
+ }
1040
+ if (Symbol.dispose) TcbLevels.prototype[Symbol.dispose] = TcbLevels.prototype.free;
1041
+ exports.TcbLevels = TcbLevels;
1042
+
1043
+ class TdxNonce {
1044
+ __destroy_into_raw() {
1045
+ const ptr = this.__wbg_ptr;
1046
+ this.__wbg_ptr = 0;
1047
+ TdxNonceFinalization.unregister(this);
1048
+ return ptr;
1049
+ }
1050
+ free() {
1051
+ const ptr = this.__destroy_into_raw();
1052
+ wasm.__wbg_tdxnonce_free(ptr, 0);
1053
+ }
1054
+ constructor() {
1055
+ const ret = wasm.tdxnonce_generate();
1056
+ this.__wbg_ptr = ret >>> 0;
1057
+ TdxNonceFinalization.register(this, this.__wbg_ptr, this);
1058
+ return this;
1059
+ }
1060
+ /**
1061
+ * @returns {string}
1062
+ */
1063
+ to_hex() {
1064
+ let deferred1_0;
1065
+ let deferred1_1;
1066
+ try {
1067
+ const ret = wasm.tdxnonce_to_hex(this.__wbg_ptr);
1068
+ deferred1_0 = ret[0];
1069
+ deferred1_1 = ret[1];
1070
+ return getStringFromWasm0(ret[0], ret[1]);
1071
+ } finally {
1072
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1073
+ }
1074
+ }
1075
+ }
1076
+ if (Symbol.dispose) TdxNonce.prototype[Symbol.dispose] = TdxNonce.prototype.free;
1077
+ exports.TdxNonce = TdxNonce;
1078
+
1079
+ class TdxQuote {
1080
+ static __wrap(ptr) {
1081
+ ptr = ptr >>> 0;
1082
+ const obj = Object.create(TdxQuote.prototype);
1083
+ obj.__wbg_ptr = ptr;
1084
+ TdxQuoteFinalization.register(obj, obj.__wbg_ptr, obj);
1085
+ return obj;
1086
+ }
1087
+ __destroy_into_raw() {
1088
+ const ptr = this.__wbg_ptr;
1089
+ this.__wbg_ptr = 0;
1090
+ TdxQuoteFinalization.unregister(this);
1091
+ return ptr;
1092
+ }
1093
+ free() {
1094
+ const ptr = this.__destroy_into_raw();
1095
+ wasm.__wbg_tdxquote_free(ptr, 0);
1096
+ }
1097
+ /**
1098
+ * Attempts to parse a quote from DCAP bytes.
1099
+ * @param {Uint8Array} quote
1100
+ * @returns {TdxQuote}
1101
+ */
1102
+ static from_bytes(quote) {
1103
+ const ptr0 = passArray8ToWasm0(quote, wasm.__wbindgen_malloc);
1104
+ const len0 = WASM_VECTOR_LEN;
1105
+ const ret = wasm.tdxquote_from_bytes(ptr0, len0);
1106
+ if (ret[2]) {
1107
+ throw takeFromExternrefTable0(ret[1]);
1108
+ }
1109
+ return TdxQuote.__wrap(ret[0]);
1110
+ }
1111
+ }
1112
+ if (Symbol.dispose) TdxQuote.prototype[Symbol.dispose] = TdxQuote.prototype.free;
1113
+ exports.TdxQuote = TdxQuote;
1122
1114
 
1123
1115
  /**
1124
1116
  * A chain which has been cryptographically verified
@@ -1139,7 +1131,7 @@ class VerifiedChain {
1139
1131
  }
1140
1132
  free() {
1141
1133
  const ptr = this.__destroy_into_raw();
1142
- wasm.__wbg_sev__verifiedchain_free(ptr, 0);
1134
+ wasm.__wbg_verifiedchain_free(ptr, 0);
1143
1135
  }
1144
1136
  /**
1145
1137
  * parses a triad of ark, ask and vek certificates in the PEM format,
@@ -1174,15 +1166,17 @@ class VerifiedChain {
1174
1166
  }
1175
1167
  }
1176
1168
  if (Symbol.dispose) VerifiedChain.prototype[Symbol.dispose] = VerifiedChain.prototype.free;
1169
+ exports.VerifiedChain = VerifiedChain;
1177
1170
 
1178
- const sev = {};
1179
- sev.CRL = CRL;
1180
- sev.ExportPem = ExportPem;
1181
- sev.Kds = Kds;
1182
- sev.ParsedAttestation = ParsedAttestation;
1183
- sev.SevNonce = SevNonce;
1184
- sev.VerifiedChain = VerifiedChain;
1185
- exports.sev = sev;
1171
+ /**
1172
+ * Same as [`KeyChain:fetch_keychain`], put in for better wasm compatibility
1173
+ * @returns {Promise<KeyChain>}
1174
+ */
1175
+ function fetch_keychain() {
1176
+ const ret = wasm.fetch_keychain();
1177
+ return ret;
1178
+ }
1179
+ exports.fetch_keychain = fetch_keychain;
1186
1180
 
1187
1181
  function __wbg_get_imports() {
1188
1182
  const import0 = {
@@ -1266,6 +1260,10 @@ function __wbg_get_imports() {
1266
1260
  const ret = Collateral.__wrap(arg0);
1267
1261
  return ret;
1268
1262
  },
1263
+ __wbg_crl_new: function(arg0) {
1264
+ const ret = CRL.__wrap(arg0);
1265
+ return ret;
1266
+ },
1269
1267
  __wbg_crypto_48300657fced39f9: function(arg0) {
1270
1268
  const ret = arg0.crypto;
1271
1269
  return ret;
@@ -1338,6 +1336,10 @@ function __wbg_get_imports() {
1338
1336
  const ret = Symbol.iterator;
1339
1337
  return ret;
1340
1338
  },
1339
+ __wbg_keychain_new: function(arg0) {
1340
+ const ret = KeyChain.__wrap(arg0);
1341
+ return ret;
1342
+ },
1341
1343
  __wbg_length_0c32cb8543c8e4c8: function(arg0) {
1342
1344
  const ret = arg0.length;
1343
1345
  return ret;
@@ -1416,14 +1418,14 @@ function __wbg_get_imports() {
1416
1418
  const ret = arg0.node;
1417
1419
  return ret;
1418
1420
  },
1419
- __wbg_nvidia__keychain_new: function(arg0) {
1420
- const ret = KeyChain.__wrap(arg0);
1421
- return ret;
1422
- },
1423
1421
  __wbg_nvidiaattestresult_new: function(arg0) {
1424
1422
  const ret = NvidiaAttestResult.__wrap(arg0);
1425
1423
  return ret;
1426
1424
  },
1425
+ __wbg_parsedattestation_new: function(arg0) {
1426
+ const ret = ParsedAttestation.__wrap(arg0);
1427
+ return ret;
1428
+ },
1427
1429
  __wbg_process_b2fea42461d03994: function(arg0) {
1428
1430
  const ret = arg0.process;
1429
1431
  return ret;
@@ -1492,18 +1494,6 @@ function __wbg_get_imports() {
1492
1494
  __wbg_set_signal_8564a226c5c6853c: function(arg0, arg1) {
1493
1495
  arg0.signal = arg1;
1494
1496
  },
1495
- __wbg_sev__crl_new: function(arg0) {
1496
- const ret = CRL.__wrap(arg0);
1497
- return ret;
1498
- },
1499
- __wbg_sev__parsedattestation_new: function(arg0) {
1500
- const ret = ParsedAttestation.__wrap(arg0);
1501
- return ret;
1502
- },
1503
- __wbg_sev__verifiedchain_new: function(arg0) {
1504
- const ret = VerifiedChain.__wrap(arg0);
1505
- return ret;
1506
- },
1507
1497
  __wbg_signal_9172c3282bfba2f5: function(arg0) {
1508
1498
  const ret = arg0.signal;
1509
1499
  return ret;
@@ -1563,6 +1553,10 @@ function __wbg_get_imports() {
1563
1553
  const ret = arg0.value;
1564
1554
  return ret;
1565
1555
  },
1556
+ __wbg_verifiedchain_new: function(arg0) {
1557
+ const ret = VerifiedChain.__wrap(arg0);
1558
+ return ret;
1559
+ },
1566
1560
  __wbg_versions_215a3ab1c9d5745a: function(arg0) {
1567
1561
  const ret = arg0.versions;
1568
1562
  return ret;
@@ -1650,7 +1644,7 @@ const AttestResultFinalization = (typeof FinalizationRegistry === 'undefined')
1650
1644
  : new FinalizationRegistry(ptr => wasm.__wbg_attestresult_free(ptr >>> 0, 1));
1651
1645
  const CRLFinalization = (typeof FinalizationRegistry === 'undefined')
1652
1646
  ? { register: () => {}, unregister: () => {} }
1653
- : new FinalizationRegistry(ptr => wasm.__wbg_sev__crl_free(ptr >>> 0, 1));
1647
+ : new FinalizationRegistry(ptr => wasm.__wbg_crl_free(ptr >>> 0, 1));
1654
1648
  const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
1655
1649
  ? { register: () => {}, unregister: () => {} }
1656
1650
  : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
@@ -1662,22 +1656,22 @@ const CollateralFinalization = (typeof FinalizationRegistry === 'undefined')
1662
1656
  : new FinalizationRegistry(ptr => wasm.__wbg_collateral_free(ptr >>> 0, 1));
1663
1657
  const DecodedClaimsFinalization = (typeof FinalizationRegistry === 'undefined')
1664
1658
  ? { register: () => {}, unregister: () => {} }
1665
- : new FinalizationRegistry(ptr => wasm.__wbg_nvidia__decodedclaims_free(ptr >>> 0, 1));
1659
+ : new FinalizationRegistry(ptr => wasm.__wbg_decodedclaims_free(ptr >>> 0, 1));
1666
1660
  const EATTokenFinalization = (typeof FinalizationRegistry === 'undefined')
1667
1661
  ? { register: () => {}, unregister: () => {} }
1668
- : new FinalizationRegistry(ptr => wasm.__wbg_nvidia__eattoken_free(ptr >>> 0, 1));
1662
+ : new FinalizationRegistry(ptr => wasm.__wbg_eattoken_free(ptr >>> 0, 1));
1669
1663
  const ExportPemFinalization = (typeof FinalizationRegistry === 'undefined')
1670
1664
  ? { register: () => {}, unregister: () => {} }
1671
- : new FinalizationRegistry(ptr => wasm.__wbg_sev__exportpem_free(ptr >>> 0, 1));
1665
+ : new FinalizationRegistry(ptr => wasm.__wbg_exportpem_free(ptr >>> 0, 1));
1672
1666
  const GatewayErrorFinalization = (typeof FinalizationRegistry === 'undefined')
1673
1667
  ? { register: () => {}, unregister: () => {} }
1674
1668
  : new FinalizationRegistry(ptr => wasm.__wbg_gatewayerror_free(ptr >>> 0, 1));
1675
1669
  const KdsFinalization = (typeof FinalizationRegistry === 'undefined')
1676
1670
  ? { register: () => {}, unregister: () => {} }
1677
- : new FinalizationRegistry(ptr => wasm.__wbg_sev__kds_free(ptr >>> 0, 1));
1671
+ : new FinalizationRegistry(ptr => wasm.__wbg_kds_free(ptr >>> 0, 1));
1678
1672
  const KeyChainFinalization = (typeof FinalizationRegistry === 'undefined')
1679
1673
  ? { register: () => {}, unregister: () => {} }
1680
- : new FinalizationRegistry(ptr => wasm.__wbg_nvidia__keychain_free(ptr >>> 0, 1));
1674
+ : new FinalizationRegistry(ptr => wasm.__wbg_keychain_free(ptr >>> 0, 1));
1681
1675
  const ModulesFinalization = (typeof FinalizationRegistry === 'undefined')
1682
1676
  ? { register: () => {}, unregister: () => {} }
1683
1677
  : new FinalizationRegistry(ptr => wasm.__wbg_modules_free(ptr >>> 0, 1));
@@ -1686,10 +1680,10 @@ const NvidiaAttestResultFinalization = (typeof FinalizationRegistry === 'undefin
1686
1680
  : new FinalizationRegistry(ptr => wasm.__wbg_nvidiaattestresult_free(ptr >>> 0, 1));
1687
1681
  const NvidiaNonceFinalization = (typeof FinalizationRegistry === 'undefined')
1688
1682
  ? { register: () => {}, unregister: () => {} }
1689
- : new FinalizationRegistry(ptr => wasm.__wbg_nvidia__nvidianonce_free(ptr >>> 0, 1));
1683
+ : new FinalizationRegistry(ptr => wasm.__wbg_nvidianonce_free(ptr >>> 0, 1));
1690
1684
  const ParsedAttestationFinalization = (typeof FinalizationRegistry === 'undefined')
1691
1685
  ? { register: () => {}, unregister: () => {} }
1692
- : new FinalizationRegistry(ptr => wasm.__wbg_sev__parsedattestation_free(ptr >>> 0, 1));
1686
+ : new FinalizationRegistry(ptr => wasm.__wbg_parsedattestation_free(ptr >>> 0, 1));
1693
1687
  const PcsFinalization = (typeof FinalizationRegistry === 'undefined')
1694
1688
  ? { register: () => {}, unregister: () => {} }
1695
1689
  : new FinalizationRegistry(ptr => wasm.__wbg_pcs_free(ptr >>> 0, 1));
@@ -1704,7 +1698,7 @@ const ResponseHeadersFinalization = (typeof FinalizationRegistry === 'undefined'
1704
1698
  : new FinalizationRegistry(ptr => wasm.__wbg_responseheaders_free(ptr >>> 0, 1));
1705
1699
  const SevNonceFinalization = (typeof FinalizationRegistry === 'undefined')
1706
1700
  ? { register: () => {}, unregister: () => {} }
1707
- : new FinalizationRegistry(ptr => wasm.__wbg_sev__sevnonce_free(ptr >>> 0, 1));
1701
+ : new FinalizationRegistry(ptr => wasm.__wbg_sevnonce_free(ptr >>> 0, 1));
1708
1702
  const TcbLevelsFinalization = (typeof FinalizationRegistry === 'undefined')
1709
1703
  ? { register: () => {}, unregister: () => {} }
1710
1704
  : new FinalizationRegistry(ptr => wasm.__wbg_tcblevels_free(ptr >>> 0, 1));
@@ -1716,7 +1710,7 @@ const TdxQuoteFinalization = (typeof FinalizationRegistry === 'undefined')
1716
1710
  : new FinalizationRegistry(ptr => wasm.__wbg_tdxquote_free(ptr >>> 0, 1));
1717
1711
  const VerifiedChainFinalization = (typeof FinalizationRegistry === 'undefined')
1718
1712
  ? { register: () => {}, unregister: () => {} }
1719
- : new FinalizationRegistry(ptr => wasm.__wbg_sev__verifiedchain_free(ptr >>> 0, 1));
1713
+ : new FinalizationRegistry(ptr => wasm.__wbg_verifiedchain_free(ptr >>> 0, 1));
1720
1714
 
1721
1715
  function addToExternrefTable0(obj) {
1722
1716
  const idx = wasm.__externref_table_alloc();