@opendatalabs/personal-server-ts-core 0.0.1-canary.00328bf

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 (573) hide show
  1. package/dist/api/index.d.ts +408 -0
  2. package/dist/api/index.d.ts.map +1 -0
  3. package/dist/api/index.js +1257 -0
  4. package/dist/api/index.js.map +1 -0
  5. package/dist/api/raw-envelope.d.ts +3 -0
  6. package/dist/api/raw-envelope.d.ts.map +1 -0
  7. package/dist/api/raw-envelope.js +215 -0
  8. package/dist/api/raw-envelope.js.map +1 -0
  9. package/dist/auth/index.d.ts +2 -0
  10. package/dist/auth/index.d.ts.map +1 -0
  11. package/dist/auth/index.js +2 -0
  12. package/dist/auth/index.js.map +1 -0
  13. package/dist/auth/request.d.ts +28 -0
  14. package/dist/auth/request.d.ts.map +1 -0
  15. package/dist/auth/request.js +106 -0
  16. package/dist/auth/request.js.map +1 -0
  17. package/dist/client.d.ts +233 -0
  18. package/dist/client.d.ts.map +1 -0
  19. package/dist/client.js +243 -0
  20. package/dist/client.js.map +1 -0
  21. package/dist/config/defaults.d.ts +12 -0
  22. package/dist/config/defaults.d.ts.map +1 -0
  23. package/dist/config/defaults.js +12 -0
  24. package/dist/config/defaults.js.map +1 -0
  25. package/dist/config/index.d.ts +3 -0
  26. package/dist/config/index.d.ts.map +1 -0
  27. package/dist/config/index.js +3 -0
  28. package/dist/config/index.js.map +1 -0
  29. package/dist/config/paths.d.ts +9 -0
  30. package/dist/config/paths.d.ts.map +1 -0
  31. package/dist/config/paths.js +14 -0
  32. package/dist/config/paths.js.map +1 -0
  33. package/dist/contracts/access-logs.d.ts +8 -0
  34. package/dist/contracts/access-logs.d.ts.map +1 -0
  35. package/dist/contracts/access-logs.js +7 -0
  36. package/dist/contracts/access-logs.js.map +1 -0
  37. package/dist/contracts/auth-device.d.ts +70 -0
  38. package/dist/contracts/auth-device.d.ts.map +1 -0
  39. package/dist/contracts/auth-device.js +163 -0
  40. package/dist/contracts/auth-device.js.map +1 -0
  41. package/dist/contracts/binary.d.ts +66 -0
  42. package/dist/contracts/binary.d.ts.map +1 -0
  43. package/dist/contracts/binary.js +123 -0
  44. package/dist/contracts/binary.js.map +1 -0
  45. package/dist/contracts/config.d.ts +5 -0
  46. package/dist/contracts/config.d.ts.map +1 -0
  47. package/dist/contracts/config.js +30 -0
  48. package/dist/contracts/config.js.map +1 -0
  49. package/dist/contracts/data.d.ts +165 -0
  50. package/dist/contracts/data.d.ts.map +1 -0
  51. package/dist/contracts/data.js +371 -0
  52. package/dist/contracts/data.js.map +1 -0
  53. package/dist/contracts/grants.d.ts +45 -0
  54. package/dist/contracts/grants.d.ts.map +1 -0
  55. package/dist/contracts/grants.js +177 -0
  56. package/dist/contracts/grants.js.map +1 -0
  57. package/dist/contracts/http.d.ts +21 -0
  58. package/dist/contracts/http.d.ts.map +1 -0
  59. package/dist/contracts/http.js +49 -0
  60. package/dist/contracts/http.js.map +1 -0
  61. package/dist/contracts/index.d.ts +16 -0
  62. package/dist/contracts/index.d.ts.map +1 -0
  63. package/dist/contracts/index.js +10 -0
  64. package/dist/contracts/index.js.map +1 -0
  65. package/dist/contracts/oauth.d.ts +38 -0
  66. package/dist/contracts/oauth.d.ts.map +1 -0
  67. package/dist/contracts/oauth.js +130 -0
  68. package/dist/contracts/oauth.js.map +1 -0
  69. package/dist/contracts/sync.d.ts +10 -0
  70. package/dist/contracts/sync.d.ts.map +1 -0
  71. package/dist/contracts/sync.js +35 -0
  72. package/dist/contracts/sync.js.map +1 -0
  73. package/dist/derivatives/answer-shape.d.ts +83 -0
  74. package/dist/derivatives/answer-shape.d.ts.map +1 -0
  75. package/dist/derivatives/answer-shape.js +320 -0
  76. package/dist/derivatives/answer-shape.js.map +1 -0
  77. package/dist/derivatives/api.d.ts +48 -0
  78. package/dist/derivatives/api.d.ts.map +1 -0
  79. package/dist/derivatives/api.js +374 -0
  80. package/dist/derivatives/api.js.map +1 -0
  81. package/dist/derivatives/compute.d.ts +112 -0
  82. package/dist/derivatives/compute.d.ts.map +1 -0
  83. package/dist/derivatives/compute.js +476 -0
  84. package/dist/derivatives/compute.js.map +1 -0
  85. package/dist/derivatives/e2ee/aad.d.ts +22 -0
  86. package/dist/derivatives/e2ee/aad.d.ts.map +1 -0
  87. package/dist/derivatives/e2ee/aad.js +32 -0
  88. package/dist/derivatives/e2ee/aad.js.map +1 -0
  89. package/dist/derivatives/e2ee/attestation.d.ts +134 -0
  90. package/dist/derivatives/e2ee/attestation.d.ts.map +1 -0
  91. package/dist/derivatives/e2ee/attestation.js +248 -0
  92. package/dist/derivatives/e2ee/attestation.js.map +1 -0
  93. package/dist/derivatives/e2ee/index.d.ts +6 -0
  94. package/dist/derivatives/e2ee/index.d.ts.map +1 -0
  95. package/dist/derivatives/e2ee/index.js +6 -0
  96. package/dist/derivatives/e2ee/index.js.map +1 -0
  97. package/dist/derivatives/e2ee/jcs.d.ts +17 -0
  98. package/dist/derivatives/e2ee/jcs.d.ts.map +1 -0
  99. package/dist/derivatives/e2ee/jcs.js +55 -0
  100. package/dist/derivatives/e2ee/jcs.js.map +1 -0
  101. package/dist/derivatives/e2ee/phala.d.ts +62 -0
  102. package/dist/derivatives/e2ee/phala.d.ts.map +1 -0
  103. package/dist/derivatives/e2ee/phala.js +168 -0
  104. package/dist/derivatives/e2ee/phala.js.map +1 -0
  105. package/dist/derivatives/e2ee/suite.d.ts +56 -0
  106. package/dist/derivatives/e2ee/suite.d.ts.map +1 -0
  107. package/dist/derivatives/e2ee/suite.js +164 -0
  108. package/dist/derivatives/e2ee/suite.js.map +1 -0
  109. package/dist/derivatives/index.d.ts +11 -0
  110. package/dist/derivatives/index.d.ts.map +1 -0
  111. package/dist/derivatives/index.js +11 -0
  112. package/dist/derivatives/index.js.map +1 -0
  113. package/dist/derivatives/inference.d.ts +151 -0
  114. package/dist/derivatives/inference.d.ts.map +1 -0
  115. package/dist/derivatives/inference.js +262 -0
  116. package/dist/derivatives/inference.js.map +1 -0
  117. package/dist/derivatives/prompt.d.ts +99 -0
  118. package/dist/derivatives/prompt.d.ts.map +1 -0
  119. package/dist/derivatives/prompt.js +281 -0
  120. package/dist/derivatives/prompt.js.map +1 -0
  121. package/dist/derivatives/registration.d.ts +56 -0
  122. package/dist/derivatives/registration.d.ts.map +1 -0
  123. package/dist/derivatives/registration.js +187 -0
  124. package/dist/derivatives/registration.js.map +1 -0
  125. package/dist/derivatives/scheduler.d.ts +114 -0
  126. package/dist/derivatives/scheduler.d.ts.map +1 -0
  127. package/dist/derivatives/scheduler.js +331 -0
  128. package/dist/derivatives/scheduler.js.map +1 -0
  129. package/dist/derivatives/store.d.ts +14 -0
  130. package/dist/derivatives/store.d.ts.map +1 -0
  131. package/dist/derivatives/store.js +79 -0
  132. package/dist/derivatives/store.js.map +1 -0
  133. package/dist/derivatives/types.d.ts +102 -0
  134. package/dist/derivatives/types.d.ts.map +1 -0
  135. package/dist/derivatives/types.js +29 -0
  136. package/dist/derivatives/types.js.map +1 -0
  137. package/dist/errors/catalog.d.ts +125 -0
  138. package/dist/errors/catalog.d.ts.map +1 -0
  139. package/dist/errors/catalog.js +198 -0
  140. package/dist/errors/catalog.js.map +1 -0
  141. package/dist/errors/pdpp-catalog.d.ts +36 -0
  142. package/dist/errors/pdpp-catalog.d.ts.map +1 -0
  143. package/dist/errors/pdpp-catalog.js +82 -0
  144. package/dist/errors/pdpp-catalog.js.map +1 -0
  145. package/dist/grants/index.d.ts +5 -0
  146. package/dist/grants/index.d.ts.map +1 -0
  147. package/dist/grants/index.js +6 -0
  148. package/dist/grants/index.js.map +1 -0
  149. package/dist/grants/pdpp-binding-store.d.ts +58 -0
  150. package/dist/grants/pdpp-binding-store.d.ts.map +1 -0
  151. package/dist/grants/pdpp-binding-store.js +97 -0
  152. package/dist/grants/pdpp-binding-store.js.map +1 -0
  153. package/dist/grants/pdpp-binding.d.ts +179 -0
  154. package/dist/grants/pdpp-binding.d.ts.map +1 -0
  155. package/dist/grants/pdpp-binding.js +214 -0
  156. package/dist/grants/pdpp-binding.js.map +1 -0
  157. package/dist/keys/index.d.ts +3 -0
  158. package/dist/keys/index.d.ts.map +1 -0
  159. package/dist/keys/index.js +2 -0
  160. package/dist/keys/index.js.map +1 -0
  161. package/dist/keys/public-only-account.d.ts +8 -0
  162. package/dist/keys/public-only-account.d.ts.map +1 -0
  163. package/dist/keys/public-only-account.js +21 -0
  164. package/dist/keys/public-only-account.js.map +1 -0
  165. package/dist/keys/server-account.d.ts +24 -0
  166. package/dist/keys/server-account.d.ts.map +1 -0
  167. package/dist/keys/server-account.js +2 -0
  168. package/dist/keys/server-account.js.map +1 -0
  169. package/dist/lineage/attestation.d.ts +42 -0
  170. package/dist/lineage/attestation.d.ts.map +1 -0
  171. package/dist/lineage/attestation.js +25 -0
  172. package/dist/lineage/attestation.js.map +1 -0
  173. package/dist/lineage/gateway.d.ts +105 -0
  174. package/dist/lineage/gateway.d.ts.map +1 -0
  175. package/dist/lineage/gateway.js +242 -0
  176. package/dist/lineage/gateway.js.map +1 -0
  177. package/dist/lineage/index.d.ts +5 -0
  178. package/dist/lineage/index.d.ts.map +1 -0
  179. package/dist/lineage/index.js +5 -0
  180. package/dist/lineage/index.js.map +1 -0
  181. package/dist/lineage/lineage.d.ts +141 -0
  182. package/dist/lineage/lineage.d.ts.map +1 -0
  183. package/dist/lineage/lineage.js +255 -0
  184. package/dist/lineage/lineage.js.map +1 -0
  185. package/dist/logger/index.d.ts +9 -0
  186. package/dist/logger/index.d.ts.map +1 -0
  187. package/dist/logger/index.js +5 -0
  188. package/dist/logger/index.js.map +1 -0
  189. package/dist/logging/access-log.d.ts +23 -0
  190. package/dist/logging/access-log.d.ts.map +1 -0
  191. package/dist/logging/access-log.js +2 -0
  192. package/dist/logging/access-log.js.map +1 -0
  193. package/dist/logging/access-reader.d.ts +14 -0
  194. package/dist/logging/access-reader.d.ts.map +1 -0
  195. package/dist/logging/access-reader.js +2 -0
  196. package/dist/logging/access-reader.js.map +1 -0
  197. package/dist/mcp/activity.d.ts +68 -0
  198. package/dist/mcp/activity.d.ts.map +1 -0
  199. package/dist/mcp/activity.js +111 -0
  200. package/dist/mcp/activity.js.map +1 -0
  201. package/dist/mcp/builder-registration.d.ts +24 -0
  202. package/dist/mcp/builder-registration.d.ts.map +1 -0
  203. package/dist/mcp/builder-registration.js +89 -0
  204. package/dist/mcp/builder-registration.js.map +1 -0
  205. package/dist/mcp/connection-api.d.ts +201 -0
  206. package/dist/mcp/connection-api.d.ts.map +1 -0
  207. package/dist/mcp/connection-api.js +506 -0
  208. package/dist/mcp/connection-api.js.map +1 -0
  209. package/dist/mcp/grantee.d.ts +52 -0
  210. package/dist/mcp/grantee.d.ts.map +1 -0
  211. package/dist/mcp/grantee.js +91 -0
  212. package/dist/mcp/grantee.js.map +1 -0
  213. package/dist/mcp/index.d.ts +12 -0
  214. package/dist/mcp/index.d.ts.map +1 -0
  215. package/dist/mcp/index.js +12 -0
  216. package/dist/mcp/index.js.map +1 -0
  217. package/dist/mcp/read-client.d.ts +176 -0
  218. package/dist/mcp/read-client.d.ts.map +1 -0
  219. package/dist/mcp/read-client.js +579 -0
  220. package/dist/mcp/read-client.js.map +1 -0
  221. package/dist/mcp/resources.d.ts +37 -0
  222. package/dist/mcp/resources.d.ts.map +1 -0
  223. package/dist/mcp/resources.js +114 -0
  224. package/dist/mcp/resources.js.map +1 -0
  225. package/dist/mcp/search/index.d.ts +34 -0
  226. package/dist/mcp/search/index.d.ts.map +1 -0
  227. package/dist/mcp/search/index.js +156 -0
  228. package/dist/mcp/search/index.js.map +1 -0
  229. package/dist/mcp/server.d.ts +72 -0
  230. package/dist/mcp/server.d.ts.map +1 -0
  231. package/dist/mcp/server.js +447 -0
  232. package/dist/mcp/server.js.map +1 -0
  233. package/dist/mcp/session.d.ts +160 -0
  234. package/dist/mcp/session.d.ts.map +1 -0
  235. package/dist/mcp/session.js +243 -0
  236. package/dist/mcp/session.js.map +1 -0
  237. package/dist/mcp/store.d.ts +13 -0
  238. package/dist/mcp/store.d.ts.map +1 -0
  239. package/dist/mcp/store.js +119 -0
  240. package/dist/mcp/store.js.map +1 -0
  241. package/dist/mcp/token-expiry.d.ts +38 -0
  242. package/dist/mcp/token-expiry.d.ts.map +1 -0
  243. package/dist/mcp/token-expiry.js +55 -0
  244. package/dist/mcp/token-expiry.js.map +1 -0
  245. package/dist/mcp/tools.d.ts +95 -0
  246. package/dist/mcp/tools.d.ts.map +1 -0
  247. package/dist/mcp/tools.js +1381 -0
  248. package/dist/mcp/tools.js.map +1 -0
  249. package/dist/mcp/types.d.ts +135 -0
  250. package/dist/mcp/types.d.ts.map +1 -0
  251. package/dist/mcp/types.js +24 -0
  252. package/dist/mcp/types.js.map +1 -0
  253. package/dist/payment/index.d.ts +2 -0
  254. package/dist/payment/index.d.ts.map +1 -0
  255. package/dist/payment/index.js +2 -0
  256. package/dist/payment/index.js.map +1 -0
  257. package/dist/payment/x402.d.ts +155 -0
  258. package/dist/payment/x402.d.ts.map +1 -0
  259. package/dist/payment/x402.js +402 -0
  260. package/dist/payment/x402.js.map +1 -0
  261. package/dist/pdpp/approval.d.ts +182 -0
  262. package/dist/pdpp/approval.d.ts.map +1 -0
  263. package/dist/pdpp/approval.js +337 -0
  264. package/dist/pdpp/approval.js.map +1 -0
  265. package/dist/pdpp/client-identity.d.ts +88 -0
  266. package/dist/pdpp/client-identity.d.ts.map +1 -0
  267. package/dist/pdpp/client-identity.js +183 -0
  268. package/dist/pdpp/client-identity.js.map +1 -0
  269. package/dist/pdpp/client-metadata.d.ts +95 -0
  270. package/dist/pdpp/client-metadata.d.ts.map +1 -0
  271. package/dist/pdpp/client-metadata.js +96 -0
  272. package/dist/pdpp/client-metadata.js.map +1 -0
  273. package/dist/pdpp/declaration.d.ts +118 -0
  274. package/dist/pdpp/declaration.d.ts.map +1 -0
  275. package/dist/pdpp/declaration.js +549 -0
  276. package/dist/pdpp/declaration.js.map +1 -0
  277. package/dist/pdpp/index.d.ts +35 -0
  278. package/dist/pdpp/index.d.ts.map +1 -0
  279. package/dist/pdpp/index.js +22 -0
  280. package/dist/pdpp/index.js.map +1 -0
  281. package/dist/pdpp/issuance.d.ts +91 -0
  282. package/dist/pdpp/issuance.d.ts.map +1 -0
  283. package/dist/pdpp/issuance.js +124 -0
  284. package/dist/pdpp/issuance.js.map +1 -0
  285. package/dist/pdpp/pkce.d.ts +53 -0
  286. package/dist/pdpp/pkce.d.ts.map +1 -0
  287. package/dist/pdpp/pkce.js +109 -0
  288. package/dist/pdpp/pkce.js.map +1 -0
  289. package/dist/pdpp/redirect.d.ts +60 -0
  290. package/dist/pdpp/redirect.d.ts.map +1 -0
  291. package/dist/pdpp/redirect.js +125 -0
  292. package/dist/pdpp/redirect.js.map +1 -0
  293. package/dist/pdpp/resolve.d.ts +53 -0
  294. package/dist/pdpp/resolve.d.ts.map +1 -0
  295. package/dist/pdpp/resolve.js +218 -0
  296. package/dist/pdpp/resolve.js.map +1 -0
  297. package/dist/pdpp/review.d.ts +155 -0
  298. package/dist/pdpp/review.d.ts.map +1 -0
  299. package/dist/pdpp/review.js +142 -0
  300. package/dist/pdpp/review.js.map +1 -0
  301. package/dist/pdpp/selection.d.ts +43 -0
  302. package/dist/pdpp/selection.d.ts.map +1 -0
  303. package/dist/pdpp/selection.js +211 -0
  304. package/dist/pdpp/selection.js.map +1 -0
  305. package/dist/pdpp/store.d.ts +204 -0
  306. package/dist/pdpp/store.d.ts.map +1 -0
  307. package/dist/pdpp/store.js +501 -0
  308. package/dist/pdpp/store.js.map +1 -0
  309. package/dist/pdpp/tokens.d.ts +149 -0
  310. package/dist/pdpp/tokens.d.ts.map +1 -0
  311. package/dist/pdpp/tokens.js +387 -0
  312. package/dist/pdpp/tokens.js.map +1 -0
  313. package/dist/pdpp/types.d.ts +258 -0
  314. package/dist/pdpp/types.d.ts.map +1 -0
  315. package/dist/pdpp/types.js +40 -0
  316. package/dist/pdpp/types.js.map +1 -0
  317. package/dist/pdpp-version.d.ts +28 -0
  318. package/dist/pdpp-version.d.ts.map +1 -0
  319. package/dist/pdpp-version.js +28 -0
  320. package/dist/pdpp-version.js.map +1 -0
  321. package/dist/policy/data-read.d.ts +56 -0
  322. package/dist/policy/data-read.d.ts.map +1 -0
  323. package/dist/policy/data-read.js +176 -0
  324. package/dist/policy/data-read.js.map +1 -0
  325. package/dist/policy/data-write.d.ts +69 -0
  326. package/dist/policy/data-write.d.ts.map +1 -0
  327. package/dist/policy/data-write.js +131 -0
  328. package/dist/policy/data-write.js.map +1 -0
  329. package/dist/policy/index.d.ts +4 -0
  330. package/dist/policy/index.d.ts.map +1 -0
  331. package/dist/policy/index.js +4 -0
  332. package/dist/policy/index.js.map +1 -0
  333. package/dist/policy/signed-artifacts.d.ts +17 -0
  334. package/dist/policy/signed-artifacts.d.ts.map +1 -0
  335. package/dist/policy/signed-artifacts.js +110 -0
  336. package/dist/policy/signed-artifacts.js.map +1 -0
  337. package/dist/ports/index.d.ts +243 -0
  338. package/dist/ports/index.d.ts.map +1 -0
  339. package/dist/ports/index.js +7 -0
  340. package/dist/ports/index.js.map +1 -0
  341. package/dist/ports/pdpp-auth.d.ts +103 -0
  342. package/dist/ports/pdpp-auth.d.ts.map +1 -0
  343. package/dist/ports/pdpp-auth.js +37 -0
  344. package/dist/ports/pdpp-auth.js.map +1 -0
  345. package/dist/ports/pdpp-auth.test-utils.d.ts +9 -0
  346. package/dist/ports/pdpp-auth.test-utils.d.ts.map +1 -0
  347. package/dist/ports/pdpp-auth.test-utils.js +18 -0
  348. package/dist/ports/pdpp-auth.test-utils.js.map +1 -0
  349. package/dist/schemas/server-config.d.ts +190 -0
  350. package/dist/schemas/server-config.d.ts.map +1 -0
  351. package/dist/schemas/server-config.js +282 -0
  352. package/dist/schemas/server-config.js.map +1 -0
  353. package/dist/signing/index.d.ts +3 -0
  354. package/dist/signing/index.d.ts.map +1 -0
  355. package/dist/signing/index.js +3 -0
  356. package/dist/signing/index.js.map +1 -0
  357. package/dist/signing/request-signer.d.ts +20 -0
  358. package/dist/signing/request-signer.d.ts.map +1 -0
  359. package/dist/signing/request-signer.js +23 -0
  360. package/dist/signing/request-signer.js.map +1 -0
  361. package/dist/signing/signer.d.ts +40 -0
  362. package/dist/signing/signer.d.ts.map +1 -0
  363. package/dist/signing/signer.js +56 -0
  364. package/dist/signing/signer.js.map +1 -0
  365. package/dist/storage/adapters/index.d.ts +4 -0
  366. package/dist/storage/adapters/index.d.ts.map +1 -0
  367. package/dist/storage/adapters/index.js +3 -0
  368. package/dist/storage/adapters/index.js.map +1 -0
  369. package/dist/storage/adapters/interface.d.ts +57 -0
  370. package/dist/storage/adapters/interface.d.ts.map +1 -0
  371. package/dist/storage/adapters/interface.js +2 -0
  372. package/dist/storage/adapters/interface.js.map +1 -0
  373. package/dist/storage/adapters/sdk.d.ts +23 -0
  374. package/dist/storage/adapters/sdk.d.ts.map +1 -0
  375. package/dist/storage/adapters/sdk.js +73 -0
  376. package/dist/storage/adapters/sdk.js.map +1 -0
  377. package/dist/storage/adapters/vana.d.ts +12 -0
  378. package/dist/storage/adapters/vana.d.ts.map +1 -0
  379. package/dist/storage/adapters/vana.js +111 -0
  380. package/dist/storage/adapters/vana.js.map +1 -0
  381. package/dist/storage/blocks/build.d.ts +20 -0
  382. package/dist/storage/blocks/build.d.ts.map +1 -0
  383. package/dist/storage/blocks/build.js +378 -0
  384. package/dist/storage/blocks/build.js.map +1 -0
  385. package/dist/storage/blocks/cursor.d.ts +33 -0
  386. package/dist/storage/blocks/cursor.d.ts.map +1 -0
  387. package/dist/storage/blocks/cursor.js +142 -0
  388. package/dist/storage/blocks/cursor.js.map +1 -0
  389. package/dist/storage/blocks/errors.d.ts +6 -0
  390. package/dist/storage/blocks/errors.d.ts.map +1 -0
  391. package/dist/storage/blocks/errors.js +9 -0
  392. package/dist/storage/blocks/errors.js.map +1 -0
  393. package/dist/storage/blocks/index.d.ts +6 -0
  394. package/dist/storage/blocks/index.d.ts.map +1 -0
  395. package/dist/storage/blocks/index.js +5 -0
  396. package/dist/storage/blocks/index.js.map +1 -0
  397. package/dist/storage/blocks/select.d.ts +29 -0
  398. package/dist/storage/blocks/select.d.ts.map +1 -0
  399. package/dist/storage/blocks/select.js +120 -0
  400. package/dist/storage/blocks/select.js.map +1 -0
  401. package/dist/storage/blocks/types.d.ts +56 -0
  402. package/dist/storage/blocks/types.d.ts.map +1 -0
  403. package/dist/storage/blocks/types.js +2 -0
  404. package/dist/storage/blocks/types.js.map +1 -0
  405. package/dist/storage/hierarchy/index.d.ts +3 -0
  406. package/dist/storage/hierarchy/index.d.ts.map +1 -0
  407. package/dist/storage/hierarchy/index.js +2 -0
  408. package/dist/storage/hierarchy/index.js.map +1 -0
  409. package/dist/storage/hierarchy/manager.d.ts +9 -0
  410. package/dist/storage/hierarchy/manager.d.ts.map +1 -0
  411. package/dist/storage/hierarchy/manager.js +2 -0
  412. package/dist/storage/hierarchy/manager.js.map +1 -0
  413. package/dist/storage/hierarchy/paths.d.ts +11 -0
  414. package/dist/storage/hierarchy/paths.d.ts.map +1 -0
  415. package/dist/storage/hierarchy/paths.js +43 -0
  416. package/dist/storage/hierarchy/paths.js.map +1 -0
  417. package/dist/storage/index/index.d.ts +3 -0
  418. package/dist/storage/index/index.d.ts.map +1 -0
  419. package/dist/storage/index/index.js +2 -0
  420. package/dist/storage/index/index.js.map +1 -0
  421. package/dist/storage/index/manager.d.ts +63 -0
  422. package/dist/storage/index/manager.d.ts.map +1 -0
  423. package/dist/storage/index/manager.js +2 -0
  424. package/dist/storage/index/manager.js.map +1 -0
  425. package/dist/storage/index/schema.d.ts +2 -0
  426. package/dist/storage/index/schema.d.ts.map +1 -0
  427. package/dist/storage/index/schema.js +2 -0
  428. package/dist/storage/index/schema.js.map +1 -0
  429. package/dist/storage/index/types.d.ts +37 -0
  430. package/dist/storage/index/types.d.ts.map +1 -0
  431. package/dist/storage/index/types.js +2 -0
  432. package/dist/storage/index/types.js.map +1 -0
  433. package/dist/storage/pdpp-records/cursor.d.ts +27 -0
  434. package/dist/storage/pdpp-records/cursor.d.ts.map +1 -0
  435. package/dist/storage/pdpp-records/cursor.js +49 -0
  436. package/dist/storage/pdpp-records/cursor.js.map +1 -0
  437. package/dist/storage/pdpp-records/enforcement.d.ts +37 -0
  438. package/dist/storage/pdpp-records/enforcement.d.ts.map +1 -0
  439. package/dist/storage/pdpp-records/enforcement.js +79 -0
  440. package/dist/storage/pdpp-records/enforcement.js.map +1 -0
  441. package/dist/storage/pdpp-records/index.d.ts +8 -0
  442. package/dist/storage/pdpp-records/index.d.ts.map +1 -0
  443. package/dist/storage/pdpp-records/index.js +8 -0
  444. package/dist/storage/pdpp-records/index.js.map +1 -0
  445. package/dist/storage/pdpp-records/interface.d.ts +49 -0
  446. package/dist/storage/pdpp-records/interface.d.ts.map +1 -0
  447. package/dist/storage/pdpp-records/interface.js +2 -0
  448. package/dist/storage/pdpp-records/interface.js.map +1 -0
  449. package/dist/storage/pdpp-records/memory-store.d.ts +9 -0
  450. package/dist/storage/pdpp-records/memory-store.d.ts.map +1 -0
  451. package/dist/storage/pdpp-records/memory-store.js +0 -0
  452. package/dist/storage/pdpp-records/memory-store.js.map +1 -0
  453. package/dist/storage/pdpp-records/record-key.d.ts +52 -0
  454. package/dist/storage/pdpp-records/record-key.d.ts.map +1 -0
  455. package/dist/storage/pdpp-records/record-key.js +97 -0
  456. package/dist/storage/pdpp-records/record-key.js.map +1 -0
  457. package/dist/storage/pdpp-records/stream-declaration.d.ts +43 -0
  458. package/dist/storage/pdpp-records/stream-declaration.d.ts.map +1 -0
  459. package/dist/storage/pdpp-records/stream-declaration.js +17 -0
  460. package/dist/storage/pdpp-records/stream-declaration.js.map +1 -0
  461. package/dist/storage/pdpp-records/types.d.ts +93 -0
  462. package/dist/storage/pdpp-records/types.d.ts.map +1 -0
  463. package/dist/storage/pdpp-records/types.js +17 -0
  464. package/dist/storage/pdpp-records/types.js.map +1 -0
  465. package/dist/storage/preview.d.ts +12 -0
  466. package/dist/storage/preview.d.ts.map +1 -0
  467. package/dist/storage/preview.js +239 -0
  468. package/dist/storage/preview.js.map +1 -0
  469. package/dist/sync/cursor.d.ts +10 -0
  470. package/dist/sync/cursor.d.ts.map +1 -0
  471. package/dist/sync/cursor.js +2 -0
  472. package/dist/sync/cursor.js.map +1 -0
  473. package/dist/sync/data-point-feed.d.ts +35 -0
  474. package/dist/sync/data-point-feed.d.ts.map +1 -0
  475. package/dist/sync/data-point-feed.js +122 -0
  476. package/dist/sync/data-point-feed.js.map +1 -0
  477. package/dist/sync/data-point-id.d.ts +7 -0
  478. package/dist/sync/data-point-id.d.ts.map +1 -0
  479. package/dist/sync/data-point-id.js +16 -0
  480. package/dist/sync/data-point-id.js.map +1 -0
  481. package/dist/sync/delete-data-port.d.ts +50 -0
  482. package/dist/sync/delete-data-port.d.ts.map +1 -0
  483. package/dist/sync/delete-data-port.js +244 -0
  484. package/dist/sync/delete-data-port.js.map +1 -0
  485. package/dist/sync/engine/sync-manager.d.ts +58 -0
  486. package/dist/sync/engine/sync-manager.d.ts.map +1 -0
  487. package/dist/sync/engine/sync-manager.js +285 -0
  488. package/dist/sync/engine/sync-manager.js.map +1 -0
  489. package/dist/sync/index.d.ts +15 -0
  490. package/dist/sync/index.d.ts.map +1 -0
  491. package/dist/sync/index.js +14 -0
  492. package/dist/sync/index.js.map +1 -0
  493. package/dist/sync/issues.d.ts +55 -0
  494. package/dist/sync/issues.d.ts.map +1 -0
  495. package/dist/sync/issues.js +168 -0
  496. package/dist/sync/issues.js.map +1 -0
  497. package/dist/sync/pdpp-import.d.ts +192 -0
  498. package/dist/sync/pdpp-import.d.ts.map +1 -0
  499. package/dist/sync/pdpp-import.js +422 -0
  500. package/dist/sync/pdpp-import.js.map +1 -0
  501. package/dist/sync/pending-blob-deletions.d.ts +29 -0
  502. package/dist/sync/pending-blob-deletions.d.ts.map +1 -0
  503. package/dist/sync/pending-blob-deletions.js +116 -0
  504. package/dist/sync/pending-blob-deletions.js.map +1 -0
  505. package/dist/sync/retry-memory.d.ts +33 -0
  506. package/dist/sync/retry-memory.d.ts.map +1 -0
  507. package/dist/sync/retry-memory.js +68 -0
  508. package/dist/sync/retry-memory.js.map +1 -0
  509. package/dist/sync/scope-deletions.d.ts +155 -0
  510. package/dist/sync/scope-deletions.d.ts.map +1 -0
  511. package/dist/sync/scope-deletions.js +225 -0
  512. package/dist/sync/scope-deletions.js.map +1 -0
  513. package/dist/sync/tombstone.d.ts +27 -0
  514. package/dist/sync/tombstone.d.ts.map +1 -0
  515. package/dist/sync/tombstone.js +28 -0
  516. package/dist/sync/tombstone.js.map +1 -0
  517. package/dist/sync/types.d.ts +27 -0
  518. package/dist/sync/types.d.ts.map +1 -0
  519. package/dist/sync/types.js +2 -0
  520. package/dist/sync/types.js.map +1 -0
  521. package/dist/sync/workers/delete.d.ts +163 -0
  522. package/dist/sync/workers/delete.d.ts.map +1 -0
  523. package/dist/sync/workers/delete.js +474 -0
  524. package/dist/sync/workers/delete.js.map +1 -0
  525. package/dist/sync/workers/download.d.ts +159 -0
  526. package/dist/sync/workers/download.d.ts.map +1 -0
  527. package/dist/sync/workers/download.js +731 -0
  528. package/dist/sync/workers/download.js.map +1 -0
  529. package/dist/sync/workers/upload.d.ts +98 -0
  530. package/dist/sync/workers/upload.d.ts.map +1 -0
  531. package/dist/sync/workers/upload.js +412 -0
  532. package/dist/sync/workers/upload.js.map +1 -0
  533. package/dist/test-utils/e2ee-fixtures.d.ts +94 -0
  534. package/dist/test-utils/e2ee-fixtures.d.ts.map +1 -0
  535. package/dist/test-utils/e2ee-fixtures.js +116 -0
  536. package/dist/test-utils/e2ee-fixtures.js.map +1 -0
  537. package/dist/test-utils/e2ee-gateway.d.ts +61 -0
  538. package/dist/test-utils/e2ee-gateway.d.ts.map +1 -0
  539. package/dist/test-utils/e2ee-gateway.js +248 -0
  540. package/dist/test-utils/e2ee-gateway.js.map +1 -0
  541. package/dist/test-utils/index.d.ts +5 -0
  542. package/dist/test-utils/index.d.ts.map +1 -0
  543. package/dist/test-utils/index.js +5 -0
  544. package/dist/test-utils/index.js.map +1 -0
  545. package/dist/test-utils/memory-storage.d.ts +12 -0
  546. package/dist/test-utils/memory-storage.d.ts.map +1 -0
  547. package/dist/test-utils/memory-storage.js +146 -0
  548. package/dist/test-utils/memory-storage.js.map +1 -0
  549. package/dist/test-utils/wallet.d.ts +47 -0
  550. package/dist/test-utils/wallet.d.ts.map +1 -0
  551. package/dist/test-utils/wallet.js +98 -0
  552. package/dist/test-utils/wallet.js.map +1 -0
  553. package/dist/write/attribution.d.ts +185 -0
  554. package/dist/write/attribution.d.ts.map +1 -0
  555. package/dist/write/attribution.js +450 -0
  556. package/dist/write/attribution.js.map +1 -0
  557. package/dist/write/authorize.d.ts +77 -0
  558. package/dist/write/authorize.d.ts.map +1 -0
  559. package/dist/write/authorize.js +109 -0
  560. package/dist/write/authorize.js.map +1 -0
  561. package/dist/write/index.d.ts +5 -0
  562. package/dist/write/index.d.ts.map +1 -0
  563. package/dist/write/index.js +5 -0
  564. package/dist/write/index.js.map +1 -0
  565. package/dist/write/route.d.ts +61 -0
  566. package/dist/write/route.d.ts.map +1 -0
  567. package/dist/write/route.js +132 -0
  568. package/dist/write/route.js.map +1 -0
  569. package/dist/write/session.d.ts +96 -0
  570. package/dist/write/session.d.ts.map +1 -0
  571. package/dist/write/session.js +136 -0
  572. package/dist/write/session.js.map +1 -0
  573. package/package.json +175 -0
@@ -0,0 +1,179 @@
1
+ /**
2
+ * PDPP ↔ Vana chain grant binding (scope §6, "gateway binding" branch).
3
+ *
4
+ * ## What this is, and what it deliberately is not
5
+ *
6
+ * PDPP Core is chain-neutral. Vana is not: a data read is authorized by a
7
+ * *chain* grant (a `DataPortabilityPermissions` permission, surfaced through
8
+ * the Data Gateway as `GatewayGrantResponse`), while PDPP consent produces a
9
+ * separate *PDPP* grant (an RFC 9396 artifact with a `grant_id`, resolved
10
+ * streams, and frozen declaration facts). Those are two authorities over two
11
+ * different objects, and §7 keeps them separate on purpose.
12
+ *
13
+ * Section 6 asks for the *smallest real binding* between them. This module is
14
+ * that binding: a durable record asserting "PDPP grant X is the consent
15
+ * artifact behind chain permission Y, for owner O and grantee app A".
16
+ *
17
+ * ### Why there is no new hash protocol here
18
+ *
19
+ * An earlier proposal derived a `keccak256` "binding key" over the permission
20
+ * fields. That is rejected, for three reasons that matter:
21
+ *
22
+ * 1. **A sequential permission ID is not a content address.** The chain
23
+ * allocates `permissionId` as a counter. Hashing it produces a value that
24
+ * *looks* content-addressed while committing to nothing — a digest of an
25
+ * index is still an index.
26
+ * 2. **Hashing a mutable grant URI does not bind grant bytes.** The on-chain
27
+ * `grant` field is a URI (IPFS or HTTPS). Hashing the *URI* binds the
28
+ * pointer, not the document; the document behind an HTTPS URI can change
29
+ * freely afterwards. Binding actual frozen bytes would require hashing the
30
+ * retrieved content, which is what the PDPP declaration digest already
31
+ * does — separately, and correctly.
32
+ * 3. **`endBlock` is mutable, so it cannot be part of a stable identity.**
33
+ * Revocation *sets* `endBlock`. A "stable identity" that changes on
34
+ * revocation is not an identity; it is a status encoding wearing an
35
+ * identity's clothes, and it silently breaks any record keyed by it.
36
+ *
37
+ * The chain already provides an unambiguous, durable identity — the tuple
38
+ * (chainId, contract address, permissionId) — and an unambiguous revocation
39
+ * signal. A record keyed by that identity is sufficient, so per the scope's
40
+ * own instruction ("do not invent a new hash protocol if a durable record
41
+ * keyed by existing chain permission identity suffices") we key by it and
42
+ * derive nothing.
43
+ *
44
+ * ### No signed struct changes
45
+ *
46
+ * Nothing here enters the EIP-712 `Grant`/`Permission` payload, so the
47
+ * typehash is untouched and no coordinated signer/verifier/contract rollout is
48
+ * triggered. That is what keeps this in the 1–2 day "gateway binding" branch
49
+ * rather than the 6–8 day chain-migration branch.
50
+ */
51
+ import type { GatewayGrantResponse } from "@opendatalabs/vana-sdk/browser";
52
+ /**
53
+ * The chain-side identity of a grant. This tuple — and not any derived digest
54
+ * — is the binding key.
55
+ *
56
+ * `chainId` and `contractAddress` are both required because `permissionId` is
57
+ * a per-deployment counter: permission 1 on Moksha and permission 1 on Vana
58
+ * mainnet are unrelated grants. Keying on `permissionId` alone would let a
59
+ * record from one network authorize a read on another.
60
+ */
61
+ export interface ChainPermissionRef {
62
+ /** EIP-155 chain ID of the deployment that allocated `permissionId`. */
63
+ chainId: number;
64
+ /** `DataPortabilityPermissions` proxy address on that chain. */
65
+ contractAddress: `0x${string}`;
66
+ /** The on-chain permission ID, as a decimal string (uint256). */
67
+ permissionId: string;
68
+ }
69
+ /**
70
+ * An immutable binding between one resolved PDPP grant and one chain
71
+ * permission.
72
+ *
73
+ * Immutability is the point: this record is written once, at grant creation,
74
+ * and is never mutated — not even on revocation. Revocation is a *live* fact
75
+ * read from the chain grant (`revokedAt`), never a field edited here. Copying
76
+ * a mutable status into an immutable record is how a stale "still valid" claim
77
+ * survives a revocation, so the two are kept strictly apart.
78
+ */
79
+ export interface PdppGrantBinding {
80
+ /** `grant_id` of the resolved PDPP grant (the consent artifact). */
81
+ pdppGrantId: string;
82
+ /** Chain identity of the permission that authorizes reads for this grant. */
83
+ permission: ChainPermissionRef;
84
+ /**
85
+ * The data owner. Must equal both the chain grant's `grantorAddress` and the
86
+ * PS's configured `serverOwner` at read time.
87
+ */
88
+ ownerAddress: `0x${string}`;
89
+ /**
90
+ * The grantee app's wallet address — the app's *existing* identity, carried
91
+ * through unchanged.
92
+ *
93
+ * §6 requires one grantee identity per Context Gateway builder/app: the
94
+ * PDPP `client_id`, the issued grant, the ledger grant, and the access-history
95
+ * grantee must all resolve to this one address. We record the address the app
96
+ * already has; we do not allocate one.
97
+ */
98
+ granteeAddress: `0x${string}`;
99
+ /** The PDPP OAuth `client_id` that the above address belongs to. */
100
+ pdppClientId: string;
101
+ /** The gateway's grantee ID for that address, as the chain grant reports it. */
102
+ granteeId: string;
103
+ /** When the binding was recorded (ISO 8601). Provenance, not status. */
104
+ boundAt: string;
105
+ }
106
+ /**
107
+ * Compare two chain permission references. All three components must match —
108
+ * see `ChainPermissionRef` for why the address and chain ID are load-bearing.
109
+ */
110
+ export declare function samePermission(a: ChainPermissionRef, b: ChainPermissionRef): boolean;
111
+ export interface CreateBindingInput {
112
+ pdppGrantId: string;
113
+ permission: ChainPermissionRef;
114
+ /** The PS's configured owner address. */
115
+ serverOwner: `0x${string}`;
116
+ /** The app's existing grantee wallet address. */
117
+ granteeAddress: `0x${string}`;
118
+ pdppClientId: string;
119
+ /** The chain grant this PDPP grant is being bound to, as the gateway reports it. */
120
+ chainGrant: GatewayGrantResponse;
121
+ now?: Date;
122
+ }
123
+ /**
124
+ * Create the binding at grant-creation time, refusing to record one that is
125
+ * already inconsistent.
126
+ *
127
+ * This is the *creation* boundary check. It is deliberately strict: a binding
128
+ * written now is trusted later, so anything we fail to verify here becomes an
129
+ * unverifiable assertion at read time. Specifically it rejects:
130
+ *
131
+ * - a chain grant whose `grantorAddress` is not this server's owner (binding
132
+ * another owner's grant to our PDPP consent),
133
+ * - a chain grant whose `granteeId` is not the app's (binding a grant issued
134
+ * to a *different* app),
135
+ * - a chain grant that is already revoked (never record a dead grant as live),
136
+ * - a chain grant whose id does not match the permission being bound.
137
+ */
138
+ export declare function createPdppGrantBinding(input: CreateBindingInput): PdppGrantBinding;
139
+ export interface VerifyBindingInput {
140
+ /** The retained, immutable binding record. */
141
+ binding: PdppGrantBinding;
142
+ /** The PDPP grant id presented by the caller. */
143
+ pdppGrantId: string;
144
+ /** The PS's configured owner address, at read time. */
145
+ serverOwner: `0x${string}`;
146
+ /** The address that signed this request (the app's grantee wallet). */
147
+ requestSigner: `0x${string}`;
148
+ /**
149
+ * The chain grant as read *now*. Revocation is read live from here; it is
150
+ * never taken from the binding record.
151
+ */
152
+ chainGrant: GatewayGrantResponse | null;
153
+ /** The deployment the PS is configured against, at read time. */
154
+ deployment: {
155
+ chainId: number;
156
+ contractAddress: `0x${string}`;
157
+ };
158
+ }
159
+ /**
160
+ * Verify a binding at read time.
161
+ *
162
+ * Every axis §6 names is checked against the *retained* binding, so a
163
+ * mismatch on any one of owner, app, chain, contract, or record fails closed:
164
+ *
165
+ * - **record**: the presented PDPP grant id must be the one bound,
166
+ * - **chain/contract**: the binding's deployment must be the one the PS is
167
+ * configured against (a Moksha binding cannot authorize a mainnet read),
168
+ * - **owner**: the binding's owner must still be this server's owner, and the
169
+ * live chain grant's grantor must agree,
170
+ * - **app**: the request signer must be the bound grantee address, and the
171
+ * live chain grant must still name that grantee,
172
+ * - **revocation**: the live chain grant must exist and be unrevoked.
173
+ *
174
+ * No chain I/O happens in this function — the caller supplies the already-read
175
+ * `chainGrant`. That keeps this usable on the hot read path without adding a
176
+ * network round trip per request.
177
+ */
178
+ export declare function verifyPdppGrantBinding(input: VerifyBindingInput): void;
179
+ //# sourceMappingURL=pdpp-binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdpp-binding.d.ts","sourceRoot":"","sources":["../../src/grants/pdpp-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AASH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3E;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,UAAU,EAAE,kBAAkB,CAAC;IAC/B;;;OAGG;IACH,YAAY,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5B;;;;;;;;OAQG;IACH,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;IAC9B,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;CACjB;AAOD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,CAAC,EAAE,kBAAkB,EACrB,CAAC,EAAE,kBAAkB,GACpB,OAAO,CAMT;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,yCAAyC;IACzC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,iDAAiD;IACjD,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,UAAU,EAAE,oBAAoB,CAAC;IACjC,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,kBAAkB,GACxB,gBAAgB,CA0ClB;AAED,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,OAAO,EAAE,gBAAgB,CAAC;IAC1B,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,uEAAuE;IACvE,aAAa,EAAE,KAAK,MAAM,EAAE,CAAC;IAC7B;;;OAGG;IACH,UAAU,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACxC,iEAAiE;IACjE,UAAU,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,KAAK,MAAM,EAAE,CAAA;KAAE,CAAC;CACjE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAuFtE"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * PDPP ↔ Vana chain grant binding (scope §6, "gateway binding" branch).
3
+ *
4
+ * ## What this is, and what it deliberately is not
5
+ *
6
+ * PDPP Core is chain-neutral. Vana is not: a data read is authorized by a
7
+ * *chain* grant (a `DataPortabilityPermissions` permission, surfaced through
8
+ * the Data Gateway as `GatewayGrantResponse`), while PDPP consent produces a
9
+ * separate *PDPP* grant (an RFC 9396 artifact with a `grant_id`, resolved
10
+ * streams, and frozen declaration facts). Those are two authorities over two
11
+ * different objects, and §7 keeps them separate on purpose.
12
+ *
13
+ * Section 6 asks for the *smallest real binding* between them. This module is
14
+ * that binding: a durable record asserting "PDPP grant X is the consent
15
+ * artifact behind chain permission Y, for owner O and grantee app A".
16
+ *
17
+ * ### Why there is no new hash protocol here
18
+ *
19
+ * An earlier proposal derived a `keccak256` "binding key" over the permission
20
+ * fields. That is rejected, for three reasons that matter:
21
+ *
22
+ * 1. **A sequential permission ID is not a content address.** The chain
23
+ * allocates `permissionId` as a counter. Hashing it produces a value that
24
+ * *looks* content-addressed while committing to nothing — a digest of an
25
+ * index is still an index.
26
+ * 2. **Hashing a mutable grant URI does not bind grant bytes.** The on-chain
27
+ * `grant` field is a URI (IPFS or HTTPS). Hashing the *URI* binds the
28
+ * pointer, not the document; the document behind an HTTPS URI can change
29
+ * freely afterwards. Binding actual frozen bytes would require hashing the
30
+ * retrieved content, which is what the PDPP declaration digest already
31
+ * does — separately, and correctly.
32
+ * 3. **`endBlock` is mutable, so it cannot be part of a stable identity.**
33
+ * Revocation *sets* `endBlock`. A "stable identity" that changes on
34
+ * revocation is not an identity; it is a status encoding wearing an
35
+ * identity's clothes, and it silently breaks any record keyed by it.
36
+ *
37
+ * The chain already provides an unambiguous, durable identity — the tuple
38
+ * (chainId, contract address, permissionId) — and an unambiguous revocation
39
+ * signal. A record keyed by that identity is sufficient, so per the scope's
40
+ * own instruction ("do not invent a new hash protocol if a durable record
41
+ * keyed by existing chain permission identity suffices") we key by it and
42
+ * derive nothing.
43
+ *
44
+ * ### No signed struct changes
45
+ *
46
+ * Nothing here enters the EIP-712 `Grant`/`Permission` payload, so the
47
+ * typehash is untouched and no coordinated signer/verifier/contract rollout is
48
+ * triggered. That is what keeps this in the 1–2 day "gateway binding" branch
49
+ * rather than the 6–8 day chain-migration branch.
50
+ */
51
+ import { GrantOwnerMismatchError, GrantRevokedError, InvalidSignatureError, ScopeMismatchError, } from "../errors/catalog.js";
52
+ /** Normalizes an address for comparison. Addresses are case-insensitive. */
53
+ function sameAddress(a, b) {
54
+ return typeof a === "string" && a.toLowerCase() === b.toLowerCase();
55
+ }
56
+ /**
57
+ * Compare two chain permission references. All three components must match —
58
+ * see `ChainPermissionRef` for why the address and chain ID are load-bearing.
59
+ */
60
+ export function samePermission(a, b) {
61
+ return (a.chainId === b.chainId &&
62
+ a.contractAddress.toLowerCase() === b.contractAddress.toLowerCase() &&
63
+ a.permissionId === b.permissionId);
64
+ }
65
+ /**
66
+ * Create the binding at grant-creation time, refusing to record one that is
67
+ * already inconsistent.
68
+ *
69
+ * This is the *creation* boundary check. It is deliberately strict: a binding
70
+ * written now is trusted later, so anything we fail to verify here becomes an
71
+ * unverifiable assertion at read time. Specifically it rejects:
72
+ *
73
+ * - a chain grant whose `grantorAddress` is not this server's owner (binding
74
+ * another owner's grant to our PDPP consent),
75
+ * - a chain grant whose `granteeId` is not the app's (binding a grant issued
76
+ * to a *different* app),
77
+ * - a chain grant that is already revoked (never record a dead grant as live),
78
+ * - a chain grant whose id does not match the permission being bound.
79
+ */
80
+ export function createPdppGrantBinding(input) {
81
+ const { chainGrant, serverOwner, granteeAddress, permission } = input;
82
+ if (chainGrant.id !== permission.permissionId) {
83
+ throw new InvalidSignatureError({
84
+ reason: "Chain grant id does not match the permission being bound",
85
+ expected: permission.permissionId,
86
+ actual: chainGrant.id,
87
+ });
88
+ }
89
+ if (!sameAddress(chainGrant.grantorAddress, serverOwner)) {
90
+ throw new GrantOwnerMismatchError({
91
+ grantId: chainGrant.id,
92
+ expected: serverOwner,
93
+ actual: chainGrant.grantorAddress ?? null,
94
+ });
95
+ }
96
+ // Bind to the app's EXISTING grantee identity. If the chain grant was issued
97
+ // to a different grantee, this PDPP consent does not describe it.
98
+ if (!sameAddress(chainGrant.granteeId, granteeAddress)) {
99
+ throw new InvalidSignatureError({
100
+ reason: "Chain grant grantee does not match the app's grantee address",
101
+ expected: granteeAddress,
102
+ actual: chainGrant.granteeId,
103
+ });
104
+ }
105
+ if (chainGrant.revokedAt !== null && chainGrant.revokedAt !== undefined) {
106
+ throw new GrantRevokedError({ grantId: chainGrant.id });
107
+ }
108
+ return Object.freeze({
109
+ pdppGrantId: input.pdppGrantId,
110
+ permission,
111
+ ownerAddress: serverOwner,
112
+ granteeAddress,
113
+ pdppClientId: input.pdppClientId,
114
+ granteeId: chainGrant.granteeId,
115
+ boundAt: (input.now ?? new Date()).toISOString(),
116
+ });
117
+ }
118
+ /**
119
+ * Verify a binding at read time.
120
+ *
121
+ * Every axis §6 names is checked against the *retained* binding, so a
122
+ * mismatch on any one of owner, app, chain, contract, or record fails closed:
123
+ *
124
+ * - **record**: the presented PDPP grant id must be the one bound,
125
+ * - **chain/contract**: the binding's deployment must be the one the PS is
126
+ * configured against (a Moksha binding cannot authorize a mainnet read),
127
+ * - **owner**: the binding's owner must still be this server's owner, and the
128
+ * live chain grant's grantor must agree,
129
+ * - **app**: the request signer must be the bound grantee address, and the
130
+ * live chain grant must still name that grantee,
131
+ * - **revocation**: the live chain grant must exist and be unrevoked.
132
+ *
133
+ * No chain I/O happens in this function — the caller supplies the already-read
134
+ * `chainGrant`. That keeps this usable on the hot read path without adding a
135
+ * network round trip per request.
136
+ */
137
+ export function verifyPdppGrantBinding(input) {
138
+ const { binding, chainGrant, deployment } = input;
139
+ // Record binding: the consent artifact presented must be the bound one.
140
+ if (binding.pdppGrantId !== input.pdppGrantId) {
141
+ throw new ScopeMismatchError({
142
+ requestedScope: "pdpp:binding",
143
+ reason: "PDPP grant id does not match the binding record",
144
+ expected: binding.pdppGrantId,
145
+ actual: input.pdppGrantId,
146
+ });
147
+ }
148
+ // Chain/contract binding: a record from another deployment is not evidence
149
+ // here, because permissionId is only unique within one deployment.
150
+ if (binding.permission.chainId !== deployment.chainId ||
151
+ binding.permission.contractAddress.toLowerCase() !==
152
+ deployment.contractAddress.toLowerCase()) {
153
+ throw new ScopeMismatchError({
154
+ requestedScope: "pdpp:binding",
155
+ reason: "Binding is for a different chain deployment",
156
+ expected: `${deployment.chainId}:${deployment.contractAddress}`,
157
+ actual: `${binding.permission.chainId}:${binding.permission.contractAddress}`,
158
+ });
159
+ }
160
+ // Owner binding, against the server's current configuration.
161
+ if (!sameAddress(binding.ownerAddress, input.serverOwner)) {
162
+ throw new GrantOwnerMismatchError({
163
+ grantId: binding.permission.permissionId,
164
+ expected: input.serverOwner,
165
+ actual: binding.ownerAddress,
166
+ });
167
+ }
168
+ // App binding: the caller must BE the bound grantee, not merely know its id.
169
+ if (!sameAddress(input.requestSigner, binding.granteeAddress)) {
170
+ throw new InvalidSignatureError({
171
+ reason: "Request signer is not the bound grantee for this PDPP grant",
172
+ expected: binding.granteeAddress,
173
+ actual: input.requestSigner,
174
+ });
175
+ }
176
+ // Revocation is read live. A missing chain grant is treated as revoked
177
+ // rather than as "unknown": failing open here would let a deleted or
178
+ // unreachable permission authorize reads.
179
+ if (!chainGrant) {
180
+ throw new GrantRevokedError({
181
+ grantId: binding.permission.permissionId,
182
+ reason: "Chain grant not found",
183
+ });
184
+ }
185
+ if (chainGrant.id !== binding.permission.permissionId) {
186
+ throw new ScopeMismatchError({
187
+ requestedScope: "pdpp:binding",
188
+ reason: "Chain grant id does not match the binding record",
189
+ expected: binding.permission.permissionId,
190
+ actual: chainGrant.id,
191
+ });
192
+ }
193
+ if (chainGrant.revokedAt !== null && chainGrant.revokedAt !== undefined) {
194
+ throw new GrantRevokedError({ grantId: chainGrant.id });
195
+ }
196
+ // The live chain grant must still agree with the binding on both parties.
197
+ // These can diverge from the record only if the gateway is serving a
198
+ // different grant under the same id, which we must not paper over.
199
+ if (!sameAddress(chainGrant.grantorAddress, binding.ownerAddress)) {
200
+ throw new GrantOwnerMismatchError({
201
+ grantId: chainGrant.id,
202
+ expected: binding.ownerAddress,
203
+ actual: chainGrant.grantorAddress ?? null,
204
+ });
205
+ }
206
+ if (!sameAddress(chainGrant.granteeId, binding.granteeAddress)) {
207
+ throw new InvalidSignatureError({
208
+ reason: "Chain grant grantee no longer matches the bound grantee",
209
+ expected: binding.granteeAddress,
210
+ actual: chainGrant.granteeId,
211
+ });
212
+ }
213
+ }
214
+ //# sourceMappingURL=pdpp-binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdpp-binding.js","sourceRoot":"","sources":["../../src/grants/pdpp-binding.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ export type { KeyFileData, ServerAccount, SignTypedDataParams, } from "./server-account.js";
2
+ export { createPublicOnlyAccount, type PublicOnlyAccountInput, } from "./public-only-account.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,aAAa,EACb,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,uBAAuB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { createPublicOnlyAccount, } from "./public-only-account.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,uBAAuB,GAExB,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type Address, type Hex } from "viem";
2
+ import type { ServerAccount } from "./server-account.js";
3
+ export interface PublicOnlyAccountInput {
4
+ address: Address;
5
+ publicKey: Hex;
6
+ }
7
+ export declare function createPublicOnlyAccount(input: PublicOnlyAccountInput): ServerAccount;
8
+ //# sourceMappingURL=public-only-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-only-account.d.ts","sourceRoot":"","sources":["../../src/keys/public-only-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,sBAAsB,GAC5B,aAAa,CAgBf"}
@@ -0,0 +1,21 @@
1
+ import { isAddressEqual } from "viem";
2
+ import { publicKeyToAddress } from "viem/accounts";
3
+ import { ServerSigningUnavailableError } from "../errors/catalog.js";
4
+ const KEY_MISMATCH_MESSAGE = "Public key does not match server address";
5
+ export function createPublicOnlyAccount(input) {
6
+ const derivedAddress = publicKeyToAddress(input.publicKey);
7
+ if (!isAddressEqual(derivedAddress, input.address)) {
8
+ throw new Error(KEY_MISMATCH_MESSAGE);
9
+ }
10
+ return {
11
+ address: input.address,
12
+ publicKey: input.publicKey,
13
+ async signTypedData() {
14
+ throw new ServerSigningUnavailableError();
15
+ },
16
+ async signMessage() {
17
+ throw new ServerSigningUnavailableError();
18
+ },
19
+ };
20
+ }
21
+ //# sourceMappingURL=public-only-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-only-account.js","sourceRoot":"","sources":["../../src/keys/public-only-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA0B,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAGrE,MAAM,oBAAoB,GAAG,0CAA0C,CAAC;AAOxE,MAAM,UAAU,uBAAuB,CACrC,KAA6B;IAE7B,MAAM,cAAc,GAAG,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC3D,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,KAAK,CAAC,aAAa;YACjB,MAAM,IAAI,6BAA6B,EAAE,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,WAAW;YACf,MAAM,IAAI,6BAA6B,EAAE,CAAC;QAC5C,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { TypedDataDomain } from "viem";
2
+ export interface SignTypedDataParams {
3
+ domain: TypedDataDomain;
4
+ types: Record<string, readonly {
5
+ name: string;
6
+ type: string;
7
+ }[]>;
8
+ primaryType: string;
9
+ message: Record<string, unknown>;
10
+ }
11
+ export interface ServerAccount {
12
+ address: `0x${string}`;
13
+ /** Uncompressed public key (65 bytes, 0x04 prefix). */
14
+ publicKey: `0x${string}`;
15
+ signTypedData(params: SignTypedDataParams): Promise<`0x${string}`>;
16
+ /** Sign a personal message (EIP-191). */
17
+ signMessage(message: string): Promise<`0x${string}`>;
18
+ }
19
+ export interface KeyFileData {
20
+ address: string;
21
+ publicKey: string;
22
+ privateKey: string;
23
+ }
24
+ //# sourceMappingURL=server-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-account.d.ts","sourceRoot":"","sources":["../../src/keys/server-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAE5C,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,eAAe,CAAC;IAIxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,uDAAuD;IACvD,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;IACnE,yCAAyC;IACzC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=server-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-account.js","sourceRoot":"","sources":["../../src/keys/server-account.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * LineageAttestation: the server-signed statement that binds a derivative's
3
+ * lineage to the version it is registered with.
4
+ *
5
+ * The on-chain AddData struct is unchanged and `dataHash` (keccak256 of the
6
+ * plaintext envelope, `$lineage` included) already commits to the lineage.
7
+ * The gateway cannot open that commitment, so the plaintext source list it
8
+ * stores next to the registration needs its own proof of authorship: the
9
+ * AddData signature is public in every gateway attestation, so without one
10
+ * anybody could replay a registration as a same-version refresh carrying a
11
+ * different lineage. The attestation is EIP-712 under the DataRegistry
12
+ * domain (same as AddData), signed by the owner or a registered server,
13
+ * and bound to the exact version and dataHash so it cannot be moved to
14
+ * another registration either.
15
+ */
16
+ export declare const LINEAGE_ATTESTATION_TYPES: {
17
+ readonly LineageAttestation: readonly [{
18
+ readonly name: "ownerAddress";
19
+ readonly type: "address";
20
+ }, {
21
+ readonly name: "scope";
22
+ readonly type: "string";
23
+ }, {
24
+ readonly name: "expectedVersion";
25
+ readonly type: "uint256";
26
+ }, {
27
+ readonly name: "dataHash";
28
+ readonly type: "bytes32";
29
+ }, {
30
+ readonly name: "sources";
31
+ readonly type: "bytes32[]";
32
+ }];
33
+ };
34
+ export interface LineageAttestationMessage {
35
+ ownerAddress: `0x${string}`;
36
+ scope: string;
37
+ expectedVersion: bigint;
38
+ dataHash: `0x${string}`;
39
+ /** Lowercase source data point ids in the registered order. */
40
+ sources: readonly `0x${string}`[];
41
+ }
42
+ //# sourceMappingURL=attestation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../../src/lineage/attestation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;CAQ5B,CAAC;AAEX,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,+DAA+D;IAC/D,OAAO,EAAE,SAAS,KAAK,MAAM,EAAE,EAAE,CAAC;CACnC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * LineageAttestation: the server-signed statement that binds a derivative's
3
+ * lineage to the version it is registered with.
4
+ *
5
+ * The on-chain AddData struct is unchanged and `dataHash` (keccak256 of the
6
+ * plaintext envelope, `$lineage` included) already commits to the lineage.
7
+ * The gateway cannot open that commitment, so the plaintext source list it
8
+ * stores next to the registration needs its own proof of authorship: the
9
+ * AddData signature is public in every gateway attestation, so without one
10
+ * anybody could replay a registration as a same-version refresh carrying a
11
+ * different lineage. The attestation is EIP-712 under the DataRegistry
12
+ * domain (same as AddData), signed by the owner or a registered server,
13
+ * and bound to the exact version and dataHash so it cannot be moved to
14
+ * another registration either.
15
+ */
16
+ export const LINEAGE_ATTESTATION_TYPES = {
17
+ LineageAttestation: [
18
+ { name: "ownerAddress", type: "address" },
19
+ { name: "scope", type: "string" },
20
+ { name: "expectedVersion", type: "uint256" },
21
+ { name: "dataHash", type: "bytes32" },
22
+ { name: "sources", type: "bytes32[]" },
23
+ ],
24
+ };
25
+ //# sourceMappingURL=attestation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestation.js","sourceRoot":"","sources":["../../src/lineage/attestation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,kBAAkB,EAAE;QAClB,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE;QACzC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE;QAC5C,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;QACrC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE;KACvC;CACO,CAAC"}