zklicensing 0.1.0-beta.2 → 0.1.0-beta.21

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 (317) hide show
  1. package/README.md +417 -201
  2. package/build/agent.d.ts +371 -0
  3. package/build/agent.d.ts.map +1 -0
  4. package/build/agent.js +553 -0
  5. package/build/agent.js.map +1 -0
  6. package/build/agentActions.d.ts +841 -0
  7. package/build/agentActions.d.ts.map +1 -0
  8. package/build/agentActions.js +581 -0
  9. package/build/agentActions.js.map +1 -0
  10. package/build/agentRecord.d.ts +83 -0
  11. package/build/agentRecord.d.ts.map +1 -0
  12. package/build/agentRecord.js +69 -0
  13. package/build/agentRecord.js.map +1 -0
  14. package/build/agentVendor.d.ts +220 -0
  15. package/build/agentVendor.d.ts.map +1 -0
  16. package/build/agentVendor.js +306 -0
  17. package/build/agentVendor.js.map +1 -0
  18. package/build/appsLookup.d.ts +14 -0
  19. package/build/appsLookup.d.ts.map +1 -0
  20. package/build/appsLookup.js +12 -0
  21. package/build/appsLookup.js.map +1 -0
  22. package/build/archiveBootstrap.d.ts +31 -5
  23. package/build/archiveBootstrap.d.ts.map +1 -0
  24. package/build/archiveBootstrap.js +140 -47
  25. package/build/archiveBootstrap.js.map +1 -0
  26. package/build/atomicJson.d.ts +5 -0
  27. package/build/atomicJson.d.ts.map +1 -0
  28. package/build/atomicJson.js +55 -0
  29. package/build/atomicJson.js.map +1 -0
  30. package/build/bindClient.d.ts +85 -0
  31. package/build/bindClient.d.ts.map +1 -0
  32. package/build/bindClient.js +187 -0
  33. package/build/bindClient.js.map +1 -0
  34. package/build/buyClient.d.ts +27 -4
  35. package/build/buyClient.d.ts.map +1 -0
  36. package/build/buyClient.js +72 -26
  37. package/build/buyClient.js.map +1 -0
  38. package/build/chainHead.d.ts +61 -0
  39. package/build/chainHead.d.ts.map +1 -0
  40. package/build/chainHead.js +88 -0
  41. package/build/chainHead.js.map +1 -0
  42. package/build/compactMerkleMap.d.ts +72 -0
  43. package/build/compactMerkleMap.d.ts.map +1 -0
  44. package/build/compactMerkleMap.js +224 -0
  45. package/build/compactMerkleMap.js.map +1 -0
  46. package/build/contractInterface.d.ts +191 -51
  47. package/build/contractInterface.d.ts.map +1 -0
  48. package/build/contractInterface.js +234 -43
  49. package/build/contractInterface.js.map +1 -0
  50. package/build/contractTypes.d.ts +9 -0
  51. package/build/contractTypes.d.ts.map +1 -0
  52. package/build/contractTypes.js +28 -0
  53. package/build/contractTypes.js.map +1 -0
  54. package/build/countryStats.d.ts +12 -3
  55. package/build/countryStats.d.ts.map +1 -0
  56. package/build/countryStats.js +87 -23
  57. package/build/countryStats.js.map +1 -0
  58. package/build/deployClient.d.ts +138 -24
  59. package/build/deployClient.d.ts.map +1 -0
  60. package/build/deployClient.js +91 -31
  61. package/build/deployClient.js.map +1 -0
  62. package/build/deviceIdentity.d.ts +68 -0
  63. package/build/deviceIdentity.d.ts.map +1 -0
  64. package/build/deviceIdentity.js +209 -0
  65. package/build/deviceIdentity.js.map +1 -0
  66. package/build/freezeClient.d.ts +26 -6
  67. package/build/freezeClient.d.ts.map +1 -0
  68. package/build/freezeClient.js +30 -6
  69. package/build/freezeClient.js.map +1 -0
  70. package/build/generationClient.d.ts +6 -3
  71. package/build/generationClient.d.ts.map +1 -0
  72. package/build/generationClient.js +25 -38
  73. package/build/generationClient.js.map +1 -0
  74. package/build/holderSecret.d.ts +70 -0
  75. package/build/holderSecret.d.ts.map +1 -0
  76. package/build/holderSecret.js +76 -0
  77. package/build/holderSecret.js.map +1 -0
  78. package/build/index.d.ts +38 -38
  79. package/build/index.d.ts.map +1 -0
  80. package/build/index.js +97 -121
  81. package/build/index.js.map +1 -0
  82. package/build/keysClient.d.ts +142 -0
  83. package/build/keysClient.d.ts.map +1 -0
  84. package/build/keysClient.js +109 -0
  85. package/build/keysClient.js.map +1 -0
  86. package/build/licenseLeaf.d.ts +76 -0
  87. package/build/licenseLeaf.d.ts.map +1 -0
  88. package/build/licenseLeaf.js +189 -0
  89. package/build/licenseLeaf.js.map +1 -0
  90. package/build/licenseRecord.d.ts +68 -5
  91. package/build/licenseRecord.d.ts.map +1 -0
  92. package/build/licenseRecord.js +26 -1
  93. package/build/licenseRecord.js.map +1 -0
  94. package/build/licenseStore.d.ts +81 -4
  95. package/build/licenseStore.d.ts.map +1 -0
  96. package/build/licenseStore.js +400 -30
  97. package/build/licenseStore.js.map +1 -0
  98. package/build/licenseTrustless.d.ts +43 -0
  99. package/build/licenseTrustless.d.ts.map +1 -0
  100. package/build/licenseTrustless.js +180 -0
  101. package/build/licenseTrustless.js.map +1 -0
  102. package/build/manifestVerify.d.ts +29 -1
  103. package/build/manifestVerify.d.ts.map +1 -0
  104. package/build/manifestVerify.js +46 -4
  105. package/build/manifestVerify.js.map +1 -0
  106. package/build/minaPriceHistory.d.ts +9 -0
  107. package/build/minaPriceHistory.d.ts.map +1 -0
  108. package/build/minaPriceHistory.js +152 -0
  109. package/build/minaPriceHistory.js.map +1 -0
  110. package/build/onChainRoot.d.ts +60 -0
  111. package/build/onChainRoot.d.ts.map +1 -0
  112. package/build/onChainRoot.js +74 -0
  113. package/build/onChainRoot.js.map +1 -0
  114. package/build/ownershipLicenseHash.d.ts +25 -0
  115. package/build/ownershipLicenseHash.d.ts.map +1 -0
  116. package/build/ownershipLicenseHash.js +29 -0
  117. package/build/ownershipLicenseHash.js.map +1 -0
  118. package/build/ownershipSignature.d.ts +153 -0
  119. package/build/ownershipSignature.d.ts.map +1 -0
  120. package/build/ownershipSignature.js +297 -0
  121. package/build/ownershipSignature.js.map +1 -0
  122. package/build/permitCheckFlow.d.ts +155 -0
  123. package/build/permitCheckFlow.d.ts.map +1 -0
  124. package/build/permitCheckFlow.js +196 -0
  125. package/build/permitCheckFlow.js.map +1 -0
  126. package/build/permitDescribe.d.ts +124 -0
  127. package/build/permitDescribe.d.ts.map +1 -0
  128. package/build/permitDescribe.js +324 -0
  129. package/build/permitDescribe.js.map +1 -0
  130. package/build/permitInterface.d.ts +85 -0
  131. package/build/permitInterface.d.ts.map +1 -0
  132. package/build/permitInterface.js +121 -0
  133. package/build/permitInterface.js.map +1 -0
  134. package/build/permitMessages.d.ts +313 -0
  135. package/build/permitMessages.d.ts.map +1 -0
  136. package/build/permitMessages.js +462 -0
  137. package/build/permitMessages.js.map +1 -0
  138. package/build/permitProof.d.ts +108 -0
  139. package/build/permitProof.d.ts.map +1 -0
  140. package/build/permitProof.js +202 -0
  141. package/build/permitProof.js.map +1 -0
  142. package/build/permitRegistryRebuild.d.ts +166 -0
  143. package/build/permitRegistryRebuild.d.ts.map +1 -0
  144. package/build/permitRegistryRebuild.js +347 -0
  145. package/build/permitRegistryRebuild.js.map +1 -0
  146. package/build/permitTree.d.ts +88 -0
  147. package/build/permitTree.d.ts.map +1 -0
  148. package/build/permitTree.js +230 -0
  149. package/build/permitTree.js.map +1 -0
  150. package/build/permitsClient.d.ts +680 -0
  151. package/build/permitsClient.d.ts.map +1 -0
  152. package/build/permitsClient.js +597 -0
  153. package/build/permitsClient.js.map +1 -0
  154. package/build/proveErrors.d.ts +50 -0
  155. package/build/proveErrors.d.ts.map +1 -0
  156. package/build/proveErrors.js +76 -0
  157. package/build/proveErrors.js.map +1 -0
  158. package/build/receipt.d.ts +95 -0
  159. package/build/receipt.d.ts.map +1 -0
  160. package/build/receipt.js +84 -0
  161. package/build/receipt.js.map +1 -0
  162. package/build/refundClient.d.ts +7 -12
  163. package/build/refundClient.d.ts.map +1 -0
  164. package/build/refundClient.js +52 -21
  165. package/build/refundClient.js.map +1 -0
  166. package/build/registryTrustVerify.d.ts +78 -0
  167. package/build/registryTrustVerify.d.ts.map +1 -0
  168. package/build/registryTrustVerify.js +129 -0
  169. package/build/registryTrustVerify.js.map +1 -0
  170. package/build/releaseClient.d.ts +26 -0
  171. package/build/releaseClient.d.ts.map +1 -0
  172. package/build/releaseClient.js +65 -0
  173. package/build/releaseClient.js.map +1 -0
  174. package/build/renewClient.d.ts +28 -2
  175. package/build/renewClient.d.ts.map +1 -0
  176. package/build/renewClient.js +31 -27
  177. package/build/renewClient.js.map +1 -0
  178. package/build/seatName.d.ts +8 -0
  179. package/build/seatName.d.ts.map +1 -0
  180. package/build/seatName.js +136 -0
  181. package/build/seatName.js.map +1 -0
  182. package/build/slotConstants.d.ts +15 -0
  183. package/build/slotConstants.d.ts.map +1 -0
  184. package/build/slotConstants.js +17 -0
  185. package/build/slotConstants.js.map +1 -0
  186. package/build/statsClient.d.ts +61 -7
  187. package/build/statsClient.d.ts.map +1 -0
  188. package/build/statsClient.js +44 -5
  189. package/build/statsClient.js.map +1 -0
  190. package/build/successorChain.d.ts +35 -0
  191. package/build/successorChain.d.ts.map +1 -0
  192. package/build/successorChain.js +69 -0
  193. package/build/successorChain.js.map +1 -0
  194. package/build/taxId.d.ts +44 -0
  195. package/build/taxId.d.ts.map +1 -0
  196. package/build/taxId.js +212 -0
  197. package/build/taxId.js.map +1 -0
  198. package/build/trustAnchorVerify.d.ts +49 -0
  199. package/build/trustAnchorVerify.d.ts.map +1 -0
  200. package/build/trustAnchorVerify.js +432 -0
  201. package/build/trustAnchorVerify.js.map +1 -0
  202. package/build/trustAnchorVerifyCli.d.ts +45 -0
  203. package/build/trustAnchorVerifyCli.d.ts.map +1 -0
  204. package/build/trustAnchorVerifyCli.js +235 -0
  205. package/build/trustAnchorVerifyCli.js.map +1 -0
  206. package/build/txBroadcastClient.d.ts +26 -0
  207. package/build/txBroadcastClient.d.ts.map +1 -0
  208. package/build/txBroadcastClient.js +20 -0
  209. package/build/txBroadcastClient.js.map +1 -0
  210. package/build/unbindClient.d.ts +77 -0
  211. package/build/unbindClient.d.ts.map +1 -0
  212. package/build/unbindClient.js +169 -0
  213. package/build/unbindClient.js.map +1 -0
  214. package/build/units.d.ts +28 -0
  215. package/build/units.d.ts.map +1 -0
  216. package/build/units.js +65 -0
  217. package/build/units.js.map +1 -0
  218. package/build/vatRates.d.ts +54 -0
  219. package/build/vatRates.d.ts.map +1 -0
  220. package/build/vatRates.js +82 -0
  221. package/build/vatRates.js.map +1 -0
  222. package/build/vatRatesData.d.ts +5 -0
  223. package/build/vatRatesData.d.ts.map +1 -0
  224. package/build/vatRatesData.js +42 -0
  225. package/build/vatRatesData.js.map +1 -0
  226. package/build/vendorAccountClient.d.ts +66 -0
  227. package/build/vendorAccountClient.d.ts.map +1 -0
  228. package/build/vendorAccountClient.js +47 -0
  229. package/build/vendorAccountClient.js.map +1 -0
  230. package/build/verifyCore.d.ts +4 -1
  231. package/build/verifyCore.d.ts.map +1 -0
  232. package/build/verifyCore.js +21 -10
  233. package/build/verifyCore.js.map +1 -0
  234. package/build/verifyOffline.d.ts +85 -0
  235. package/build/verifyOffline.d.ts.map +1 -0
  236. package/build/verifyOffline.js +139 -0
  237. package/build/verifyOffline.js.map +1 -0
  238. package/build/verifyService.d.ts.map +1 -0
  239. package/build/verifyService.js +571 -501
  240. package/build/verifyService.js.map +1 -0
  241. package/build/verifyWithAncestors.d.ts +19 -0
  242. package/build/verifyWithAncestors.d.ts.map +1 -0
  243. package/build/verifyWithAncestors.js +127 -0
  244. package/build/verifyWithAncestors.js.map +1 -0
  245. package/build/zipToState.d.ts +2 -0
  246. package/build/zipToState.d.ts.map +1 -0
  247. package/build/zipToState.js +94 -0
  248. package/build/zipToState.js.map +1 -0
  249. package/package.json +141 -16
  250. package/src/agent.ts +682 -0
  251. package/src/agentActions.ts +637 -0
  252. package/src/agentRecord.ts +121 -0
  253. package/src/agentVendor.ts +356 -0
  254. package/src/appsLookup.ts +48 -0
  255. package/src/archiveBootstrap.ts +386 -0
  256. package/src/atomicJson.ts +53 -0
  257. package/src/bindClient.ts +297 -0
  258. package/src/buyClient.ts +344 -0
  259. package/src/chainHead.ts +106 -0
  260. package/src/compactMerkleMap.ts +222 -0
  261. package/src/contractInterface.ts +465 -0
  262. package/src/contractTypes.ts +31 -0
  263. package/src/countryStats.ts +200 -0
  264. package/src/deployClient.ts +517 -0
  265. package/src/deviceIdentity.ts +249 -0
  266. package/src/freezeClient.ts +162 -0
  267. package/src/generationClient.ts +145 -0
  268. package/src/holderSecret.ts +91 -0
  269. package/src/index.ts +362 -0
  270. package/src/keysClient.ts +135 -0
  271. package/src/licenseLeaf.ts +221 -0
  272. package/src/licenseRecord.ts +190 -0
  273. package/src/licenseStore.ts +767 -0
  274. package/src/licenseTrustless.ts +207 -0
  275. package/src/manifestVerify.ts +164 -0
  276. package/src/minaPriceHistory.ts +166 -0
  277. package/src/onChainRoot.ts +90 -0
  278. package/src/ownershipLicenseHash.ts +31 -0
  279. package/src/ownershipSignature.ts +421 -0
  280. package/src/permitCheckFlow.ts +227 -0
  281. package/src/permitDescribe.ts +362 -0
  282. package/src/permitInterface.ts +146 -0
  283. package/src/permitMessages.ts +572 -0
  284. package/src/permitProof.ts +230 -0
  285. package/src/permitRegistryRebuild.ts +423 -0
  286. package/src/permitTree.ts +232 -0
  287. package/src/permitsClient.ts +746 -0
  288. package/src/proveErrors.ts +98 -0
  289. package/src/receipt.ts +156 -0
  290. package/src/refundClient.ts +177 -0
  291. package/src/registryTrustVerify.ts +192 -0
  292. package/src/releaseClient.ts +101 -0
  293. package/src/renewClient.ts +234 -0
  294. package/src/seatName.ts +165 -0
  295. package/src/slotConstants.ts +18 -0
  296. package/src/statsClient.ts +249 -0
  297. package/src/successorChain.ts +87 -0
  298. package/src/taxId.ts +227 -0
  299. package/src/trustAnchorVerify.ts +550 -0
  300. package/src/trustAnchorVerifyCli.ts +234 -0
  301. package/src/txBroadcastClient.ts +48 -0
  302. package/src/unbindClient.ts +233 -0
  303. package/src/units.ts +74 -0
  304. package/src/vatRates.ts +100 -0
  305. package/src/vatRatesData.ts +43 -0
  306. package/src/vendorAccountClient.ts +120 -0
  307. package/src/verifyCore.ts +100 -0
  308. package/src/verifyOffline.ts +212 -0
  309. package/src/verifyService.ts +982 -0
  310. package/src/verifyWithAncestors.ts +163 -0
  311. package/src/zipToState.ts +94 -0
  312. package/build/licenseProof.d.ts +0 -26
  313. package/build/licenseProof.js +0 -41
  314. package/build/migrateClient.d.ts +0 -43
  315. package/build/migrateClient.js +0 -47
  316. package/build/ownership.d.ts +0 -34
  317. package/build/ownership.js +0 -147
@@ -0,0 +1,155 @@
1
+ import { type PermitRecord } from './permitRegistryRebuild.js';
2
+ import { type TreeCache } from './permitTree.js';
3
+ import type { PermitMessageDescription } from './permitDescribe.js';
4
+ export type Network = 'devnet' | 'mainnet';
5
+ export type CheckView = {
6
+ id: string;
7
+ network: Network;
8
+ registry: string;
9
+ requiredScope: string;
10
+ label: string;
11
+ nonce: string;
12
+ createdAt: string;
13
+ expiresAt: string;
14
+ status: 'waiting' | 'proved' | 'expired';
15
+ event?: {
16
+ id: string;
17
+ label: string;
18
+ expiresAt: string;
19
+ };
20
+ };
21
+ export type CheckEventView = {
22
+ id: string;
23
+ network: Network;
24
+ registry: string;
25
+ requiredScope: string;
26
+ label: string;
27
+ createdAt: string;
28
+ expiresAt: string;
29
+ };
30
+ /**
31
+ * The holder's permit file (from the apply page): no secret in it. `registry`
32
+ * is where it was issued; `lineage`, that registry's first generation's
33
+ * address (what its secret is derived against; `registry` when absent).
34
+ */
35
+ export type PermitFileRef = {
36
+ registry: string;
37
+ subject: string;
38
+ holderKey: string;
39
+ network?: string;
40
+ lineage?: string;
41
+ };
42
+ export declare class CheckError extends Error {
43
+ readonly code: string;
44
+ readonly status: number;
45
+ constructor(message: string, code: string, status?: number);
46
+ }
47
+ /** The keeper's check relay. */
48
+ export declare function createCheckRelay(keeperUrl: string, fetcher?: typeof fetch): {
49
+ /** A single check: its own nonce, so its nullifier never repeats. */
50
+ openCheck: (a: {
51
+ registry: string;
52
+ network?: Network;
53
+ requiredScope?: string;
54
+ label?: string;
55
+ }) => Promise<CheckView>;
56
+ /** A check in an event (the event's nonce), opened with the event key. */
57
+ openEventCheck: (eventId: string, eventKey: string) => Promise<CheckView>;
58
+ getCheck: (id: string) => Promise<{
59
+ check: CheckView;
60
+ proof?: unknown;
61
+ provedAt?: string;
62
+ }>;
63
+ submitProof: (id: string, proof: unknown) => Promise<{
64
+ ok: true;
65
+ }>;
66
+ createEvent: (a: {
67
+ registry: string;
68
+ network?: Network;
69
+ requiredScope?: string;
70
+ label: string;
71
+ days?: number;
72
+ }) => Promise<{
73
+ event: CheckEventView;
74
+ eventKey: string;
75
+ }>;
76
+ getEvent: (id: string) => Promise<CheckEventView>;
77
+ /** Records a verified nullifier at the event: first use there, or when it was first seen. */
78
+ markSeen: (eventId: string, eventKey: string, nullifier: string) => Promise<{
79
+ firstUse: boolean;
80
+ firstSeenAt: string;
81
+ count: number;
82
+ }>;
83
+ seenCount: (eventId: string, eventKey: string) => Promise<number>;
84
+ /** The registry's compact tree (zklicensing/permits/tree), or with `since` the changes since that root. */
85
+ getTree: (registry: string, since?: string) => Promise<any>;
86
+ getRoots: (registry: string) => Promise<{
87
+ roots: Array<{
88
+ root: string;
89
+ slot: number;
90
+ }>;
91
+ current: string;
92
+ slot: number;
93
+ }>;
94
+ };
95
+ /** The Merkle witness for `subject`, built locally from all of a registry's permits. */
96
+ export declare function witnessFromPermits(permits: PermitRecord[], subject: string): {
97
+ root: string;
98
+ witness: {
99
+ isLefts: boolean[];
100
+ siblings: string[];
101
+ };
102
+ };
103
+ export type ProveStep = 'check' | 'registry' | 'sign-secret' | 'sign-proof' | 'compile-prove' | 'send';
104
+ /**
105
+ * Holder: proves to a check that this wallet holds an active permit covering
106
+ * the check's activities, and sends the proof. `origin` is the site the
107
+ * holder is on (the check's verifier). Two wallet signatures: one re-derives
108
+ * the permit's secret, one authorises the proof.
109
+ */
110
+ export declare function proveForCheck(opts: {
111
+ keeperUrl: string;
112
+ network: Network;
113
+ checkId: string;
114
+ permit: PermitFileRef;
115
+ wallet: {
116
+ address: string;
117
+ signFields(fields: string[]): Promise<string>;
118
+ signMessage(message: string): Promise<{
119
+ field: string;
120
+ scalar: string;
121
+ }>;
122
+ };
123
+ origin: string;
124
+ graphqlUrl?: string;
125
+ fetcher?: typeof fetch;
126
+ /** Where to keep registry copies between checks (IndexedDB in a browser); without one, each check downloads the registry. */
127
+ treeCache?: TreeCache;
128
+ onStep?: (step: ProveStep) => void;
129
+ /** Shown before the proof's field signature (as PermitsClientOptions.confirmSignature); false cancels. */
130
+ confirmSignature?: (d: PermitMessageDescription) => Promise<boolean | void> | boolean | void;
131
+ }): Promise<{
132
+ nullifier: string;
133
+ }>;
134
+ /**
135
+ * Checker: verifies the proof sent to a check, in this process. Roots from
136
+ * the keeper's recent roots, or with `trustless` only the registry's current
137
+ * root read from a Mina node. `origin` is the site the check was opened on.
138
+ */
139
+ export declare function verifyCheck(opts: {
140
+ keeperUrl: string;
141
+ network: Network;
142
+ checkId: string;
143
+ origin: string;
144
+ trustless?: boolean;
145
+ maxSlotSkew?: number;
146
+ graphqlUrl?: string;
147
+ fetcher?: typeof fetch;
148
+ }): Promise<{
149
+ status: CheckView['status'];
150
+ check: CheckView;
151
+ valid: boolean;
152
+ nullifier: string | null;
153
+ reason: string | null;
154
+ }>;
155
+ //# sourceMappingURL=permitCheckFlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permitCheckFlow.d.ts","sourceRoot":"","sources":["../src/permitCheckFlow.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IACpG,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,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
+ *
6
+ * Anonymous permit checks through the keeper's relay (verify.html's
7
+ * Anonymous mode and prove.html use this; so can any checker or holder app).
8
+ *
9
+ * checker: openCheck (or createCheckEvent + openCheck in it) → show the
10
+ * check's link → verifyCheck once the holder has proved
11
+ * holder: proveForCheck(checkId, permit file, wallet)
12
+ *
13
+ * The challenge is bound to the site both sides are on: context =
14
+ * verifierContext(origin, check nonce). The holder builds its Merkle witness
15
+ * from a compact copy of the whole registry (zklicensing/permits/tree), so
16
+ * the keeper never learns which permit is being proved; the proof itself
17
+ * reveals nothing about it. The checker verifies the proof itself, against roots from the keeper or, with
18
+ * `trustless`, from a Mina node.
19
+ */
20
+ import { Field, MerkleMap, PublicKey } from 'o1js';
21
+ import { permitLeafHash } from './permitMessages.js';
22
+ import { recordToLeaf, permitStatusAt } from './permitRegistryRebuild.js';
23
+ import { syncRegistryTree, witnessFromCompactTree } from './permitTree.js';
24
+ export class CheckError extends Error {
25
+ code;
26
+ status;
27
+ constructor(message, code, status = 0) {
28
+ super(message);
29
+ this.code = code;
30
+ this.status = status;
31
+ this.name = 'CheckError';
32
+ }
33
+ }
34
+ /** The keeper's check relay. */
35
+ export function createCheckRelay(keeperUrl, fetcher = fetch) {
36
+ const base = keeperUrl.replace(/\/+$/, '');
37
+ async function call(method, path, body, headers = {}) {
38
+ const r = await fetcher(base + path, {
39
+ method, cache: 'no-store',
40
+ headers: { Accept: 'application/json', ...(body === undefined ? {} : { 'Content-Type': 'application/json' }), ...headers },
41
+ body: body === undefined ? undefined : JSON.stringify(body),
42
+ });
43
+ const j = await r.json().catch(() => null);
44
+ if (!r.ok)
45
+ throw new CheckError(j?.error ?? `HTTP ${r.status}`, j?.code ?? 'HTTP_ERROR', r.status);
46
+ return j;
47
+ }
48
+ return {
49
+ /** A single check: its own nonce, so its nullifier never repeats. */
50
+ openCheck: (a) => call('POST', '/permits/checks', a).then(r => r.check),
51
+ /** A check in an event (the event's nonce), opened with the event key. */
52
+ openEventCheck: (eventId, eventKey) => call('POST', '/permits/checks', { eventId }, { 'X-Event-Key': eventKey }).then(r => r.check),
53
+ getCheck: (id) => call('GET', `/permits/checks/${encodeURIComponent(id)}`),
54
+ submitProof: (id, proof) => call('POST', `/permits/checks/${encodeURIComponent(id)}/proof`, { proof }),
55
+ createEvent: (a) => call('POST', '/permits/check-events', a),
56
+ getEvent: (id) => call('GET', `/permits/check-events/${encodeURIComponent(id)}`).then(r => r.event),
57
+ /** Records a verified nullifier at the event: first use there, or when it was first seen. */
58
+ markSeen: (eventId, eventKey, nullifier) => call('POST', `/permits/check-events/${encodeURIComponent(eventId)}/seen`, { nullifier }, { 'X-Event-Key': eventKey }),
59
+ seenCount: (eventId, eventKey) => call('GET', `/permits/check-events/${encodeURIComponent(eventId)}/seen`, undefined, { 'X-Event-Key': eventKey }).then(r => r.count),
60
+ /** The registry's compact tree (zklicensing/permits/tree), or with `since` the changes since that root. */
61
+ getTree: (registry, since) => call('GET', `/permits/registries/${encodeURIComponent(registry)}/tree${since ? `?since=${encodeURIComponent(since)}` : ''}`),
62
+ getRoots: (registry) => call('GET', `/permits/registries/${encodeURIComponent(registry)}/roots`),
63
+ };
64
+ }
65
+ /** The Merkle witness for `subject`, built locally from all of a registry's permits. */
66
+ export function witnessFromPermits(permits, subject) {
67
+ const map = new MerkleMap();
68
+ for (const p of permits)
69
+ map.set(Field(p.subject), permitLeafHash(recordToLeaf(p)));
70
+ const w = map.getWitness(Field(subject));
71
+ return { root: map.getRoot().toString(), witness: { isLefts: w.isLefts.map(b => b.toBoolean()), siblings: w.siblings.map(s => s.toString()) } };
72
+ }
73
+ /**
74
+ * Holder: proves to a check that this wallet holds an active permit covering
75
+ * the check's activities, and sends the proof. `origin` is the site the
76
+ * holder is on (the check's verifier). Two wallet signatures: one re-derives
77
+ * the permit's secret, one authorises the proof.
78
+ */
79
+ export async function proveForCheck(opts) {
80
+ const step = opts.onStep ?? (() => { });
81
+ const relay = createCheckRelay(opts.keeperUrl, opts.fetcher);
82
+ step('check');
83
+ const { check } = await relay.getCheck(opts.checkId);
84
+ if (check.status !== 'waiting')
85
+ throw new CheckError(check.status === 'proved' ? 'This check already has a proof.' : 'This check has expired; ask for a new one.', 'CHECK_CLOSED');
86
+ if (check.network !== opts.network)
87
+ throw new CheckError(`This check is on ${check.network}.`, 'WRONG_NETWORK');
88
+ const p = opts.permit;
89
+ if (p.network && p.network !== opts.network)
90
+ throw new CheckError(`Your permit is on ${p.network}; this check is on ${opts.network}.`, 'WRONG_NETWORK');
91
+ if (opts.wallet.address !== p.holderKey)
92
+ throw new CheckError(`Connect the permit's holder key ${p.holderKey}.`, 'WRONG_KEY');
93
+ if (p.registry !== check.registry) {
94
+ // Issued by an earlier generation: fine when, on chain, its successors lead to the registry checked.
95
+ const [{ currentOnChain, PERMIT_LINEAGE }, { CANONICAL_PERMIT_VK_HASHES }, { DEFAULT_MINA_GRAPHQL_URLS }] = await Promise.all([
96
+ import('./successorChain.js'), import('./permitInterface.js'), import('./onChainRoot.js'),
97
+ ]);
98
+ const current = await currentOnChain({
99
+ start: p.registry, layout: PERMIT_LINEAGE, canonicalVks: Object.values(CANONICAL_PERMIT_VK_HASHES),
100
+ graphqlUrl: opts.graphqlUrl ?? DEFAULT_MINA_GRAPHQL_URLS[opts.network], fetcher: opts.fetcher,
101
+ }).then(r => r.address, () => null);
102
+ if (current !== check.registry)
103
+ throw new CheckError('Your permit is from another registry than the one this check asks for.', 'WRONG_REGISTRY');
104
+ }
105
+ step('registry');
106
+ // The whole registry (a compact copy, kept between checks), so the keeper
107
+ // can't tell which permit is proved; the root and slot from a Mina node,
108
+ // so the proof is for the chain's current state.
109
+ const { readChainHead } = await import('./chainHead.js');
110
+ const [tree, head] = await Promise.all([
111
+ syncRegistryTree({ registry: check.registry, fetchTree: since => relay.getTree(check.registry, since), cache: opts.treeCache }),
112
+ readChainHead({ address: check.registry, network: opts.network, graphqlUrl: opts.graphqlUrl, fetcher: opts.fetcher }),
113
+ ]);
114
+ if (tree.root !== head.root)
115
+ throw new CheckError('zkLicensing\'s copy of the registry is behind the blockchain; try again in a minute.', 'ROOT_BEHIND');
116
+ let found;
117
+ try {
118
+ found = witnessFromCompactTree(tree, p.subject);
119
+ }
120
+ catch (e) {
121
+ throw new CheckError(e?.message ?? String(e), /no such permit/.test(e?.message) ? 'NOT_FOUND' : 'ROOT_MISMATCH');
122
+ }
123
+ const { witness, permit: rec } = found;
124
+ const status = permitStatusAt(rec, head.slot);
125
+ if (status !== 'active')
126
+ throw new CheckError(`Your permit is ${status}.`, 'NOT_ACTIVE');
127
+ const required = BigInt(check.requiredScope);
128
+ if ((BigInt(rec.scope) & required) !== required)
129
+ throw new CheckError('Your permit doesn\'t cover the activities this check asks for.', 'SCOPE');
130
+ step('sign-secret');
131
+ // Re-derived with the wallet against the permit's lineage: nothing from the keeper.
132
+ const { findHolderSecret } = await import('./holderSecret.js');
133
+ let secret;
134
+ try {
135
+ ({ secret } = await findHolderSecret(opts.wallet, { lineage: p.lineage ?? p.registry, network: opts.network, subject: p.subject }));
136
+ }
137
+ catch (e) {
138
+ throw new CheckError(e?.message ?? String(e), 'WRONG_SECRET');
139
+ }
140
+ step('sign-proof');
141
+ const { holderProofMessage, verifierContext, proveHolder } = await import('./permitProof.js');
142
+ const context = verifierContext(opts.origin, check.nonce);
143
+ const msg = holderProofMessage(PublicKey.fromBase58(check.registry), Field(head.root), Field(context));
144
+ const fields = msg.map(f => f.toString());
145
+ if (opts.confirmSignature) {
146
+ const { fingerprint } = await import('./permitDescribe.js');
147
+ const d = {
148
+ kind: 'holderProof', title: `Prove to ${new URL(opts.origin).host} that you hold an active permit, without saying which`,
149
+ facts: [['Checker', opts.origin], ['Registry', check.registry], ['Network', opts.network], ['Check', check.label || check.id]],
150
+ network: opts.network, registry: check.registry, verified: true, fingerprint: fingerprint(fields),
151
+ };
152
+ if ((await opts.confirmSignature(d)) === false)
153
+ throw new CheckError('Cancelled', 'CANCELLED');
154
+ }
155
+ const holderSignature = await opts.wallet.signFields(fields);
156
+ step('compile-prove');
157
+ const { proof, nullifier } = await proveHolder({
158
+ registry: check.registry, root: head.root, witness, leaf: recordToLeaf(rec), holderSecret: secret,
159
+ slot: head.slot, requiredScope: required, context, holderSignature,
160
+ });
161
+ step('send');
162
+ await relay.submitProof(check.id, proof);
163
+ return { nullifier };
164
+ }
165
+ /**
166
+ * Checker: verifies the proof sent to a check, in this process. Roots from
167
+ * the keeper's recent roots, or with `trustless` only the registry's current
168
+ * root read from a Mina node. `origin` is the site the check was opened on.
169
+ */
170
+ export async function verifyCheck(opts) {
171
+ const relay = createCheckRelay(opts.keeperUrl, opts.fetcher);
172
+ const { check, proof } = await relay.getCheck(opts.checkId);
173
+ if (!proof)
174
+ return { status: check.status, check, valid: false, nullifier: null, reason: null };
175
+ let acceptedRoots;
176
+ let currentSlot;
177
+ if (opts.trustless) {
178
+ const { readChainHead } = await import('./chainHead.js');
179
+ const head = await readChainHead({ address: check.registry, network: opts.network, graphqlUrl: opts.graphqlUrl, fetcher: opts.fetcher });
180
+ acceptedRoots = [head.root];
181
+ currentSlot = head.slot;
182
+ }
183
+ else {
184
+ const r = await relay.getRoots(check.registry);
185
+ const { freshRoots } = await import('./agent.js');
186
+ acceptedRoots = freshRoots(r.roots, r.current, r.slot, opts.maxSlotSkew ?? 10);
187
+ currentSlot = r.slot;
188
+ }
189
+ const { verifyHolderProof } = await import('./permitProof.js');
190
+ const res = await verifyHolderProof(proof, {
191
+ registry: check.registry, acceptedRoots, currentSlot, maxSlotSkew: opts.maxSlotSkew,
192
+ requiredScope: BigInt(check.requiredScope), verifier: opts.origin, nonce: check.nonce,
193
+ });
194
+ return { status: 'proved', check, ...res };
195
+ }
196
+ //# sourceMappingURL=permitCheckFlow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permitCheckFlow.js","sourceRoot":"","sources":["../src/permitCheckFlow.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,oCAAoC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,KA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AAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QAClD,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QAC/E,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC;IACvB,CAAC;IACD,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC/D,MAAM,GAAG,GAAG,MAAM,iBAAiB,CAAC,KAAK,EAAE;QACzC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW;QACnF,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK;KACtF,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,GAAG,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,124 @@
1
+ import { type PermitNetwork } from './permitMessages.js';
2
+ import { type ApplicationRecord, type PermitRecord } from './permitRegistryRebuild.js';
3
+ export type PermitMessageDescription = {
4
+ kind: string;
5
+ /** One line: what signing does. */
6
+ title: string;
7
+ /** The details, as label/value pairs. */
8
+ facts: Array<[string, string]>;
9
+ network: PermitNetwork | null;
10
+ registry: string | null;
11
+ /** The details were checked to give exactly these numbers. */
12
+ verified: boolean;
13
+ /** Why not, when not verified. */
14
+ problem?: string;
15
+ /** For comparing with the wallet: "7 numbers, the last ending …123456". */
16
+ fingerprint: string;
17
+ };
18
+ export type DescribeContext = {
19
+ /** Activity names by bit (the registry's scopes). */
20
+ scopeLabel?: (bit: number) => string;
21
+ /** A date for a slot. */
22
+ slotLabel?: (slot: number) => string;
23
+ /** The registry's configuration, for a deployment request. */
24
+ registry?: {
25
+ keys: string[];
26
+ threshold: number;
27
+ payout: string;
28
+ metadataHash: string;
29
+ policy: {
30
+ gracePeriod: number;
31
+ maxTerm: number;
32
+ singleKeySuspend: boolean;
33
+ holderSigRequired: boolean;
34
+ };
35
+ /** processingFee and minProcessingFee default to DEFAULT_MIN_PROCESSING_FEE, as the keeper does for older drafts. */
36
+ fees: {
37
+ grantFee: string;
38
+ renewalFee: string;
39
+ minFee: string;
40
+ processingFee?: string;
41
+ minProcessingFee?: string;
42
+ };
43
+ /** Slots from filing an application to its decision deadline (default DEFAULT_DECISION_WINDOW). */
44
+ decisionWindow?: number;
45
+ /** A redeploy: the frozen tree this one starts with and the registry it replaces (the chain checks both). */
46
+ initialPermitsRoot?: string;
47
+ forkActivationSlot?: number;
48
+ predecessor?: string;
49
+ generation?: number;
50
+ };
51
+ };
52
+ export declare function fingerprint(fields: string[]): string;
53
+ /**
54
+ * Describes an authority request (the keeper's RequestView: kind, message
55
+ * and its details) and checks that the details give exactly `message`.
56
+ */
57
+ export declare function describeRequest(q: {
58
+ kind: string;
59
+ registry: string;
60
+ message: string[];
61
+ oldLeaf?: PermitRecord;
62
+ newLeaf?: PermitRecord;
63
+ fee?: string;
64
+ reasonCode?: string;
65
+ newFeesPacked?: string;
66
+ newAppTermsPacked?: string;
67
+ newKeys?: string[];
68
+ newThreshold?: number;
69
+ application?: ApplicationRecord;
70
+ newPayout?: string;
71
+ }, ctx?: DescribeContext): PermitMessageDescription;
72
+ /** The holder accepting a permit and its fee (acceptMessage). */
73
+ export declare function describeAccept(a: {
74
+ network: PermitNetwork;
75
+ registry: string;
76
+ newLeaf: PermitRecord;
77
+ fee: string;
78
+ fields: string[];
79
+ }, ctx?: DescribeContext): PermitMessageDescription;
80
+ /**
81
+ * The holder moving a permit to a new key (rekeyMessage): signed by the
82
+ * current key and the new one. Same terms, a new subject; the old one closes.
83
+ */
84
+ export declare function describeRekey(a: {
85
+ network: PermitNetwork;
86
+ registry: string;
87
+ leaf: PermitRecord;
88
+ newSubject: string;
89
+ newHolderKey: string;
90
+ fields: string[];
91
+ }, ctx?: DescribeContext): PermitMessageDescription;
92
+ /** The holder giving up a permit (surrenderMessage). */
93
+ export declare function describeSurrender(a: {
94
+ network: PermitNetwork;
95
+ registry: string;
96
+ leaf: PermitRecord;
97
+ fields: string[];
98
+ }, ctx?: DescribeContext): PermitMessageDescription;
99
+ /**
100
+ * The holder's application (applyMessage): the terms and the fee put in
101
+ * escrow. `application.payer` and `deadline` aren't part of what the holder
102
+ * signs (the sender pays; the contract sets the deadline).
103
+ */
104
+ export declare function describeApply(a: {
105
+ network: PermitNetwork;
106
+ registry: string;
107
+ application: ApplicationRecord;
108
+ fields: string[];
109
+ }, ctx?: DescribeContext): PermitMessageDescription;
110
+ /** The holder withdrawing an application (withdrawMessage). */
111
+ export declare function describeWithdraw(a: {
112
+ network: PermitNetwork;
113
+ registry: string;
114
+ application: ApplicationRecord;
115
+ fields: string[];
116
+ }, ctx?: DescribeContext): PermitMessageDescription;
117
+ /** What any zkPermits field message is, from the numbers alone (kind, network, registry); details need describeRequest. */
118
+ export declare function identifyPermitMessage(fields: string[]): {
119
+ kind: string | null;
120
+ network: PermitNetwork | null;
121
+ registry: string | null;
122
+ fingerprint: string;
123
+ };
124
+ //# sourceMappingURL=permitDescribe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permitDescribe.d.ts","sourceRoot":"","sources":["../src/permitDescribe.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGmI,KAAK,aAAa,EAC3J,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAqC,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1H,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC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