@opendatalabs/personal-server-ts-core 1.9.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/derivatives/compute.d.ts.map +1 -1
  2. package/dist/derivatives/compute.js +10 -3
  3. package/dist/derivatives/compute.js.map +1 -1
  4. package/dist/derivatives/e2ee/aad.d.ts +22 -0
  5. package/dist/derivatives/e2ee/aad.d.ts.map +1 -0
  6. package/dist/derivatives/e2ee/aad.js +32 -0
  7. package/dist/derivatives/e2ee/aad.js.map +1 -0
  8. package/dist/derivatives/e2ee/attestation.d.ts +134 -0
  9. package/dist/derivatives/e2ee/attestation.d.ts.map +1 -0
  10. package/dist/derivatives/e2ee/attestation.js +248 -0
  11. package/dist/derivatives/e2ee/attestation.js.map +1 -0
  12. package/dist/derivatives/e2ee/index.d.ts +6 -0
  13. package/dist/derivatives/e2ee/index.d.ts.map +1 -0
  14. package/dist/derivatives/e2ee/index.js +6 -0
  15. package/dist/derivatives/e2ee/index.js.map +1 -0
  16. package/dist/derivatives/e2ee/jcs.d.ts +17 -0
  17. package/dist/derivatives/e2ee/jcs.d.ts.map +1 -0
  18. package/dist/derivatives/e2ee/jcs.js +55 -0
  19. package/dist/derivatives/e2ee/jcs.js.map +1 -0
  20. package/dist/derivatives/e2ee/phala.d.ts +62 -0
  21. package/dist/derivatives/e2ee/phala.d.ts.map +1 -0
  22. package/dist/derivatives/e2ee/phala.js +168 -0
  23. package/dist/derivatives/e2ee/phala.js.map +1 -0
  24. package/dist/derivatives/e2ee/suite.d.ts +56 -0
  25. package/dist/derivatives/e2ee/suite.d.ts.map +1 -0
  26. package/dist/derivatives/e2ee/suite.js +164 -0
  27. package/dist/derivatives/e2ee/suite.js.map +1 -0
  28. package/dist/derivatives/index.d.ts +2 -1
  29. package/dist/derivatives/index.d.ts.map +1 -1
  30. package/dist/derivatives/index.js +1 -0
  31. package/dist/derivatives/index.js.map +1 -1
  32. package/dist/derivatives/inference.d.ts +65 -16
  33. package/dist/derivatives/inference.d.ts.map +1 -1
  34. package/dist/derivatives/inference.js +171 -68
  35. package/dist/derivatives/inference.js.map +1 -1
  36. package/dist/schemas/server-config.d.ts +2 -0
  37. package/dist/schemas/server-config.d.ts.map +1 -1
  38. package/dist/schemas/server-config.js +5 -0
  39. package/dist/schemas/server-config.js.map +1 -1
  40. package/dist/signing/index.d.ts +1 -1
  41. package/dist/signing/index.d.ts.map +1 -1
  42. package/dist/signing/index.js.map +1 -1
  43. package/dist/test-utils/e2ee-fixtures.d.ts +94 -0
  44. package/dist/test-utils/e2ee-fixtures.d.ts.map +1 -0
  45. package/dist/test-utils/e2ee-fixtures.js +116 -0
  46. package/dist/test-utils/e2ee-fixtures.js.map +1 -0
  47. package/dist/test-utils/e2ee-gateway.d.ts +61 -0
  48. package/dist/test-utils/e2ee-gateway.d.ts.map +1 -0
  49. package/dist/test-utils/e2ee-gateway.js +248 -0
  50. package/dist/test-utils/e2ee-gateway.js.map +1 -0
  51. package/dist/test-utils/index.d.ts +2 -0
  52. package/dist/test-utils/index.d.ts.map +1 -1
  53. package/dist/test-utils/index.js +2 -0
  54. package/dist/test-utils/index.js.map +1 -1
  55. package/package.json +1 -1
@@ -0,0 +1,94 @@
1
+ /**
2
+ * A real `GET /v1/aci/attestation?nonce=...` report captured from
3
+ * https://inference.phala.com on 2026-08-28 (the TDX quote, event log,
4
+ * app compose and vm config are omitted: they are not part of the
5
+ * structural binding chain). The nonce below is the one the report was
6
+ * requested with, so `report_data` recomputes from the keyset digest.
7
+ */
8
+ export declare const LIVE_ACI_ATTESTATION_NONCE = "434fe0866976bf566484a1f11dbb0a55d9d4554b84f25ccd1ddd9095375722b1";
9
+ /** Unix seconds inside the fixture keyset's validity window. */
10
+ export declare const LIVE_ACI_ATTESTATION_CLOCK_S = 1788220800;
11
+ export declare const LIVE_ACI_X25519_PUBLIC_KEY_HEX = "408e82d159832cfae15007781bcade0badee7d50e9f76d50eaa1777464006537";
12
+ export declare const LIVE_ACI_ATTESTATION_REPORT: {
13
+ readonly api_version: "aci/1";
14
+ readonly workload_keyset_digest: "sha256:4f3dc45eeb18a5aefa49dfe5c0f2b6dbc77dd37276adc0cee87f1c1f70b73072";
15
+ readonly attestation: {
16
+ readonly tee_type: "tdx";
17
+ readonly workload_keyset: {
18
+ readonly subject: null;
19
+ readonly not_after: 1790498751;
20
+ readonly receipt_signing_keys: readonly [{
21
+ readonly key_id: "dstack-kms-receipt-ed25519-v1";
22
+ readonly algo: "ed25519";
23
+ readonly public_key: "110f3824daeeef29dbeba9677a5794ffed257b1082d9fd4599b3c0819953aa0a";
24
+ }];
25
+ readonly e2ee_public_keys: readonly [{
26
+ readonly key_id: "dstack-kms-e2ee-v1";
27
+ readonly algo: "secp256k1-aes-256-gcm-hkdf-sha256";
28
+ readonly public_key: "04943cea0b4babf60f6e2031e9a00866a37c4ae696fb45895b3a9b38ab8cbb898f42c85b704aceaa0a396cf26f7fdf79d83205be7e11d3a5d70419a68277158c3d";
29
+ }, {
30
+ readonly key_id: "dstack-kms-e2ee-x25519-v1";
31
+ readonly algo: "x25519-aes-256-gcm-hkdf-sha256";
32
+ readonly public_key: "408e82d159832cfae15007781bcade0badee7d50e9f76d50eaa1777464006537";
33
+ }];
34
+ readonly tls_public_keys: readonly [{
35
+ readonly spki_sha256: "4586d125aaef3d1b33a3c34f12a5c235af3016dddd35e56a99b6b3ed3ba57dcb";
36
+ readonly domain: "tee.redpill.ai";
37
+ }, {
38
+ readonly spki_sha256: "8e89a8a01e12098065037be187dcd2f03071dc1e7c9bb8527160f4c56ebc728f";
39
+ readonly domain: "inference.phala.com";
40
+ }, {
41
+ readonly spki_sha256: "e52fdca52c039def33e51cd2b5eded43eae1949030e47866f5f09e90b6940a88";
42
+ readonly domain: "api.redpill.ai";
43
+ }];
44
+ };
45
+ readonly report_data: "9ba90c1e314b8feb6c48be5de2f6b41d7174103056845e27d6e835c4202e5954";
46
+ readonly source_provenance: {
47
+ readonly repo_url: "https://github.com/Dstack-TEE/private-ai-gateway.git";
48
+ readonly repo_commit: "d567f6b4c4d93e33037ea202db04db86a8ad881c";
49
+ readonly image_digest: null;
50
+ readonly image_provenance: null;
51
+ };
52
+ readonly evidence: {
53
+ readonly quote_report_data: "9ba90c1e314b8feb6c48be5de2f6b41d7174103056845e27d6e835c4202e59540000000000000000000000000000000000000000000000000000000000000000";
54
+ readonly key_custody: {
55
+ readonly provider: "dstack-kms";
56
+ readonly keys: readonly [{
57
+ readonly role: "receipt";
58
+ readonly path: "aci/receipt-ed25519/v1";
59
+ readonly purpose: "aci.receipt.ed25519.v1";
60
+ readonly algo: "ed25519";
61
+ readonly public_key: "110f3824daeeef29dbeba9677a5794ffed257b1082d9fd4599b3c0819953aa0a";
62
+ readonly kms_public_key: "02f7fb3ed8c352d316dfdc19458a9f29c06eb7e74130b3808d784e2fd401a2c12d";
63
+ readonly signature_chain: readonly ["d1f59335effc2688acdf502ee34d8d3373b0e7e6be493075383714ce5673a29973f224690437c483ae3fdd37172df3abad82877c4023ed7c5a64d5acaf18477c00", "5c2fe36bdb1e434c0a371579bcbce07c4e7b89eba45affa089191baec84f23ad77b24a594aa28427b6b7a5f348b0ecf5597abfd9a2add05ddb55c521ba38a38501"];
64
+ }, {
65
+ readonly role: "e2ee-secp256k1";
66
+ readonly path: "aci/e2ee/v1";
67
+ readonly purpose: "aci.e2ee.v1";
68
+ readonly algo: "secp256k1-aes-256-gcm-hkdf-sha256";
69
+ readonly public_key: "04943cea0b4babf60f6e2031e9a00866a37c4ae696fb45895b3a9b38ab8cbb898f42c85b704aceaa0a396cf26f7fdf79d83205be7e11d3a5d70419a68277158c3d";
70
+ readonly kms_public_key: "03943cea0b4babf60f6e2031e9a00866a37c4ae696fb45895b3a9b38ab8cbb898f";
71
+ readonly signature_chain: readonly ["452d6f86a807fef0ce0d65e6c5cd25a0a249b1fd8608d26c3efe17fc10346f4c2d3dfb8969d10dc1feac1d595b3816f63faa40ac370a3a233ce1d712d418c89701", "5c2fe36bdb1e434c0a371579bcbce07c4e7b89eba45affa089191baec84f23ad77b24a594aa28427b6b7a5f348b0ecf5597abfd9a2add05ddb55c521ba38a38501"];
72
+ }, {
73
+ readonly role: "e2ee-x25519";
74
+ readonly path: "aci/e2ee-x25519/v1";
75
+ readonly purpose: "aci.e2ee.x25519.v1";
76
+ readonly algo: "x25519-aes-256-gcm-hkdf-sha256";
77
+ readonly public_key: "408e82d159832cfae15007781bcade0badee7d50e9f76d50eaa1777464006537";
78
+ readonly kms_public_key: "03892f86b3f55f78cc0760cec933cf8e2a92862fb173c2d221cc25895847cbb5eb";
79
+ readonly signature_chain: readonly ["358cd661ca4f5e986ed950ca083bf7bcfef6ab4b839ca11a953b156d64f82b1c51a213730d5777b4c845170827680d41e8220c2f950a38081025ff16eb3789ba00", "5c2fe36bdb1e434c0a371579bcbce07c4e7b89eba45affa089191baec84f23ad77b24a594aa28427b6b7a5f348b0ecf5597abfd9a2add05ddb55c521ba38a38501"];
80
+ }];
81
+ };
82
+ readonly downstream_tls_binding: {
83
+ readonly domain: "inference.phala.com";
84
+ readonly spki_sha256: "8e89a8a01e12098065037be187dcd2f03071dc1e7c9bb8527160f4c56ebc728f";
85
+ };
86
+ readonly quote: "<omitted in fixture>";
87
+ };
88
+ };
89
+ readonly service_capabilities: {
90
+ readonly supported_e2ee_versions: readonly ["2"];
91
+ readonly serving: "aggregator";
92
+ };
93
+ };
94
+ //# sourceMappingURL=e2ee-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2ee-fixtures.d.ts","sourceRoot":"","sources":["../../src/test-utils/e2ee-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,0BAA0B,qEAC6B,CAAC;AAErE,gEAAgE;AAChE,eAAO,MAAM,4BAA4B,aAAa,CAAC;AAEvD,eAAO,MAAM,8BAA8B,qEACyB,CAAC;AAErE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuH9B,CAAC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * A real `GET /v1/aci/attestation?nonce=...` report captured from
3
+ * https://inference.phala.com on 2026-08-28 (the TDX quote, event log,
4
+ * app compose and vm config are omitted: they are not part of the
5
+ * structural binding chain). The nonce below is the one the report was
6
+ * requested with, so `report_data` recomputes from the keyset digest.
7
+ */
8
+ export const LIVE_ACI_ATTESTATION_NONCE = "434fe0866976bf566484a1f11dbb0a55d9d4554b84f25ccd1ddd9095375722b1";
9
+ /** Unix seconds inside the fixture keyset's validity window. */
10
+ export const LIVE_ACI_ATTESTATION_CLOCK_S = 1788220800;
11
+ export const LIVE_ACI_X25519_PUBLIC_KEY_HEX = "408e82d159832cfae15007781bcade0badee7d50e9f76d50eaa1777464006537";
12
+ export const LIVE_ACI_ATTESTATION_REPORT = {
13
+ api_version: "aci/1",
14
+ workload_keyset_digest: "sha256:4f3dc45eeb18a5aefa49dfe5c0f2b6dbc77dd37276adc0cee87f1c1f70b73072",
15
+ attestation: {
16
+ tee_type: "tdx",
17
+ workload_keyset: {
18
+ subject: null,
19
+ not_after: 1790498751,
20
+ receipt_signing_keys: [
21
+ {
22
+ key_id: "dstack-kms-receipt-ed25519-v1",
23
+ algo: "ed25519",
24
+ public_key: "110f3824daeeef29dbeba9677a5794ffed257b1082d9fd4599b3c0819953aa0a",
25
+ },
26
+ ],
27
+ e2ee_public_keys: [
28
+ {
29
+ key_id: "dstack-kms-e2ee-v1",
30
+ algo: "secp256k1-aes-256-gcm-hkdf-sha256",
31
+ public_key: "04943cea0b4babf60f6e2031e9a00866a37c4ae696fb45895b3a9b38ab8cbb898f42c85b704aceaa0a396cf26f7fdf79d83205be7e11d3a5d70419a68277158c3d",
32
+ },
33
+ {
34
+ key_id: "dstack-kms-e2ee-x25519-v1",
35
+ algo: "x25519-aes-256-gcm-hkdf-sha256",
36
+ public_key: "408e82d159832cfae15007781bcade0badee7d50e9f76d50eaa1777464006537",
37
+ },
38
+ ],
39
+ tls_public_keys: [
40
+ {
41
+ spki_sha256: "4586d125aaef3d1b33a3c34f12a5c235af3016dddd35e56a99b6b3ed3ba57dcb",
42
+ domain: "tee.redpill.ai",
43
+ },
44
+ {
45
+ spki_sha256: "8e89a8a01e12098065037be187dcd2f03071dc1e7c9bb8527160f4c56ebc728f",
46
+ domain: "inference.phala.com",
47
+ },
48
+ {
49
+ spki_sha256: "e52fdca52c039def33e51cd2b5eded43eae1949030e47866f5f09e90b6940a88",
50
+ domain: "api.redpill.ai",
51
+ },
52
+ ],
53
+ },
54
+ report_data: "9ba90c1e314b8feb6c48be5de2f6b41d7174103056845e27d6e835c4202e5954",
55
+ source_provenance: {
56
+ repo_url: "https://github.com/Dstack-TEE/private-ai-gateway.git",
57
+ repo_commit: "d567f6b4c4d93e33037ea202db04db86a8ad881c",
58
+ image_digest: null,
59
+ image_provenance: null,
60
+ },
61
+ evidence: {
62
+ quote_report_data: "9ba90c1e314b8feb6c48be5de2f6b41d7174103056845e27d6e835c4202e59540000000000000000000000000000000000000000000000000000000000000000",
63
+ key_custody: {
64
+ provider: "dstack-kms",
65
+ keys: [
66
+ {
67
+ role: "receipt",
68
+ path: "aci/receipt-ed25519/v1",
69
+ purpose: "aci.receipt.ed25519.v1",
70
+ algo: "ed25519",
71
+ public_key: "110f3824daeeef29dbeba9677a5794ffed257b1082d9fd4599b3c0819953aa0a",
72
+ kms_public_key: "02f7fb3ed8c352d316dfdc19458a9f29c06eb7e74130b3808d784e2fd401a2c12d",
73
+ signature_chain: [
74
+ "d1f59335effc2688acdf502ee34d8d3373b0e7e6be493075383714ce5673a29973f224690437c483ae3fdd37172df3abad82877c4023ed7c5a64d5acaf18477c00",
75
+ "5c2fe36bdb1e434c0a371579bcbce07c4e7b89eba45affa089191baec84f23ad77b24a594aa28427b6b7a5f348b0ecf5597abfd9a2add05ddb55c521ba38a38501",
76
+ ],
77
+ },
78
+ {
79
+ role: "e2ee-secp256k1",
80
+ path: "aci/e2ee/v1",
81
+ purpose: "aci.e2ee.v1",
82
+ algo: "secp256k1-aes-256-gcm-hkdf-sha256",
83
+ public_key: "04943cea0b4babf60f6e2031e9a00866a37c4ae696fb45895b3a9b38ab8cbb898f42c85b704aceaa0a396cf26f7fdf79d83205be7e11d3a5d70419a68277158c3d",
84
+ kms_public_key: "03943cea0b4babf60f6e2031e9a00866a37c4ae696fb45895b3a9b38ab8cbb898f",
85
+ signature_chain: [
86
+ "452d6f86a807fef0ce0d65e6c5cd25a0a249b1fd8608d26c3efe17fc10346f4c2d3dfb8969d10dc1feac1d595b3816f63faa40ac370a3a233ce1d712d418c89701",
87
+ "5c2fe36bdb1e434c0a371579bcbce07c4e7b89eba45affa089191baec84f23ad77b24a594aa28427b6b7a5f348b0ecf5597abfd9a2add05ddb55c521ba38a38501",
88
+ ],
89
+ },
90
+ {
91
+ role: "e2ee-x25519",
92
+ path: "aci/e2ee-x25519/v1",
93
+ purpose: "aci.e2ee.x25519.v1",
94
+ algo: "x25519-aes-256-gcm-hkdf-sha256",
95
+ public_key: "408e82d159832cfae15007781bcade0badee7d50e9f76d50eaa1777464006537",
96
+ kms_public_key: "03892f86b3f55f78cc0760cec933cf8e2a92862fb173c2d221cc25895847cbb5eb",
97
+ signature_chain: [
98
+ "358cd661ca4f5e986ed950ca083bf7bcfef6ab4b839ca11a953b156d64f82b1c51a213730d5777b4c845170827680d41e8220c2f950a38081025ff16eb3789ba00",
99
+ "5c2fe36bdb1e434c0a371579bcbce07c4e7b89eba45affa089191baec84f23ad77b24a594aa28427b6b7a5f348b0ecf5597abfd9a2add05ddb55c521ba38a38501",
100
+ ],
101
+ },
102
+ ],
103
+ },
104
+ downstream_tls_binding: {
105
+ domain: "inference.phala.com",
106
+ spki_sha256: "8e89a8a01e12098065037be187dcd2f03071dc1e7c9bb8527160f4c56ebc728f",
107
+ },
108
+ quote: "<omitted in fixture>",
109
+ },
110
+ },
111
+ service_capabilities: {
112
+ supported_e2ee_versions: ["2"],
113
+ serving: "aggregator",
114
+ },
115
+ };
116
+ //# sourceMappingURL=e2ee-fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2ee-fixtures.js","sourceRoot":"","sources":["../../src/test-utils/e2ee-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GACrC,kEAAkE,CAAC;AAErE,gEAAgE;AAChE,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAAC;AAEvD,MAAM,CAAC,MAAM,8BAA8B,GACzC,kEAAkE,CAAC;AAErE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,WAAW,EAAE,OAAO;IACpB,sBAAsB,EACpB,yEAAyE;IAC3E,WAAW,EAAE;QACX,QAAQ,EAAE,KAAK;QACf,eAAe,EAAE;YACf,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,UAAU;YACrB,oBAAoB,EAAE;gBACpB;oBACE,MAAM,EAAE,+BAA+B;oBACvC,IAAI,EAAE,SAAS;oBACf,UAAU,EACR,kEAAkE;iBACrE;aACF;YACD,gBAAgB,EAAE;gBAChB;oBACE,MAAM,EAAE,oBAAoB;oBAC5B,IAAI,EAAE,mCAAmC;oBACzC,UAAU,EACR,oIAAoI;iBACvI;gBACD;oBACE,MAAM,EAAE,2BAA2B;oBACnC,IAAI,EAAE,gCAAgC;oBACtC,UAAU,EACR,kEAAkE;iBACrE;aACF;YACD,eAAe,EAAE;gBACf;oBACE,WAAW,EACT,kEAAkE;oBACpE,MAAM,EAAE,gBAAgB;iBACzB;gBACD;oBACE,WAAW,EACT,kEAAkE;oBACpE,MAAM,EAAE,qBAAqB;iBAC9B;gBACD;oBACE,WAAW,EACT,kEAAkE;oBACpE,MAAM,EAAE,gBAAgB;iBACzB;aACF;SACF;QACD,WAAW,EACT,kEAAkE;QACpE,iBAAiB,EAAE;YACjB,QAAQ,EAAE,sDAAsD;YAChE,WAAW,EAAE,0CAA0C;YACvD,YAAY,EAAE,IAAI;YAClB,gBAAgB,EAAE,IAAI;SACvB;QACD,QAAQ,EAAE;YACR,iBAAiB,EACf,kIAAkI;YACpI,WAAW,EAAE;gBACX,QAAQ,EAAE,YAAY;gBACtB,IAAI,EAAE;oBACJ;wBACE,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,wBAAwB;wBAC9B,OAAO,EAAE,wBAAwB;wBACjC,IAAI,EAAE,SAAS;wBACf,UAAU,EACR,kEAAkE;wBACpE,cAAc,EACZ,oEAAoE;wBACtE,eAAe,EAAE;4BACf,oIAAoI;4BACpI,oIAAoI;yBACrI;qBACF;oBACD;wBACE,IAAI,EAAE,gBAAgB;wBACtB,IAAI,EAAE,aAAa;wBACnB,OAAO,EAAE,aAAa;wBACtB,IAAI,EAAE,mCAAmC;wBACzC,UAAU,EACR,oIAAoI;wBACtI,cAAc,EACZ,oEAAoE;wBACtE,eAAe,EAAE;4BACf,oIAAoI;4BACpI,oIAAoI;yBACrI;qBACF;oBACD;wBACE,IAAI,EAAE,aAAa;wBACnB,IAAI,EAAE,oBAAoB;wBAC1B,OAAO,EAAE,oBAAoB;wBAC7B,IAAI,EAAE,gCAAgC;wBACtC,UAAU,EACR,kEAAkE;wBACpE,cAAc,EACZ,oEAAoE;wBACtE,eAAe,EAAE;4BACf,oIAAoI;4BACpI,oIAAoI;yBACrI;qBACF;iBACF;aACF;YACD,sBAAsB,EAAE;gBACtB,MAAM,EAAE,qBAAqB;gBAC7B,WAAW,EACT,kEAAkE;aACrE;YACD,KAAK,EAAE,sBAAsB;SAC9B;KACF;IACD,oBAAoB,EAAE;QACpB,uBAAuB,EAAE,CAAC,GAAG,CAAC;QAC9B,OAAO,EAAE,YAAY;KACtB;CACO,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * A fake Phala-style ACI gateway behind a `fetch` function, for tests of the
3
+ * E2EE v2 client: serves the attestation report for its keyset and a chat
4
+ * completions endpoint that behaves like the enclave (validates the five
5
+ * headers, decrypts the request fields, encrypts the answer to the client
6
+ * key). It records what the "relay" saw on the wire and what the "enclave"
7
+ * decrypted, so a test can assert the two differ.
8
+ */
9
+ import { type AciWorkloadKeyset } from "../derivatives/e2ee/attestation.js";
10
+ import { type E2eeKeyPair } from "../derivatives/e2ee/suite.js";
11
+ /** The spec test-vector service key: seed 32 x 0x03. */
12
+ export declare const TEST_VECTOR_SERVICE_SEED: Uint8Array<ArrayBuffer>;
13
+ export declare const TEST_VECTOR_SERVICE_PUBLIC_KEY_HEX = "5dfedd3b6bd47f6fa28ee15d969d5bb0ea53774d488bdaf9df1c6e0124b3ef22";
14
+ export declare function testVectorServiceKeyPair(): Promise<E2eeKeyPair>;
15
+ export interface FakeE2eeGatewayRequest {
16
+ url: string;
17
+ headers: Record<string, string>;
18
+ /** The JSON body exactly as the relay would see it. */
19
+ body: Record<string, unknown>;
20
+ }
21
+ export interface FakeE2eeGatewayOptions {
22
+ /** Chat completions base the gateway answers on (default relay.test/v1). */
23
+ baseUrl?: string;
24
+ /** Service key (default: the spec test-vector key). */
25
+ serviceKey?: E2eeKeyPair;
26
+ keyId?: string;
27
+ notAfter?: number;
28
+ /** Plaintext answer for a decrypted prompt (default: fixed JSON answer). */
29
+ respond?: (input: {
30
+ model: string;
31
+ messages: Array<{
32
+ role: string;
33
+ content: string;
34
+ }>;
35
+ }) => string | Promise<string>;
36
+ /** false = 404 on the attestation route (a relay without passthrough). */
37
+ attestationRoute?: boolean;
38
+ /** Advertised E2EE versions (default ["2"]). */
39
+ supportedE2eeVersions?: string[];
40
+ /** Response id put on completions (default chatcmpl-test). */
41
+ responseId?: string;
42
+ }
43
+ export interface FakeE2eeGateway {
44
+ fetch: typeof fetch;
45
+ keyset: AciWorkloadKeyset;
46
+ /** Every chat completion request, as seen on the wire. */
47
+ requests: FakeE2eeGatewayRequest[];
48
+ /** Attestation report requests (url only). */
49
+ attestationRequests: string[];
50
+ /** Decrypted message contents per request, as the enclave saw them. */
51
+ decryptedPrompts: string[][];
52
+ /** Replace the service key: a keyset rotation with a fresh digest. */
53
+ rotateKey(): Promise<void>;
54
+ /** Serve the next N chat requests as this OpenAI-style error. */
55
+ failNext(count: number, status: number, errorType: string): void;
56
+ /** Serve the next chat response with plaintext content (no E2EE). */
57
+ plaintextNext(): void;
58
+ keysetDigest(): Promise<string>;
59
+ }
60
+ export declare function createFakeE2eeGateway(options?: FakeE2eeGatewayOptions): Promise<FakeE2eeGateway>;
61
+ //# sourceMappingURL=e2ee-gateway.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2ee-gateway.d.ts","sourceRoot":"","sources":["../../src/test-utils/e2ee-gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAQL,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAEtC,wDAAwD;AACxD,eAAO,MAAM,wBAAwB,yBAA6B,CAAC;AACnE,eAAO,MAAM,kCAAkC,qEACqB,CAAC;AAErE,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,WAAW,CAAC,CAKrE;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACpD,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gDAAgD;IAChD,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,0DAA0D;IAC1D,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,8CAA8C;IAC9C,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,uEAAuE;IACvE,gBAAgB,EAAE,MAAM,EAAE,EAAE,CAAC;IAC7B,sEAAsE;IACtE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACjE,qEAAqE;IACrE,aAAa,IAAI,IAAI,CAAC;IACtB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACjC;AAmBD,wBAAsB,qBAAqB,CACzC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,eAAe,CAAC,CAsP1B"}
@@ -0,0 +1,248 @@
1
+ /**
2
+ * A fake Phala-style ACI gateway behind a `fetch` function, for tests of the
3
+ * E2EE v2 client: serves the attestation report for its keyset and a chat
4
+ * completions endpoint that behaves like the enclave (validates the five
5
+ * headers, decrypts the request fields, encrypts the answer to the client
6
+ * key). It records what the "relay" saw on the wire and what the "enclave"
7
+ * decrypted, so a test can assert the two differ.
8
+ */
9
+ import { requestFieldAad, responseFieldAad } from "../derivatives/e2ee/aad.js";
10
+ import { reportDataFor, workloadKeysetDigest, } from "../derivatives/e2ee/attestation.js";
11
+ import { E2EE_ALGO_X25519, bytesToHex, decryptField, encryptField, generateX25519KeyPair, hexToBytes, importX25519PrivateKey, } from "../derivatives/e2ee/suite.js";
12
+ /** The spec test-vector service key: seed 32 x 0x03. */
13
+ export const TEST_VECTOR_SERVICE_SEED = new Uint8Array(32).fill(3);
14
+ export const TEST_VECTOR_SERVICE_PUBLIC_KEY_HEX = "5dfedd3b6bd47f6fa28ee15d969d5bb0ea53774d488bdaf9df1c6e0124b3ef22";
15
+ export async function testVectorServiceKeyPair() {
16
+ return importX25519PrivateKey(TEST_VECTOR_SERVICE_SEED, hexToBytes(TEST_VECTOR_SERVICE_PUBLIC_KEY_HEX));
17
+ }
18
+ function jsonResponse(status, body, headers = {}) {
19
+ return new Response(JSON.stringify(body), {
20
+ status,
21
+ headers: { "Content-Type": "application/json", ...headers },
22
+ });
23
+ }
24
+ function errorResponse(status, type) {
25
+ return jsonResponse(status, {
26
+ error: { type, message: `fake gateway: ${type}` },
27
+ });
28
+ }
29
+ export async function createFakeE2eeGateway(options = {}) {
30
+ const baseUrl = (options.baseUrl ?? "https://relay.test/v1").replace(/\/+$/, "");
31
+ let serviceKey = options.serviceKey ?? (await testVectorServiceKeyPair());
32
+ const keyId = options.keyId ?? "dstack-kms-e2ee-x25519-v1";
33
+ const notAfter = options.notAfter ?? Math.floor(Date.now() / 1000) + 30 * 24 * 3600;
34
+ const responseId = options.responseId ?? "chatcmpl-test";
35
+ const respond = options.respond ??
36
+ (() => JSON.stringify({ answer: "fake answer", evidence: "fake evidence" }));
37
+ const buildKeyset = () => ({
38
+ subject: null,
39
+ not_after: notAfter,
40
+ receipt_signing_keys: [
41
+ {
42
+ key_id: "dstack-kms-receipt-ed25519-v1",
43
+ algo: "ed25519",
44
+ public_key: "00".repeat(32),
45
+ },
46
+ ],
47
+ e2ee_public_keys: [
48
+ {
49
+ key_id: "dstack-kms-e2ee-v1",
50
+ algo: "secp256k1-aes-256-gcm-hkdf-sha256",
51
+ public_key: "04" + "11".repeat(64),
52
+ },
53
+ {
54
+ key_id: keyId,
55
+ algo: E2EE_ALGO_X25519,
56
+ public_key: bytesToHex(serviceKey.publicKey),
57
+ },
58
+ ],
59
+ tls_public_keys: [{ spki_sha256: "22".repeat(32), domain: "relay.test" }],
60
+ });
61
+ const gateway = {
62
+ fetch: undefined,
63
+ keyset: buildKeyset(),
64
+ requests: [],
65
+ attestationRequests: [],
66
+ decryptedPrompts: [],
67
+ async rotateKey() {
68
+ serviceKey = await generateX25519KeyPair();
69
+ gateway.keyset = buildKeyset();
70
+ },
71
+ failNext(count, status, errorType) {
72
+ pendingFailures = { count, status, errorType };
73
+ },
74
+ plaintextNext() {
75
+ plaintextOnce = true;
76
+ },
77
+ keysetDigest: () => workloadKeysetDigest(gateway.keyset),
78
+ };
79
+ let pendingFailures = null;
80
+ let plaintextOnce = false;
81
+ const serveAttestation = async (url) => {
82
+ gateway.attestationRequests.push(url.toString());
83
+ if (options.attestationRoute === false) {
84
+ return jsonResponse(404, { error: "not found" });
85
+ }
86
+ const nonce = url.searchParams.get("nonce");
87
+ if (!nonce || !/^[0-9a-f]{64}$/.test(nonce)) {
88
+ return errorResponse(400, "invalid_request_error");
89
+ }
90
+ const digest = await workloadKeysetDigest(gateway.keyset);
91
+ const reportData = await reportDataFor(digest, nonce);
92
+ const report = {
93
+ api_version: "aci/1",
94
+ workload_keyset_digest: digest,
95
+ attestation: {
96
+ tee_type: "tdx",
97
+ workload_keyset: gateway.keyset,
98
+ report_data: reportData,
99
+ source_provenance: {
100
+ repo_url: "https://github.com/Dstack-TEE/private-ai-gateway.git",
101
+ repo_commit: "d567f6b4c4d93e33037ea202db04db86a8ad881c",
102
+ image_digest: null,
103
+ image_provenance: null,
104
+ },
105
+ evidence: {
106
+ quote: "0400",
107
+ quote_report_data: reportData + "0".repeat(64),
108
+ },
109
+ },
110
+ service_capabilities: {
111
+ supported_e2ee_versions: options.supportedE2eeVersions ?? ["2"],
112
+ serving: "aggregator",
113
+ },
114
+ };
115
+ return jsonResponse(200, report);
116
+ };
117
+ const serveChat = async (url, init) => {
118
+ const headers = new Headers(init?.headers);
119
+ const headerRecord = {};
120
+ headers.forEach((value, key) => {
121
+ headerRecord[key] = value;
122
+ });
123
+ const body = JSON.parse(String(init?.body));
124
+ gateway.requests.push({ url: url.toString(), headers: headerRecord, body });
125
+ const digest = await workloadKeysetDigest(gateway.keyset);
126
+ const common = { "X-ACI-Keyset-Digest": digest, "X-Receipt-Id": "rcpt-1" };
127
+ if (pendingFailures && pendingFailures.count > 0) {
128
+ pendingFailures.count -= 1;
129
+ return errorResponse(pendingFailures.status, pendingFailures.errorType);
130
+ }
131
+ const required = [
132
+ "x-e2ee-version",
133
+ "x-client-pub-key",
134
+ "x-model-pub-key",
135
+ "x-e2ee-nonce",
136
+ "x-e2ee-timestamp",
137
+ ];
138
+ const present = required.filter((name) => headers.has(name));
139
+ if (present.length !== required.length) {
140
+ return errorResponse(400, "e2ee_header_missing");
141
+ }
142
+ if (headers.get("x-e2ee-version") !== "2") {
143
+ return errorResponse(400, "e2ee_invalid_version");
144
+ }
145
+ if (headers.get("x-model-pub-key") !== bytesToHex(serviceKey.publicKey)) {
146
+ return errorResponse(400, "e2ee_model_key_mismatch");
147
+ }
148
+ const nonce = headers.get("x-e2ee-nonce");
149
+ if (!/^[0-9a-fA-F]{64}$/.test(nonce)) {
150
+ return errorResponse(400, "e2ee_invalid_nonce");
151
+ }
152
+ const ts = Number(headers.get("x-e2ee-timestamp"));
153
+ if (!Number.isInteger(ts)) {
154
+ return errorResponse(400, "e2ee_invalid_timestamp");
155
+ }
156
+ if (typeof body.model !== "string") {
157
+ return errorResponse(400, "e2ee_invalid_payload_model");
158
+ }
159
+ let clientPublicKey;
160
+ try {
161
+ clientPublicKey = hexToBytes(headers.get("x-client-pub-key"));
162
+ if (clientPublicKey.length !== 32)
163
+ throw new Error("length");
164
+ }
165
+ catch {
166
+ return errorResponse(400, "e2ee_invalid_public_key");
167
+ }
168
+ const context = {
169
+ algo: E2EE_ALGO_X25519,
170
+ model: body.model,
171
+ nonce,
172
+ ts,
173
+ };
174
+ const messages = Array.isArray(body.messages) ? body.messages : [];
175
+ const decrypted = [];
176
+ for (let index = 0; index < messages.length; index += 1) {
177
+ const message = messages[index];
178
+ if (typeof message.content !== "string") {
179
+ return errorResponse(400, "e2ee_decryption_failed");
180
+ }
181
+ try {
182
+ decrypted.push({
183
+ role: message.role,
184
+ content: await decryptField({
185
+ wire: message.content,
186
+ privateKey: serviceKey.privateKey,
187
+ aad: requestFieldAad(context, `messages.${index}.content`),
188
+ }),
189
+ });
190
+ }
191
+ catch {
192
+ return errorResponse(400, "e2ee_decryption_failed");
193
+ }
194
+ }
195
+ if (decrypted.length === 0) {
196
+ return errorResponse(400, "e2ee_decryption_failed");
197
+ }
198
+ gateway.decryptedPrompts.push(decrypted.map((m) => m.content));
199
+ const answer = await respond({ model: body.model, messages: decrypted });
200
+ if (plaintextOnce) {
201
+ plaintextOnce = false;
202
+ return jsonResponse(200, {
203
+ id: responseId,
204
+ choices: [
205
+ { index: 0, message: { role: "assistant", content: answer } },
206
+ ],
207
+ }, common);
208
+ }
209
+ const content = await encryptField({
210
+ plaintext: answer,
211
+ recipientPublicKey: clientPublicKey,
212
+ aad: responseFieldAad(context, "choices.0.message.content", responseId),
213
+ });
214
+ return jsonResponse(200, {
215
+ id: responseId,
216
+ object: "chat.completion",
217
+ model: body.model,
218
+ choices: [
219
+ {
220
+ index: 0,
221
+ finish_reason: "stop",
222
+ message: { role: "assistant", content },
223
+ },
224
+ ],
225
+ usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
226
+ }, {
227
+ ...common,
228
+ "X-E2EE-Applied": "true",
229
+ "X-E2EE-Version": "2",
230
+ "X-E2EE-Algo": E2EE_ALGO_X25519,
231
+ });
232
+ };
233
+ gateway.fetch = (async (input, init) => {
234
+ const url = new URL(typeof input === "string"
235
+ ? input
236
+ : input instanceof URL
237
+ ? input.toString()
238
+ : input.url);
239
+ const path = url.origin + url.pathname;
240
+ if (path === `${baseUrl}/aci/attestation`)
241
+ return serveAttestation(url);
242
+ if (path === `${baseUrl}/chat/completions`)
243
+ return serveChat(url, init);
244
+ return jsonResponse(404, { error: "not found" });
245
+ });
246
+ return gateway;
247
+ }
248
+ //# sourceMappingURL=e2ee-gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2ee-gateway.js","sourceRoot":"","sources":["../../src/test-utils/e2ee-gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EACL,aAAa,EACb,oBAAoB,GAGrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACV,sBAAsB,GAEvB,MAAM,8BAA8B,CAAC;AAEtC,wDAAwD;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,kCAAkC,GAC7C,kEAAkE,CAAC;AAErE,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,OAAO,sBAAsB,CAC3B,wBAAwB,EACxB,UAAU,CAAC,kCAAkC,CAAC,CAC/C,CAAC;AACJ,CAAC;AA+CD,SAAS,YAAY,CACnB,MAAc,EACd,IAAa,EACb,UAAkC,EAAE;IAEpC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;QACxC,MAAM;QACN,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,OAAO,EAAE;KAC5D,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,MAAc,EAAE,IAAY;IACjD,O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AAQ,CAAC;QACvC,IAAI,IAAI,KAAK,GAAG,OAAO,kBAAkB;YAAE,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACxE,IAAI,IAAI,KAAK,GAAG,OAAO,mBAAmB;YAAE,OAAO,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACxE,OAAO,YAAY,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IACnD,CAAC,CAAiB,CAAC;IAEnB,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export { createTestWallet, buildWeb3SignedHeader, type TestWallet, } from "./wallet.js";
2
2
  export { createMemoryDataStorage, type MemoryDataStorage, } from "./memory-storage.js";
3
+ export { TEST_VECTOR_SERVICE_PUBLIC_KEY_HEX, TEST_VECTOR_SERVICE_SEED, createFakeE2eeGateway, testVectorServiceKeyPair, type FakeE2eeGateway, type FakeE2eeGatewayOptions, type FakeE2eeGatewayRequest, } from "./e2ee-gateway.js";
4
+ export { LIVE_ACI_ATTESTATION_CLOCK_S, LIVE_ACI_ATTESTATION_NONCE, LIVE_ACI_ATTESTATION_REPORT, LIVE_ACI_X25519_PUBLIC_KEY_HEX, } from "./e2ee-fixtures.js";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export { createTestWallet, buildWeb3SignedHeader, } from "./wallet.js";
2
2
  export { createMemoryDataStorage, } from "./memory-storage.js";
3
+ export { TEST_VECTOR_SERVICE_PUBLIC_KEY_HEX, TEST_VECTOR_SERVICE_SEED, createFakeE2eeGateway, testVectorServiceKeyPair, } from "./e2ee-gateway.js";
4
+ export { LIVE_ACI_ATTESTATION_CLOCK_S, LIVE_ACI_ATTESTATION_NONCE, LIVE_ACI_ATTESTATION_REPORT, LIVE_ACI_X25519_PUBLIC_KEY_HEX, } from "./e2ee-fixtures.js";
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,GAExB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,GAExB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,GAIzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendatalabs/personal-server-ts-core",
3
- "version": "1.9.0",
3
+ "version": "1.10.1",
4
4
  "description": "Protocol logic for the Vana Personal Server — auth, grants, scopes, storage, keys",
5
5
  "license": "MIT",
6
6
  "repository": {