zklicensing 0.1.0-beta.14 → 0.1.0-beta.16

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 (222) hide show
  1. package/README.md +51 -4
  2. package/build/agent.d.ts +345 -0
  3. package/build/agent.d.ts.map +1 -0
  4. package/build/agent.js +541 -0
  5. package/build/agent.js.map +1 -0
  6. package/build/agentActions.d.ts +579 -0
  7. package/build/agentActions.d.ts.map +1 -0
  8. package/build/agentActions.js +510 -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 +157 -0
  15. package/build/agentVendor.d.ts.map +1 -0
  16. package/build/agentVendor.js +238 -0
  17. package/build/agentVendor.js.map +1 -0
  18. package/build/atomicJson.d.ts +5 -0
  19. package/build/atomicJson.d.ts.map +1 -0
  20. package/build/atomicJson.js +55 -0
  21. package/build/atomicJson.js.map +1 -0
  22. package/build/bindClient.d.ts +14 -0
  23. package/build/bindClient.d.ts.map +1 -1
  24. package/build/bindClient.js +24 -1
  25. package/build/bindClient.js.map +1 -1
  26. package/build/buyClient.d.ts +15 -0
  27. package/build/buyClient.d.ts.map +1 -1
  28. package/build/buyClient.js +27 -1
  29. package/build/buyClient.js.map +1 -1
  30. package/build/chainHead.d.ts +41 -0
  31. package/build/chainHead.d.ts.map +1 -0
  32. package/build/chainHead.js +73 -0
  33. package/build/chainHead.js.map +1 -0
  34. package/build/compactMerkleMap.d.ts +72 -0
  35. package/build/compactMerkleMap.d.ts.map +1 -0
  36. package/build/compactMerkleMap.js +224 -0
  37. package/build/compactMerkleMap.js.map +1 -0
  38. package/build/contractInterface.d.ts +1 -0
  39. package/build/contractInterface.d.ts.map +1 -1
  40. package/build/contractInterface.js +9 -1
  41. package/build/contractInterface.js.map +1 -1
  42. package/build/contractTypes.d.ts +9 -0
  43. package/build/contractTypes.d.ts.map +1 -0
  44. package/build/contractTypes.js +28 -0
  45. package/build/contractTypes.js.map +1 -0
  46. package/build/countryStats.d.ts +5 -1
  47. package/build/countryStats.d.ts.map +1 -1
  48. package/build/countryStats.js +61 -21
  49. package/build/countryStats.js.map +1 -1
  50. package/build/deployClient.d.ts +15 -1
  51. package/build/deployClient.d.ts.map +1 -1
  52. package/build/deployClient.js +12 -5
  53. package/build/deployClient.js.map +1 -1
  54. package/build/freezeClient.d.ts +23 -3
  55. package/build/freezeClient.d.ts.map +1 -1
  56. package/build/freezeClient.js +27 -3
  57. package/build/freezeClient.js.map +1 -1
  58. package/build/generationClient.js +3 -3
  59. package/build/holderSecret.d.ts +67 -0
  60. package/build/holderSecret.d.ts.map +1 -0
  61. package/build/holderSecret.js +73 -0
  62. package/build/holderSecret.js.map +1 -0
  63. package/build/index.d.ts +6 -3
  64. package/build/index.d.ts.map +1 -1
  65. package/build/index.js +16 -6
  66. package/build/index.js.map +1 -1
  67. package/build/licenseRecord.d.ts +32 -2
  68. package/build/licenseRecord.d.ts.map +1 -1
  69. package/build/licenseRecord.js +25 -0
  70. package/build/licenseRecord.js.map +1 -1
  71. package/build/licenseStore.d.ts +37 -2
  72. package/build/licenseStore.d.ts.map +1 -1
  73. package/build/licenseStore.js +109 -26
  74. package/build/licenseStore.js.map +1 -1
  75. package/build/licenseTrustless.d.ts +42 -0
  76. package/build/licenseTrustless.d.ts.map +1 -0
  77. package/build/licenseTrustless.js +173 -0
  78. package/build/licenseTrustless.js.map +1 -0
  79. package/build/onChainRoot.d.ts +3 -10
  80. package/build/onChainRoot.d.ts.map +1 -1
  81. package/build/onChainRoot.js +10 -25
  82. package/build/onChainRoot.js.map +1 -1
  83. package/build/ownershipSignature.d.ts +13 -0
  84. package/build/ownershipSignature.d.ts.map +1 -1
  85. package/build/ownershipSignature.js +18 -1
  86. package/build/ownershipSignature.js.map +1 -1
  87. package/build/permitCheckFlow.d.ts +150 -0
  88. package/build/permitCheckFlow.d.ts.map +1 -0
  89. package/build/permitCheckFlow.js +186 -0
  90. package/build/permitCheckFlow.js.map +1 -0
  91. package/build/permitDescribe.d.ts +81 -0
  92. package/build/permitDescribe.d.ts.map +1 -0
  93. package/build/permitDescribe.js +181 -0
  94. package/build/permitDescribe.js.map +1 -0
  95. package/build/permitInterface.d.ts +50 -0
  96. package/build/permitInterface.d.ts.map +1 -0
  97. package/build/permitInterface.js +78 -0
  98. package/build/permitInterface.js.map +1 -0
  99. package/build/permitMessages.d.ts +154 -0
  100. package/build/permitMessages.d.ts.map +1 -0
  101. package/build/permitMessages.js +286 -0
  102. package/build/permitMessages.js.map +1 -0
  103. package/build/permitProof.d.ts +108 -0
  104. package/build/permitProof.d.ts.map +1 -0
  105. package/build/permitProof.js +202 -0
  106. package/build/permitProof.js.map +1 -0
  107. package/build/permitRegistryRebuild.d.ts +89 -0
  108. package/build/permitRegistryRebuild.d.ts.map +1 -0
  109. package/build/permitRegistryRebuild.js +198 -0
  110. package/build/permitRegistryRebuild.js.map +1 -0
  111. package/build/permitTree.d.ts +88 -0
  112. package/build/permitTree.d.ts.map +1 -0
  113. package/build/permitTree.js +230 -0
  114. package/build/permitTree.js.map +1 -0
  115. package/build/permitsClient.d.ts +317 -0
  116. package/build/permitsClient.d.ts.map +1 -0
  117. package/build/permitsClient.js +330 -0
  118. package/build/permitsClient.js.map +1 -0
  119. package/build/receipt.d.ts +90 -0
  120. package/build/receipt.d.ts.map +1 -0
  121. package/build/receipt.js +83 -0
  122. package/build/receipt.js.map +1 -0
  123. package/build/refundClient.d.ts +3 -0
  124. package/build/refundClient.d.ts.map +1 -1
  125. package/build/refundClient.js +3 -1
  126. package/build/refundClient.js.map +1 -1
  127. package/build/registryTrustVerify.d.ts +78 -0
  128. package/build/registryTrustVerify.d.ts.map +1 -0
  129. package/build/registryTrustVerify.js +129 -0
  130. package/build/registryTrustVerify.js.map +1 -0
  131. package/build/releaseClient.d.ts +26 -0
  132. package/build/releaseClient.d.ts.map +1 -0
  133. package/build/releaseClient.js +65 -0
  134. package/build/releaseClient.js.map +1 -0
  135. package/build/renewClient.d.ts +22 -0
  136. package/build/renewClient.d.ts.map +1 -1
  137. package/build/renewClient.js +5 -19
  138. package/build/renewClient.js.map +1 -1
  139. package/build/statsClient.d.ts +8 -0
  140. package/build/statsClient.d.ts.map +1 -1
  141. package/build/statsClient.js.map +1 -1
  142. package/build/taxId.d.ts +44 -0
  143. package/build/taxId.d.ts.map +1 -0
  144. package/build/taxId.js +212 -0
  145. package/build/taxId.js.map +1 -0
  146. package/build/trustAnchorVerify.d.ts +1 -0
  147. package/build/trustAnchorVerify.d.ts.map +1 -1
  148. package/build/trustAnchorVerify.js +32 -53
  149. package/build/trustAnchorVerify.js.map +1 -1
  150. package/build/trustAnchorVerifyCli.d.ts +10 -0
  151. package/build/trustAnchorVerifyCli.d.ts.map +1 -1
  152. package/build/trustAnchorVerifyCli.js +42 -0
  153. package/build/trustAnchorVerifyCli.js.map +1 -1
  154. package/build/unbindClient.d.ts +2 -0
  155. package/build/unbindClient.d.ts.map +1 -1
  156. package/build/unbindClient.js +7 -0
  157. package/build/unbindClient.js.map +1 -1
  158. package/build/units.d.ts +28 -0
  159. package/build/units.d.ts.map +1 -0
  160. package/build/units.js +65 -0
  161. package/build/units.js.map +1 -0
  162. package/build/vatRates.d.ts +54 -0
  163. package/build/vatRates.d.ts.map +1 -0
  164. package/build/vatRates.js +82 -0
  165. package/build/vatRates.js.map +1 -0
  166. package/build/vatRatesData.d.ts +5 -0
  167. package/build/vatRatesData.d.ts.map +1 -0
  168. package/build/vatRatesData.js +42 -0
  169. package/build/vatRatesData.js.map +1 -0
  170. package/build/vendorAccountClient.d.ts +8 -2
  171. package/build/vendorAccountClient.d.ts.map +1 -1
  172. package/build/vendorAccountClient.js +6 -6
  173. package/build/vendorAccountClient.js.map +1 -1
  174. package/build/verifyService.js +13 -74
  175. package/build/verifyService.js.map +1 -1
  176. package/package.json +85 -4
  177. package/src/agent.ts +667 -0
  178. package/src/agentActions.ts +561 -0
  179. package/src/agentRecord.ts +121 -0
  180. package/src/agentVendor.ts +294 -0
  181. package/src/atomicJson.ts +53 -0
  182. package/src/bindClient.ts +43 -1
  183. package/src/buyClient.ts +31 -2
  184. package/src/chainHead.ts +96 -0
  185. package/src/compactMerkleMap.ts +222 -0
  186. package/src/contractInterface.d.ts +1 -0
  187. package/src/contractInterface.ts +10 -1
  188. package/src/contractTypes.ts +31 -0
  189. package/src/countryStats.ts +50 -21
  190. package/src/deployClient.ts +39 -6
  191. package/src/freezeClient.ts +51 -6
  192. package/src/generationClient.ts +3 -3
  193. package/src/holderSecret.ts +88 -0
  194. package/src/index.ts +24 -6
  195. package/src/licenseRecord.ts +64 -7
  196. package/src/licenseStore.ts +124 -24
  197. package/src/licenseTrustless.ts +201 -0
  198. package/src/onChainRoot.ts +10 -29
  199. package/src/ownershipSignature.ts +30 -2
  200. package/src/permitCheckFlow.ts +213 -0
  201. package/src/permitDescribe.ts +213 -0
  202. package/src/permitInterface.ts +98 -0
  203. package/src/permitMessages.ts +350 -0
  204. package/src/permitProof.ts +230 -0
  205. package/src/permitRegistryRebuild.ts +229 -0
  206. package/src/permitTree.ts +232 -0
  207. package/src/permitsClient.ts +420 -0
  208. package/src/receipt.ts +153 -0
  209. package/src/refundClient.ts +5 -2
  210. package/src/registryTrustVerify.ts +192 -0
  211. package/src/releaseClient.ts +101 -0
  212. package/src/renewClient.ts +10 -2
  213. package/src/statsClient.ts +7 -0
  214. package/src/taxId.ts +227 -0
  215. package/src/trustAnchorVerify.ts +32 -52
  216. package/src/trustAnchorVerifyCli.ts +38 -0
  217. package/src/unbindClient.ts +11 -0
  218. package/src/units.ts +74 -0
  219. package/src/vatRates.ts +100 -0
  220. package/src/vatRatesData.ts +43 -0
  221. package/src/vendorAccountClient.ts +13 -7
  222. package/src/verifyService.ts +14 -8
package/README.md CHANGED
@@ -76,7 +76,7 @@ type VerifyResult = {
76
76
  function verifyLicense(proof: ProofInput, options?: VerifyOptions): Promise<VerifyResult>;
77
77
  ```
78
78
 
79
- The refund-window decision is server-side: the verifier returns `refundWindowClosed: boolean` on its `/verify` response, computed from its own `purchaseSlot` record against the on-chain `currentSlot`. The SDK gates anchor writes on that boolean and never trusts a `purchaseSlot` supplied by the local proof file, so a user who forges their proof metadata cannot force the offline branch prematurely.
79
+ The refund-window decision is server-side: the verifier returns `refundWindowClosed: boolean` on its `/verify` response, computed from its own `purchaseSlot` record against the on-chain `currentSlot`. The SDK gates anchor writes on that boolean and never trusts a `purchaseSlot` supplied by the local license file, so a user who forges their proof metadata cannot force the offline branch prematurely.
80
80
 
81
81
  The package also re-exports the three constants the SDK uses internally:
82
82
 
@@ -229,7 +229,7 @@ Three drop-in pages, one SDK. Fork them, restyle, ship.
229
229
  - **`examples/renew.html`** — one click, one wallet prompt.
230
230
  - **`examples/refund.html`** — 14-day window, handled.
231
231
  - **`examples/bind.html`** / **`examples/unbind.html`** — device-slot writes for `deviceCap > 0` apps.
232
- - **`examples/verify.html`** — non-custodial verify: paste proof.json → witness + record from the service, root from Mina, folded locally.
232
+ - **`examples/verify.html`** — non-custodial verify: paste license file → witness + record from the service, root from Mina, folded locally.
233
233
 
234
234
  Each page is a self-contained HTML + TS pair calling one SDK subpath.
235
235
 
@@ -592,6 +592,12 @@ zklicensing-verify-trust \
592
592
 
593
593
  **Where `--pinned-key` comes from.** Read the current platform manifest pubkey(s) off the published trust-anchor page — <https://dev.zklicensing.com/trustanchor.html> lists them alongside each generation's verification-key hash. The same data is served as JSON for CI: <https://dev.zklicensing.com/trustanchor/manifest-pubkeys.json> (and VK hashes at <https://dev.zklicensing.com/trustanchor/vk-hashes.json>). Copy that base64 value into your build config and pass it as `--pinned-key`. **Do not** rely on the pubkey embedded inside the `.well-known` manifest itself — it is the signer's self-declaration and is not trusted; only the caller-pinned list is. Repeat `--pinned-key <b64>` once per key during a rotation window.
594
594
 
595
+ **Permit registries.** `--registry <address>` checks a zkPermits registry instead (`verifyRegistryTrust` in `zklicensing/permits/trust`): the on-chain verification key is a published `PermitRegistry` release (`CANONICAL_PERMIT_VK_HASHES`), initialize ran, the registry is bound to the network, and its permissions are locked (verification key, permissions, zkApp URI, delegate and timing impossible; `send` and `editState` proof-only). It also checks who the registry belongs to: the authority's https website is written into its `zkappUri` at deployment (frozen), `--origin` compares that website's host with the one you expect, and the website must serve `/.well-known/zkpermits/<address>.json` naming the registry and network (`wellKnownFile(address, network)` builds it; skip the fetch with `--no-well-known`). With `--keeper-url` it also checks that the keeper's authority keys, payout address and website match the chain.
596
+
597
+ ```sh
598
+ zklicensing-verify-trust --registry B62q… --origin https://permits.city.example --mina-network-id mainnet --keeper-url https://zklicensing.com/api/keeper
599
+ ```
600
+
595
601
  ### `zklicensing/refund` — refund flow client
596
602
 
597
603
  Same shape as buy/renew. The backend enforces the 14-day refund window and returns HTTP 409 when it has closed — the error surfaces through the thrown `Error` message, so the SDK doesn't second-guess it locally. Refunds stay open during a sales freeze (that's the whole point of freezing). Refund shares the per-app in-flight guard with buy/renew/migrate, so `proveRefund` throws `ProveQueueBusyError` on concurrent-prove collisions.
@@ -664,6 +670,14 @@ const apps = await fetchVendorApps({ keeperUrl, vendorAddress });
664
670
 
665
671
  Each helper returns `null` on non-OK response so a degraded backend doesn't tear the dashboard down.
666
672
 
673
+ ### `zklicensing/vat` — VAT rates and VAT-inclusive prices
674
+
675
+ Prices on zkLicensing include VAT. `standardVatRate(country, date)` gives the standard rate in force on a date (EU member states and the UK, with history; pinned from `ibericode/vat-rates`, MIT; regenerate with `node scripts/build-vat-rates.mjs`). `vatIncludedNano(totalNano, rate)` splits a VAT-inclusive amount exactly; `priceWithVat(totalNano, country)` gives what a buyer sees (net + VAT = total); `vatReceipt(...)` is the `vat` block for a license file. Countries outside the table give `null`. For display and vendors' own reporting — an estimate for consumer sales, not tax advice.
676
+
677
+ ### `zklicensing/tax-id` — vendor tax IDs
678
+
679
+ `checkTaxId(country, taxId)` checks a vendor's tax ID for their country, offline: EU VAT numbers (format per member state; the keeper also looks them up in VIES), UK VAT, Norwegian MVA, Swiss UID, Australian ABN, New Zealand GST, Canadian BN and Indian GSTIN (format and check digits), US EIN, Japanese and Singapore registration numbers (format). Other countries are accepted for an admin to review. Returns the normalized form, or an error and an `example`; `taxIdExample(country)` gives a form placeholder.
680
+
667
681
  ### `zklicensing/country-stats` — buyer-country breakdown
668
682
 
669
683
  Pure computation over `LicenseRecord[]`, bucketed by UTC calendar year and structured for tax reporting (one row per `year × appId × countryCode`). Used by both the backend (for `/stats.countryBreakdown`) and any downstream dashboard, so numbers can never drift between them.
@@ -730,7 +744,7 @@ import type { LicenseRecord, LicenseStatus } from 'zklicensing/record';
730
744
 
731
745
  ### `zklicensing/internal/ownershipSignature` — ownership challenge signer
732
746
 
733
- `deriveOwnershipKeypair(passphrase, zkAppAddress)` + `signBinding(privateKey, { licenseHash, deviceCommitment, slotIndex, nonce })` — the Pallas Schnorr signer used by the bind/unbind clients to authorize on-chain slot writes. Derivation is bound to the app's zkApp address, so a leaked passphrase for one app cannot bind against any other. Signatures are re-verified IN-CIRCUIT by `Signature.verify()`, so a compromised backend cannot forge a bind or unbind. Runs via `o1js` — the same primitive `licenseHash` was derived from at buy time.
747
+ `deriveOwnershipKeypair(passphrase, zkAppAddress)` + `signBinding(privateKey, { licenseHash, deviceCommitment, slotIndex, nonce, slotState, expirySlot, zkAppAddress })` — the Pallas Schnorr signer used by the bind/unbind clients to authorize on-chain slot writes. `slotState` is the target slot's current packed `(boundAt, freedAt)` (`slotStateOf(devices[slotIndex])` from `GET /license`) and `expirySlot` the license's current expiry (`fetchBindingState(...)` returns both); together they make each signature single-use, so a captured signature cannot be replayed once the slot changes — including after a refund and re-buy with the same passphrase. `proveBind` / `proveUnbind` fill it in automatically. Derivation is bound to the app's zkApp address, so a leaked passphrase for one app cannot bind against any other. Signatures are re-verified IN-CIRCUIT by `Signature.verify()`, so a compromised backend cannot forge a bind or unbind. Runs via `o1js` — the same primitive `licenseHash` was derived from at buy time.
734
748
 
735
749
  ### `zklicensing/verify-offline` — non-custodial offline verify
736
750
 
@@ -785,7 +799,7 @@ const res = verifyOffline({
785
799
  });
786
800
  ```
787
801
 
788
- A worked end-to-end example — proof.json paste box, three-way fetch, cross-check, verdict — lives at `packages/sdk/examples/verify.html` alongside the buy / renew / refund / bind / unbind pages.
802
+ A worked end-to-end example — license file paste box, three-way fetch, cross-check, verdict — lives at `packages/sdk/examples/verify.html` alongside the buy / renew / refund / bind / unbind pages.
789
803
 
790
804
  Two sourcing modes for `licensesRoot`:
791
805
 
@@ -794,10 +808,43 @@ Two sourcing modes for `licensesRoot`:
794
808
 
795
809
  Default public Mina GraphQL endpoints are wired in (`DEFAULT_MINA_GRAPHQL_URLS.mainnet` / `.devnet`); pass `graphqlUrl` to point at your own node.
796
810
 
811
+ ### `zklicensing/verify-trustless` — the same, in one call
812
+
813
+ `verifyLicenseTrustless` does the steps above for you, plus the checks a raw root read leaves out: the contract at the address must run a published LicensingApp release (its verification key is one of `CANONICAL_VK_HASHES`) and be locked (state changes only by proof, no new verification key, no new permissions), and the current slot comes from the node too. The service supplies only the leaf fields and Merkle path; they must hash to the on-chain root, so a stale or lying service can make the check fail but never pass. An absent license is proved the same way. The app's contract generations come from the platform-signed list (checked against the pinned manifest keys), current generation first, so a buyer who never migrated off a retired contract still verifies.
814
+
815
+ ```ts
816
+ import { verifyLicenseTrustless } from 'zklicensing/verify-trustless';
817
+
818
+ const r = await verifyLicenseTrustless({ keeperUrl, network: 'mainnet', zkAppAddress, licenseHash /*, graphqlUrl: your own node */ });
819
+ // { valid, expiresAt, expirySlot, inGracePeriod, remainingDays, reason, trustless: true,
820
+ // resolvedAddress, generation, slot, generations: 'verified' | 'given-address-only' }
821
+ ```
822
+
823
+ A service that is a block or two behind a fresh purchase gets one more read; after that the call throws `STATE_MISMATCH` (retryable). Whether the address is the app you think it is (the seller's website) is `verifyTrustAnchor`. The agent client's `verifyLicense({ …, trustless: true })` and the MCP `verify_license` tool use it.
824
+
797
825
  ### Verify service — on-chain state only
798
826
 
799
827
  The verify service is a stateless mirror of on-chain license state. `GET /verify?licenseHash=…&zkAppAddress=…` returns `{ valid, expirySlot, inGracePeriod, reason, currentSlot, purchaseSlot }`. No session tokens, no HMAC-signed bearer state, no challenge/response — the verifier reads the archive and reports. Device-cap enforcement lives entirely on-chain via the [Non-custodial device binding](#non-custodial-device-binding) flow: the buyer's `bind()` / `unbind()` transactions write into the `LicenseLeaf`'s slot array, and offline verification checks the local device commitment against the cached leaf. There is no server-side seat concept the verifier or keeper can revoke; the only party who can add or remove a device commitment is whoever holds the passphrase-derived ownership private key.
800
828
 
829
+ ### `zklicensing/permits/*` — zkPermits
830
+
831
+ Registries of permits run by an authority (multi-key approval), held by a holder's wallet, checkable by anyone. Working pages for each role are in [`examples/`](examples/README.md#permits).
832
+
833
+ | Subpath | What it gives you |
834
+ |---|---|
835
+ | `zklicensing/permits/client` | `createPermitsClient({ keeperUrl, network, wallet })`: reads (`listRegistries`, `getRegistry`, `getPermit`, `verifyPermit`), the holder flow (`apply`, `getApplication`, `withdrawApplication`, `acceptGrant`, `surrender`) and the authority flow (`acceptAuthorityTerms`, `createRegistry`, `signRequest`, `deployRegistry`, `approveApplication`, `requestRenewal` / `requestStatus` / `requestFees` / `requestRotation`, `executeRequest`). Writes sign in first; the sign-in text names the site and network and the session works only on that network. `acceptAuthorityTerms` takes `AuthorityDetails`: on mainnet also `registrationNumber` and `billingAddress`, and `vatId` only if the authority is VAT-registered; `authorityFeeStatement(month)` returns the platform's monthly fee statement for the wallet's registries. Also `verifyPermitTrustless` (the keeper's leaf and witness must fold to the root read from a Mina node, dated by the node's slot), `readRegistryHead` (a registry's root and the current slot from a Mina node) and `minaSignerWallet` (a `PermitWallet` from a private key, for scripts and agents). Options `confirmSignature(description)` (called before every field signature with what it does in words and a fingerprint to compare with the wallet; return `false` to cancel, error code `CANCELLED`) and `describeContext(registry)` (activity names and dates for those descriptions). The client rebuilds every message from the request's details first and refuses one that doesn't match (`SIGNATURE_INVALID`). |
836
+ | `zklicensing/receipt` | The purchase receipt (`PurchaseReceipt`): the durable confirmation the keeper issues at `confirmBuy`, `confirmRenew` and permit `acceptGrant` (each returns it as `receipt`), in the seller's name and numbered in the seller's own series; `confirmRefund` returns a credit note (`creditNote`, kind `license-refund`, negative amounts, `creditFor` naming the receipt it cancels) in the seller's credit-note series. It is a document of its own, not part of the license or permit file: offer it as a separate download, `receiptHtml(receipt or list)` (a self-contained printable page, no scripts) saved as `receiptFileName(…)` (Vendor Terms §7.1). The buyer can fetch them again from `GET /receipts` with their wallet sign-in. |
837
+ | `zklicensing/permits/describe` | Field signatures appear in wallets as bare numbers. `describeRequest(request, ctx)`, `describeAccept`, `describeSurrender` rebuild the message from its details and return `{ title, facts, verified, problem?, fingerprint }` (`fingerprint`: "7 numbers, the last ending …123456", to compare with the wallet's screen); `identifyPermitMessage(fields)` reads the kind, network and registry from any message's numbers alone. |
838
+ | `zklicensing/permits/holder-secret` | The holder secret behind anonymous proofs, without loading the proof: `deriveHolderSecret(wallet, { registry, network, index })` (one text `signMessage` over `holderSecretText(registry, network, index)`, which the wallet shows in words; `index` counts the key's permits in the registry: 0, 1, …; signatures are deterministic, so nothing needs keeping), `findHolderSecret(wallet, { registry, network, subject })` (recovers a permit's secret from the chain alone: tries 0, 1, … until the subject matches, usually the first), `saltFromHolderSecret`, and `holderSecretMatches(holderKey, subject, secret)`. Only sign that text on pages you trust: anyone holding the signature can recognise that permit's nullifiers (not prove with it). |
839
+ | `zklicensing/permits/rebuild` (also) | `RegistryView.tree` is a `CompactMerkleMap`: a MerkleMap drop-in (same roots and witnesses) that stores only the leaves and the split-children values, so `registryViewToStored` / `registryViewFromStored` save and load a registry without re-hashing (10,000 permits: 4 MB, 0.3 s to load; a rebuild from events re-hashes a 256-level path per permit, about 17 min), and `refreshRegistryView(view, events)` re-hashes only the permits that changed. |
840
+ | `zklicensing/permits/tree` | A compact copy of a registry's permits tree: every permit plus the 2(N − 1) node values where two permits' paths split, so a holder builds its Merkle witness without the keeper learning which permit and without re-hashing the 256-level tree (about 0.1 s per permit). `compactTreeFrom` (keeper side, from the full tree), `witnessFromCompactTree` (checked by folding to the root), `applyTreeDiff` (the permits changed since a root; re-hashes only above them), `syncRegistryTree({ registry, fetchTree, cache })` (cached copy brought up to date, else a full download). Measured: 10,000 permits ≈ 1.5 MB gzipped and 0.4 s on the device; 100,000 ≈ 15 MB and 3.5 s. |
841
+ | `zklicensing/permits/check` | Anonymous checks through the keeper's relay (the site's verify.html Anonymous mode and prove.html use it). `createCheckRelay(keeperUrl)`: `openCheck` (own nonce, nullifiers never repeat), `createEvent` + `openEventCheck` (one nonce per event: a permit's nullifier repeats there, so second use shows), `getCheck`, `submitProof`, `markSeen` / `seenCount` (the event's shared list, with its key), `getTree`. `proveForCheck({ checkId, permit, wallet, origin, treeCache? })` (holder: builds the witness from a compact copy of the whole registry so the keeper can't tell which permit, re-derives the secret, proves, sends) and `verifyCheck({ checkId, origin, trustless? })` (checker). `origin` is the site both sides are on: the challenge is `verifierContext(origin, nonce)`. |
842
+ | `zklicensing/permits/proof` | The holder's anonymous proof: `proveHolder` (runs on the holder's device — it needs the holder's signature over `holderProofMessage(registry, root, context)` and the holder secret, which the holder's wallet re-derives from the chain with `findHolderSecret` (`zklicensing/permits/holder-secret`); the client's `apply` derives it and sends only its hash, the salt) and `verifyHolderProof` (checks the proof, its registry, root, slot, required activities and challenge; returns the nullifier, the same for one holder and one challenge). The nullifier is `Poseidon(tag, holderSecret, context)`: subjects are public and the keeper and authority see the salt, but only the holder's wallet can produce the secret, so nobody else can match a nullifier to a permit. The challenge is bound to the verifier: `context = verifierContext(verifier, nonce)`, from the verifier's identity as the holder reaches it (a URL counts as its origin, `normalizeVerifier`) and a `randomNonce()`; verifiers pass `{ verifier, nonce }` to `verifyHolderProof`. Two verifiers that agree on one nonce still get different challenges, so they can't link a holder by comparing nullifiers. |
843
+ | `zklicensing/permits/trust` | `verifyRegistryTrust`: is an address a genuine, unmodifiable registry (a published verification key from `CANONICAL_PERMIT_VK_HASHES`, initialized, bound to the network, permissions locked), and does it belong to the website it names (`zkappUri`, options `website` and `checkWellKnown`; `wellKnownPath` / `wellKnownFile` for the authority's claim file)? Also the `--registry` mode of `zklicensing-verify-trust`. |
844
+ | `zklicensing/permits/messages` | The permit leaf, its hash and subject, packed fees and policy, and the exact field messages the authority keys and the holder sign (`toSignableFields` turns one into wallet `signFields` input). |
845
+ | `zklicensing/permits/rebuild` | `rebuildRegistry` / `applyRegistryEvents`: a registry's permits and root from its on-chain events alone, without the keeper; `permitStatusAt` for a permit's status at a slot. |
846
+ | `zklicensing/permits/interface` | Event shapes, the on-chain state layout, `CANONICAL_PERMIT_VK_HASHES` and `CANONICAL_PERMIT_PROOF_VK_HASH`. |
847
+
801
848
  ## Documentation
802
849
 
803
850
  - Integration walkthrough — [dev.zklicensing.com/docs.html](https://dev.zklicensing.com/docs.html)
@@ -0,0 +1,345 @@
1
+ export type Network = 'devnet' | 'mainnet';
2
+ export type TierName = 'monthly' | 'yearly' | 'fiveYear' | 'perpetual';
3
+ export declare const DEFAULT_KEEPER_URL = "https://zklicensing.com/api/keeper";
4
+ /**
5
+ * Platform manifest signing keys (Ed25519, base64), pinned in the package.
6
+ * Mirrors https://zklicensing.com/trustanchor/manifest-pubkeys.json.
7
+ */
8
+ export declare const PLATFORM_MANIFEST_PUBKEYS: readonly string[];
9
+ /** Protocol royalty compiled into the licensing circuit: 2% platform, 98% vendor. */
10
+ export declare const PLATFORM_SHARE_PERCENT = 2;
11
+ /** Refund window in slots (contractInterface REFUND_WINDOW_N; mirrored to keep this module o1js-free). */
12
+ export declare const REFUND_WINDOW_SLOTS = 13440;
13
+ /** Public site per network, for approval links. */
14
+ export declare const SITE_URL: Readonly<Record<Network, string>>;
15
+ export type ConsentKind = 'withdrawal-waiver' | 'vendor-terms' | 'authority-terms' | 'permit-conditions';
16
+ /**
17
+ * An action checked against the keeper and ready to carry out: by a human
18
+ * through `approvalUrl`, or by an agent with its own key
19
+ * (`zklicensing/agent/actions`).
20
+ */
21
+ export type PreparedAction = {
22
+ action: 'buy' | 'renew' | 'refund' | 'accept-permit';
23
+ network: Network;
24
+ summary: string;
25
+ /** Nanomina. `total` leaves the payer; the split is compiled into the contract. */
26
+ amounts: {
27
+ total: string;
28
+ toRecipient: string;
29
+ toPlatform: string;
30
+ recipient: string;
31
+ };
32
+ /** Consent the payer must give (a human, or an agent under standing consent). */
33
+ requiresConsent: ConsentKind[];
34
+ /** Whether the vendor lets an agent give a consumer's waiver ('human-only' → approval link). */
35
+ agentMayConsent: boolean;
36
+ /** Page where a human reviews and signs this action, when one exists. */
37
+ approvalUrl: string | null;
38
+ warnings: string[];
39
+ /** Prices and chain state can change; re-prepare after this. */
40
+ expiresAt: string;
41
+ /** Inputs the act step needs (plain JSON). */
42
+ params: Record<string, unknown>;
43
+ };
44
+ /** 98 / 2 split of a nanomina amount; rounding favours the recipient. */
45
+ export declare function splitAmount(totalNano: bigint): {
46
+ toRecipient: bigint;
47
+ toPlatform: bigint;
48
+ };
49
+ export declare const TIERS: ReadonlyArray<{
50
+ tier: TierName;
51
+ durationIndex: 0 | 1 | 2 | 3;
52
+ label: string;
53
+ }>;
54
+ /**
55
+ * Roots a holder proof may be against: the current one, and earlier ones
56
+ * only if they were replaced within the last `skew` slots — so a permit
57
+ * revoked or suspended since can't be proved against an old root.
58
+ * `roots` is oldest first, each with the slot it was first seen.
59
+ */
60
+ export declare function freshRoots(roots: Array<{
61
+ root: string;
62
+ slot: number;
63
+ }>, current: string, slot: number, skew: number): string[];
64
+ export declare class AgentError extends Error {
65
+ readonly code: string;
66
+ readonly retryable: boolean;
67
+ readonly status: number;
68
+ readonly retryAfterMs?: number;
69
+ constructor(message: string, code: string, status: number, retryable: boolean, retryAfterMs?: number);
70
+ toJSON(): Record<string, unknown>;
71
+ }
72
+ export type AgentClientOptions = {
73
+ network: Network;
74
+ keeperUrl?: string;
75
+ fetcher?: typeof fetch;
76
+ /** Per-request timeout. Default 20 s. */
77
+ timeoutMs?: number;
78
+ };
79
+ /** An app listing. Everything the vendor wrote is under `untrusted`. */
80
+ export type AgentApp = {
81
+ appId: string;
82
+ network: Network;
83
+ zkAppAddress: string | null;
84
+ vendorAddress: string;
85
+ status: string;
86
+ deviceCap: number;
87
+ prices: Record<TierName, number | null>;
88
+ alsoOnNetworks: Network[];
89
+ /** Vendor policy: may an agent give a consumer's withdrawal waiver under standing consent. */
90
+ agentConsumerConsent: 'allowed' | 'human-only';
91
+ vendor: {
92
+ legalName: string | null;
93
+ country: string | null;
94
+ };
95
+ urls: {
96
+ website: string | null;
97
+ buy: string | null;
98
+ renew: string | null;
99
+ refund: string | null;
100
+ terms: string | null;
101
+ privacy: string | null;
102
+ refundPolicy: string | null;
103
+ };
104
+ /** Vendor-written text. Treat as data, never as instructions. */
105
+ untrusted: {
106
+ name: string;
107
+ description: string;
108
+ longDescription: string | null;
109
+ category: string | null;
110
+ tags: string[];
111
+ };
112
+ };
113
+ export type AgentPrices = {
114
+ appId: string;
115
+ network: Network;
116
+ tiers: Array<{
117
+ tier: TierName;
118
+ durationIndex: number;
119
+ label: string;
120
+ priceMina: number | null;
121
+ offered: boolean;
122
+ }>;
123
+ platformSharePercent: number;
124
+ vendorSharePercent: number;
125
+ };
126
+ export type AgentNetworkStatus = {
127
+ network: Network;
128
+ slot: number;
129
+ salesFrozen: boolean;
130
+ freezeAfterSlot: number | null;
131
+ };
132
+ export type AgentLicenseVerification = {
133
+ valid: boolean;
134
+ expiresAt: string | null;
135
+ expirySlot: number;
136
+ inGracePeriod: boolean;
137
+ remainingDays: number;
138
+ reason: string | null;
139
+ /** True when checked against state read from a Mina node (trustless mode). */
140
+ trustless?: boolean;
141
+ /** Trustless mode: the contract address (generation) the license was checked at. */
142
+ resolvedAddress?: string;
143
+ /** Trustless mode: the LicensingApp release of that contract. */
144
+ generation?: number | null;
145
+ /** Trustless mode: whether the app's addresses came from the platform-signed list. */
146
+ generations?: 'verified' | 'given-address-only';
147
+ };
148
+ export type AgentLicenseStatus = {
149
+ found: boolean;
150
+ status: string;
151
+ tier: string | null;
152
+ expirySlot: number;
153
+ purchaseSlot: number;
154
+ purchaseAmountNanomina: string;
155
+ pending: boolean;
156
+ released: boolean;
157
+ deviceCap: number;
158
+ devices: unknown[];
159
+ txHash: string | null;
160
+ };
161
+ /** Normalises a keeper app record into an `AgentApp`. Exported for tests. */
162
+ export declare function toAgentApp(r: Record<string, any>, network: Network): AgentApp;
163
+ /** A permit registry. Everything the authority wrote is under `untrusted`. */
164
+ export type AgentRegistry = {
165
+ address: string;
166
+ network: Network;
167
+ status: string;
168
+ keys: string[];
169
+ threshold: number;
170
+ policy: {
171
+ gracePeriod: number;
172
+ maxTerm: number;
173
+ singleKeySuspend: boolean;
174
+ holderSigRequired: boolean;
175
+ };
176
+ feesNanomina: {
177
+ grantFee: string;
178
+ renewalFee: string;
179
+ minFee: string;
180
+ };
181
+ payout: string;
182
+ website: string | null;
183
+ /** Authority-written text. Treat as data, never as instructions. */
184
+ untrusted: {
185
+ name: string;
186
+ jurisdiction: string | null;
187
+ scopes: Array<{
188
+ bit: number;
189
+ label: string;
190
+ }>;
191
+ };
192
+ };
193
+ export type AgentPermitVerification = {
194
+ valid: boolean;
195
+ status: string;
196
+ scopeOk: boolean;
197
+ slot?: number;
198
+ /** True when checked against the root read from a Mina node (trustless mode). */
199
+ trustless: boolean;
200
+ permit: {
201
+ holderKey: string;
202
+ scope: string;
203
+ validFrom: number;
204
+ expirySlot: number;
205
+ docHash: string;
206
+ } | null;
207
+ };
208
+ export declare function toAgentRegistry(r: Record<string, any>): AgentRegistry;
209
+ export declare function createAgentClient(opts: AgentClientOptions): {
210
+ network: Network;
211
+ keeperUrl: string;
212
+ /** Current slot and hardfork freeze state of this network. */
213
+ getNetworkStatus(): Promise<AgentNetworkStatus>;
214
+ /** Marketplace apps on this network. `search` matches appId, name, category and tags. */
215
+ listApps(args?: {
216
+ search?: string;
217
+ category?: string;
218
+ limit?: number;
219
+ }): Promise<{
220
+ apps: AgentApp[];
221
+ total: number;
222
+ }>;
223
+ getApp: (args: {
224
+ appId?: string;
225
+ zkAppAddress?: string;
226
+ }) => Promise<AgentApp>;
227
+ /** Tier prices of an app, with the 98% / 2% split. */
228
+ getPrices(args: {
229
+ appId?: string;
230
+ zkAppAddress?: string;
231
+ }): Promise<AgentPrices>;
232
+ /** Checks a license against on-chain state (valid, expiry, grace). */
233
+ /**
234
+ * Is a license valid now. With `trustless: true` the license's state and
235
+ * the slot come from a Mina node and the keeper's data must fold to the
236
+ * on-chain root (zklicensing licenseTrustless; loads o1js).
237
+ */
238
+ verifyLicense(args: {
239
+ zkAppAddress: string;
240
+ licenseHash: string;
241
+ trustless?: boolean;
242
+ graphqlUrl?: string;
243
+ }): Promise<AgentLicenseVerification>;
244
+ /** The keeper's record of a license: tier, expiry, escrow and device slots. */
245
+ getLicenseStatus(args: {
246
+ zkAppAddress: string;
247
+ licenseHash: string;
248
+ }): Promise<AgentLicenseStatus>;
249
+ /** Licenses of an app or of a buyer wallet. */
250
+ listLicenses(args: {
251
+ zkAppAddress?: string;
252
+ buyer?: string;
253
+ }): Promise<{
254
+ licenses: unknown[];
255
+ }>;
256
+ /**
257
+ * Runs the trust-anchor checks for a vendor site: the signed well-known
258
+ * manifest, the verification-key hash, locked permissions and zkApp URI.
259
+ * Loads o1js on first use.
260
+ */
261
+ verifyTrustAnchor(args: {
262
+ origin: string;
263
+ zkAppAddress: string;
264
+ skipChainChecks?: boolean;
265
+ pinnedPublicKeysBase64?: readonly string[];
266
+ }): Promise<import("./trustAnchorVerify.js").TrustAnchorReport>;
267
+ /**
268
+ * Checks a license purchase and returns everything needed to carry it out.
269
+ * Refuses tiers not offered, inactive apps and frozen sales.
270
+ */
271
+ prepareBuy(args: {
272
+ appId?: string;
273
+ zkAppAddress?: string;
274
+ tier: TierName;
275
+ }): Promise<PreparedAction>;
276
+ /** Checks a renewal: the license exists, its refund window has closed, sales aren't frozen. */
277
+ prepareRenew(args: {
278
+ zkAppAddress: string;
279
+ licenseHash: string;
280
+ tier: TierName;
281
+ }): Promise<PreparedAction>;
282
+ /** Checks a refund: the license is in its 14-day window and not yet released or renewed. */
283
+ prepareRefund(args: {
284
+ zkAppAddress: string;
285
+ licenseHash: string;
286
+ }): Promise<PreparedAction>;
287
+ /** Checks an approved permit grant waiting for the holder's acceptance and payment. */
288
+ prepareGrantAcceptance(args: {
289
+ requestId: string;
290
+ }): Promise<PreparedAction>;
291
+ /** Permit registries on this network. `search` matches name, jurisdiction and scope labels. */
292
+ listRegistries(args?: {
293
+ search?: string;
294
+ }): Promise<{
295
+ registries: AgentRegistry[];
296
+ }>;
297
+ /** One registry with its on-chain fees, epoch and permit count. */
298
+ getRegistry(args: {
299
+ address: string;
300
+ }): Promise<AgentRegistry & {
301
+ chain: Record<string, unknown> | null;
302
+ }>;
303
+ /**
304
+ * Is a permit valid now, optionally for required scope bits. With
305
+ * `trustless: true` the registry root is read from a Mina node and the
306
+ * keeper's witness must match it (loads o1js).
307
+ */
308
+ verifyPermit(args: {
309
+ registry: string;
310
+ subject: string;
311
+ requiredScope?: string;
312
+ trustless?: boolean;
313
+ }): Promise<AgentPermitVerification>;
314
+ /** A permit registry signing request: its message, signatures so far against the threshold, status. */
315
+ getSigningRequest(args: {
316
+ requestId: string;
317
+ }): Promise<Record<string, unknown>>;
318
+ /**
319
+ * Checks a zero-knowledge holder proof (from `proveAccess` in
320
+ * `zklicensing/agent/actions`): someone holds an active permit in
321
+ * `registry` covering `requiredScope`, for your challenge, without
322
+ * learning which permit. The challenge is `verifier` (your identity as the
323
+ * holder reached you: your origin URL or service address) with the
324
+ * `nonce` you issued. Accepts the registry's recent roots as the keeper
325
+ * reports them. Use the nullifier to allow one use per holder per nonce.
326
+ * Loads o1js.
327
+ */
328
+ verifyHolderProof(args: {
329
+ registry: string;
330
+ proof: unknown;
331
+ verifier: string;
332
+ nonce: string;
333
+ requiredScope?: string;
334
+ maxSlotSkew?: number;
335
+ trustless?: boolean;
336
+ graphqlUrl?: string;
337
+ }): Promise<{
338
+ valid: boolean;
339
+ nullifier: string | null;
340
+ reason: string | null;
341
+ }>;
342
+ };
343
+ export type AgentClient = ReturnType<typeof createAgentClient>;
344
+ export { minaUnit, formatMina, formatNanomina, fiatReference, type MinaUnit } from './units.js';
345
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC3C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAEvE,eAAO,MAAM,kBAAkB,uCAAuC,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAEtD,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,0GAA0G;AAC1G,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C,mDAAmD;AACnD,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAGtD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEzG;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,eAAe,CAAC;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACvF,iFAAiF;IACjF,eAAe,EAAE,WAAW,EAAE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