@t3foundry/tasra-sdk 0.0.0-stage → 0.3.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +94 -0
  4. package/README.md +137 -2
  5. package/SECURITY.md +115 -0
  6. package/dist/app/approvals.d.ts +50 -0
  7. package/dist/app/approvals.js +90 -0
  8. package/dist/app/authorization.d.ts +19 -0
  9. package/dist/app/authorization.js +20 -0
  10. package/dist/app/client.d.ts +231 -0
  11. package/dist/app/client.js +272 -0
  12. package/dist/app/creation.d.ts +73 -0
  13. package/dist/app/creation.js +77 -0
  14. package/dist/app/deployment.d.ts +36 -0
  15. package/dist/app/deployment.js +18 -0
  16. package/dist/app/identity.d.ts +211 -0
  17. package/dist/app/identity.js +287 -0
  18. package/dist/app/index.d.ts +22 -0
  19. package/dist/app/index.js +12 -0
  20. package/dist/app/manifest.d.ts +74 -0
  21. package/dist/app/manifest.js +120 -0
  22. package/dist/app/node.d.ts +30 -0
  23. package/dist/app/node.js +159 -0
  24. package/dist/app/ready-slot.d.ts +157 -0
  25. package/dist/app/ready-slot.js +199 -0
  26. package/dist/app/tasra-client.d.ts +125 -0
  27. package/dist/app/tasra-client.js +79 -0
  28. package/dist/app/viem.d.ts +10 -0
  29. package/dist/app/viem.js +32 -0
  30. package/dist/app/wallet.d.ts +126 -0
  31. package/dist/app/wallet.js +137 -0
  32. package/dist/auth/dpop.d.ts +86 -0
  33. package/dist/auth/dpop.js +142 -0
  34. package/dist/auth/holderProof.d.ts +102 -0
  35. package/dist/auth/holderProof.js +161 -0
  36. package/dist/auth/identityScope.d.ts +19 -0
  37. package/dist/auth/identityScope.js +82 -0
  38. package/dist/auth/index.d.ts +11 -0
  39. package/dist/auth/index.js +13 -0
  40. package/dist/auth/oid4vp.d.ts +230 -0
  41. package/dist/auth/oid4vp.js +780 -0
  42. package/dist/auth/rego/wasm/PINS.json +11 -0
  43. package/dist/auth/rego/wasm/keykeeper_rego_wasm.d.ts +76 -0
  44. package/dist/auth/rego/wasm/keykeeper_rego_wasm.js +379 -0
  45. package/dist/auth/rego/wasm/keykeeper_rego_wasm_bg.wasm +0 -0
  46. package/dist/auth/rego.d.ts +192 -0
  47. package/dist/auth/rego.js +492 -0
  48. package/dist/auth/verifier.d.ts +166 -0
  49. package/dist/auth/verifier.js +211 -0
  50. package/dist/chain/abis/accountantSetRegistry.d.ts +441 -0
  51. package/dist/chain/abis/accountantSetRegistry.js +574 -0
  52. package/dist/chain/abis/accountantSlashing.d.ts +2071 -0
  53. package/dist/chain/abis/accountantSlashing.js +2670 -0
  54. package/dist/chain/abis/bondingCurve.d.ts +398 -0
  55. package/dist/chain/abis/bondingCurve.js +521 -0
  56. package/dist/chain/abis/equivocationSlasher.d.ts +292 -0
  57. package/dist/chain/abis/equivocationSlasher.js +379 -0
  58. package/dist/chain/abis/fixedTasraPriceOracle.d.ts +52 -0
  59. package/dist/chain/abis/fixedTasraPriceOracle.js +72 -0
  60. package/dist/chain/abis/index.d.ts +12801 -0
  61. package/dist/chain/abis/index.js +64 -0
  62. package/dist/chain/abis/keeperShareRegistry.d.ts +519 -0
  63. package/dist/chain/abis/keeperShareRegistry.js +675 -0
  64. package/dist/chain/abis/keyRegistry.d.ts +2421 -0
  65. package/dist/chain/abis/keyRegistry.js +3114 -0
  66. package/dist/chain/abis/livenessRegistry.d.ts +402 -0
  67. package/dist/chain/abis/livenessRegistry.js +524 -0
  68. package/dist/chain/abis/mockEurc.d.ts +210 -0
  69. package/dist/chain/abis/mockEurc.js +276 -0
  70. package/dist/chain/abis/nodeRegistry.d.ts +1630 -0
  71. package/dist/chain/abis/nodeRegistry.js +2113 -0
  72. package/dist/chain/abis/platformExecutor.d.ts +328 -0
  73. package/dist/chain/abis/platformExecutor.js +429 -0
  74. package/dist/chain/abis/prevrandaoSaltBeacon.d.ts +16 -0
  75. package/dist/chain/abis/prevrandaoSaltBeacon.js +24 -0
  76. package/dist/chain/abis/serviceRegistry.d.ts +556 -0
  77. package/dist/chain/abis/serviceRegistry.js +719 -0
  78. package/dist/chain/abis/settlement.d.ts +1624 -0
  79. package/dist/chain/abis/settlement.js +2096 -0
  80. package/dist/chain/abis/tasraSwapRouter.d.ts +92 -0
  81. package/dist/chain/abis/tasraSwapRouter.js +122 -0
  82. package/dist/chain/abis/tasraToken.d.ts +455 -0
  83. package/dist/chain/abis/tasraToken.js +599 -0
  84. package/dist/chain/abis/tasraVestingVault.d.ts +165 -0
  85. package/dist/chain/abis/tasraVestingVault.js +215 -0
  86. package/dist/chain/abis/thresholdRandomBeacon.d.ts +378 -0
  87. package/dist/chain/abis/thresholdRandomBeacon.js +494 -0
  88. package/dist/chain/abis/treasury.d.ts +301 -0
  89. package/dist/chain/abis/treasury.js +390 -0
  90. package/dist/chain/abis/verifierSetRegistry.d.ts +445 -0
  91. package/dist/chain/abis/verifierSetRegistry.js +579 -0
  92. package/dist/chain/client.d.ts +212 -0
  93. package/dist/chain/client.js +576 -0
  94. package/dist/chain/commitmentRecovery.d.ts +21 -0
  95. package/dist/chain/commitmentRecovery.js +44 -0
  96. package/dist/chain/committeeClient.d.ts +102 -0
  97. package/dist/chain/committeeClient.js +137 -0
  98. package/dist/chain/deployments.d.ts +56 -0
  99. package/dist/chain/deployments.js +269 -0
  100. package/dist/chain/discovery.d.ts +49 -0
  101. package/dist/chain/discovery.js +107 -0
  102. package/dist/chain/events.d.ts +58 -0
  103. package/dist/chain/events.js +125 -0
  104. package/dist/chain/format.d.ts +25 -0
  105. package/dist/chain/format.js +51 -0
  106. package/dist/chain/index.d.ts +41 -0
  107. package/dist/chain/index.js +56 -0
  108. package/dist/chain/manifest.d.ts +165 -0
  109. package/dist/chain/manifest.js +132 -0
  110. package/dist/chain/network-profiles.json +75 -0
  111. package/dist/chain/networks.d.ts +73 -0
  112. package/dist/chain/networks.js +62 -0
  113. package/dist/chain/node.d.ts +44 -0
  114. package/dist/chain/node.js +176 -0
  115. package/dist/chain/offchain.d.ts +149 -0
  116. package/dist/chain/offchain.js +73 -0
  117. package/dist/chain/provisionRule.d.ts +164 -0
  118. package/dist/chain/provisionRule.js +212 -0
  119. package/dist/chain/registeredAgent.d.ts +64 -0
  120. package/dist/chain/registeredAgent.js +140 -0
  121. package/dist/chain/registeredOperation.d.ts +49 -0
  122. package/dist/chain/registeredOperation.js +136 -0
  123. package/dist/chain/registeredRelay.d.ts +206 -0
  124. package/dist/chain/registeredRelay.js +312 -0
  125. package/dist/chain/revertReason.d.ts +14 -0
  126. package/dist/chain/revertReason.js +62 -0
  127. package/dist/chain/ruleAmendment.d.ts +80 -0
  128. package/dist/chain/ruleAmendment.js +195 -0
  129. package/dist/chain/ruleAmendmentCore.d.ts +129 -0
  130. package/dist/chain/ruleAmendmentCore.js +152 -0
  131. package/dist/chain/ruleInput.d.ts +10 -0
  132. package/dist/chain/ruleInput.js +13 -0
  133. package/dist/chain/serviceIdentity.d.ts +176 -0
  134. package/dist/chain/serviceIdentity.js +237 -0
  135. package/dist/chain/serviceProfiles.d.ts +39 -0
  136. package/dist/chain/serviceProfiles.js +74 -0
  137. package/dist/chain/services.d.ts +141 -0
  138. package/dist/chain/services.js +79 -0
  139. package/dist/chain/slotClient.d.ts +55 -0
  140. package/dist/chain/slotClient.js +62 -0
  141. package/dist/chain/slotSeed.d.ts +31 -0
  142. package/dist/chain/slotSeed.js +98 -0
  143. package/dist/chain/write.d.ts +431 -0
  144. package/dist/chain/write.js +958 -0
  145. package/dist/client/client.d.ts +112 -0
  146. package/dist/client/client.js +111 -0
  147. package/dist/client/index.d.ts +3 -0
  148. package/dist/client/index.js +2 -0
  149. package/dist/client/session.d.ts +67 -0
  150. package/dist/client/session.js +238 -0
  151. package/dist/committee/client.d.ts +284 -0
  152. package/dist/committee/client.js +351 -0
  153. package/dist/committee/dual-sign.d.ts +110 -0
  154. package/dist/committee/dual-sign.js +202 -0
  155. package/dist/committee/ecdsa.d.ts +36 -0
  156. package/dist/committee/ecdsa.js +45 -0
  157. package/dist/committee/extraction.d.ts +82 -0
  158. package/dist/committee/extraction.js +96 -0
  159. package/dist/committee/index.d.ts +19 -0
  160. package/dist/committee/index.js +13 -0
  161. package/dist/committee/oauth.d.ts +51 -0
  162. package/dist/committee/oauth.js +90 -0
  163. package/dist/committee/receipts.d.ts +51 -0
  164. package/dist/committee/receipts.js +59 -0
  165. package/dist/committee/request.d.ts +264 -0
  166. package/dist/committee/request.js +305 -0
  167. package/dist/committee/token.d.ts +274 -0
  168. package/dist/committee/token.js +418 -0
  169. package/dist/crypto/constants.d.ts +10 -0
  170. package/dist/crypto/constants.js +32 -0
  171. package/dist/crypto/detect.d.ts +20 -0
  172. package/dist/crypto/detect.js +44 -0
  173. package/dist/crypto/envelope.d.ts +60 -0
  174. package/dist/crypto/envelope.js +243 -0
  175. package/dist/crypto/frost.d.ts +49 -0
  176. package/dist/crypto/frost.js +152 -0
  177. package/dist/crypto/hex.d.ts +7 -0
  178. package/dist/crypto/hex.js +24 -0
  179. package/dist/crypto/ibe-blob.d.ts +114 -0
  180. package/dist/crypto/ibe-blob.js +208 -0
  181. package/dist/crypto/ibe.d.ts +88 -0
  182. package/dist/crypto/ibe.js +262 -0
  183. package/dist/crypto/index.d.ts +12 -0
  184. package/dist/crypto/index.js +12 -0
  185. package/dist/crypto/kem.d.ts +55 -0
  186. package/dist/crypto/kem.js +241 -0
  187. package/dist/decryption/client.d.ts +64 -0
  188. package/dist/decryption/client.js +82 -0
  189. package/dist/decryption/index.d.ts +2 -0
  190. package/dist/decryption/index.js +2 -0
  191. package/dist/errors.d.ts +124 -0
  192. package/dist/errors.js +167 -0
  193. package/dist/index.d.ts +43 -0
  194. package/dist/index.js +98 -0
  195. package/dist/keys/index.d.ts +1 -0
  196. package/dist/keys/index.js +4 -0
  197. package/dist/keys/node-client.d.ts +27 -0
  198. package/dist/keys/node-client.js +97 -0
  199. package/dist/oid4vp/binding.d.ts +76 -0
  200. package/dist/oid4vp/binding.js +118 -0
  201. package/dist/oid4vp/did-web.d.ts +49 -0
  202. package/dist/oid4vp/did-web.js +57 -0
  203. package/dist/oid4vp/index.d.ts +9 -0
  204. package/dist/oid4vp/index.js +10 -0
  205. package/dist/oid4vp/jose.d.ts +166 -0
  206. package/dist/oid4vp/jose.js +242 -0
  207. package/dist/oid4vp/jwe.d.ts +30 -0
  208. package/dist/oid4vp/jwe.js +93 -0
  209. package/dist/oid4vp/oid4vci.d.ts +84 -0
  210. package/dist/oid4vp/oid4vci.js +85 -0
  211. package/dist/oid4vp/request-object.d.ts +109 -0
  212. package/dist/oid4vp/request-object.js +96 -0
  213. package/dist/oid4vp/sd-jwt.d.ts +177 -0
  214. package/dist/oid4vp/sd-jwt.js +208 -0
  215. package/dist/oid4vp/verifier-agent.d.ts +161 -0
  216. package/dist/oid4vp/verifier-agent.js +132 -0
  217. package/dist/oid4vp/wallet.d.ts +116 -0
  218. package/dist/oid4vp/wallet.js +108 -0
  219. package/dist/recipient/store.d.ts +67 -0
  220. package/dist/recipient/store.js +98 -0
  221. package/dist/signing/ecdsa.d.ts +49 -0
  222. package/dist/signing/ecdsa.js +79 -0
  223. package/dist/signing/frost.d.ts +88 -0
  224. package/dist/signing/frost.js +145 -0
  225. package/dist/signing/index.d.ts +4 -0
  226. package/dist/signing/index.js +3 -0
  227. package/dist/slots/faucet.d.ts +23 -0
  228. package/dist/slots/faucet.js +35 -0
  229. package/dist/slots/index.d.ts +2 -0
  230. package/dist/slots/index.js +4 -0
  231. package/dist/verifier-agent/index.d.ts +241 -0
  232. package/dist/verifier-agent/index.js +411 -0
  233. package/docs/DEVELOPER-EXPERIENCE.md +62 -0
  234. package/docs/README.md +33 -0
  235. package/docs/access-control.md +76 -0
  236. package/docs/ai-development.md +292 -0
  237. package/docs/api.md +338 -0
  238. package/docs/application-api.md +335 -0
  239. package/docs/architecture.md +65 -0
  240. package/docs/basics.md +48 -0
  241. package/docs/capabilities.md +86 -0
  242. package/docs/chain.md +153 -0
  243. package/docs/compatibility.md +36 -0
  244. package/docs/consumer-migrations.md +80 -0
  245. package/docs/create-slot.md +104 -0
  246. package/docs/document-signing.md +243 -0
  247. package/docs/encrypted-notes.md +129 -0
  248. package/docs/encryption.md +100 -0
  249. package/docs/errors.md +76 -0
  250. package/docs/flows.md +289 -0
  251. package/docs/fuji.md +127 -0
  252. package/docs/funding.md +126 -0
  253. package/docs/getting-started.md +94 -0
  254. package/docs/glossary.md +44 -0
  255. package/docs/installation.md +132 -0
  256. package/docs/manage-slot.md +95 -0
  257. package/docs/native-approvals.md +124 -0
  258. package/docs/prerequisites.md +137 -0
  259. package/docs/read-slot.md +41 -0
  260. package/docs/reference/README.md +30 -0
  261. package/docs/reference/app-node.md +102 -0
  262. package/docs/reference/app.md +1737 -0
  263. package/docs/reference/chain-node.md +159 -0
  264. package/docs/reference/chain.md +3609 -0
  265. package/docs/reference/committee.md +2176 -0
  266. package/docs/reference/main.md +4068 -0
  267. package/docs/reference/oid4vp.md +2547 -0
  268. package/docs/reference/verifier-agent.md +498 -0
  269. package/docs/shared-account.md +168 -0
  270. package/docs/signing-and-encryption.md +52 -0
  271. package/docs/signing.md +172 -0
  272. package/examples/committee-slot.ts +16 -0
  273. package/examples/connect-fuji.ts +41 -0
  274. package/examples/connect-network.ts +14 -0
  275. package/examples/credential-approvals.ts +46 -0
  276. package/examples/document-signing/README.md +59 -0
  277. package/examples/document-signing/backend.ts +132 -0
  278. package/examples/document-signing/build.mjs +19 -0
  279. package/examples/document-signing/config.ts +34 -0
  280. package/examples/document-signing/gitignore.template +9 -0
  281. package/examples/document-signing/model.ts +140 -0
  282. package/examples/document-signing/network.ts +58 -0
  283. package/examples/document-signing/package.json +25 -0
  284. package/examples/document-signing/public/index.html +27 -0
  285. package/examples/document-signing/public/sample.pdf +31 -0
  286. package/examples/document-signing/public/styles.css +531 -0
  287. package/examples/document-signing/server.ts +358 -0
  288. package/examples/document-signing/setup.ts +111 -0
  289. package/examples/document-signing/store.ts +105 -0
  290. package/examples/document-signing/tsconfig.json +24 -0
  291. package/examples/document-signing/verify.ts +24 -0
  292. package/examples/document-signing/web/app.ts +312 -0
  293. package/examples/document-signing/web/preview.ts +67 -0
  294. package/examples/document-signing/web/wallet.ts +146 -0
  295. package/examples/document-signing/workflow.test.ts +228 -0
  296. package/examples/document-signing/workflow.ts +241 -0
  297. package/examples/document-signing.ts +96 -0
  298. package/examples/encrypted-notes.ts +86 -0
  299. package/examples/ethers-signer.ts +204 -0
  300. package/examples/fund-slot.ts +73 -0
  301. package/examples/getting-started.ts +25 -0
  302. package/examples/learning-authorize.ts +23 -0
  303. package/examples/learning-cancel-slot.ts +11 -0
  304. package/examples/learning-context.ts +28 -0
  305. package/examples/learning-create-slot.ts +25 -0
  306. package/examples/learning-read-slot.ts +8 -0
  307. package/examples/learning-renew-slot.ts +12 -0
  308. package/examples/learning-sign.ts +8 -0
  309. package/examples/live-config.ts +71 -0
  310. package/examples/minimal.ts +6 -0
  311. package/examples/native-approvals.ts +57 -0
  312. package/examples/network.ts +58 -0
  313. package/examples/offline.ts +16 -0
  314. package/examples/personal-vault.ts +20 -0
  315. package/examples/provision-slot.ts +47 -0
  316. package/examples/shared-account.ts +46 -0
  317. package/examples/slot-address.ts +13 -0
  318. package/examples/slot-creation.ts +9 -0
  319. package/examples/tutorial-negative.ts +26 -0
  320. package/examples/tutorial-support.ts +76 -0
  321. package/examples/viem-account.ts +203 -0
  322. package/package.json +303 -4
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Timeout and optional bearer authorization for direct service reads.
3
+ */
4
+ export interface FetchOpts {
5
+ /** Per-request timeout in ms (default 4000). */
6
+ timeoutMs?: number;
7
+ /** Bearer JWT, for the few authenticated reads (metering/audit). */
8
+ jwt?: string;
9
+ }
10
+ /**
11
+ * Keeper-reported runtime and connectivity metadata; fields depend on the server response.
12
+ */
13
+ export interface NodeInfo {
14
+ /** Keeper-reported network peer identifier. */
15
+ peer_id?: string;
16
+ /** Keeper-reported node identifier. */
17
+ node_identifier?: number;
18
+ /** Keeper software version reported by the service. */
19
+ version?: string;
20
+ /** Build profile reported by the keeper. */
21
+ build_profile?: string;
22
+ /** Keeper process uptime in seconds, as reported by the service. */
23
+ uptime_secs?: number;
24
+ /** Reported connected-peer count, or null when unavailable. */
25
+ connected_peers?: number | null;
26
+ /** Whether the keeper reports rate limiting as enabled. */
27
+ rate_limit_enabled?: boolean;
28
+ /** Whether the keeper reports administrative scope checks as enabled. */
29
+ admin_scope_enabled?: boolean;
30
+ [k: string]: unknown;
31
+ }
32
+ /**
33
+ * Keeper-reported slot threshold, key epoch and optional rule or activity metadata.
34
+ */
35
+ export interface KeySlotSummary {
36
+ /** Slot identifier returned by the keeper. */
37
+ key_slot_id: string;
38
+ /** Required threshold shares reported for the slot. */
39
+ threshold_k: number;
40
+ /** Total assigned participants reported for the slot. */
41
+ threshold_n: number;
42
+ /** Slot key epoch reported by the keeper. */
43
+ epoch: number;
44
+ /** Encoded group public key, or null when the service has no ready key. */
45
+ group_public_key?: string | null;
46
+ /** Disclosed authorization rule text, when included by the service. */
47
+ dcql_rule?: string | null;
48
+ /** Slot key mode reported by the keeper. */
49
+ mode?: string;
50
+ /** Creation timestamp string reported by the service. */
51
+ created_at?: string;
52
+ /** Most recent signing timestamp reported by the service, or null when absent. */
53
+ last_signed_at?: string | null;
54
+ [k: string]: unknown;
55
+ }
56
+ /**
57
+ * Slot summaries returned by a keeper key-list endpoint.
58
+ */
59
+ export interface KeyListReply {
60
+ /** Slot summaries included in the keeper response. */
61
+ slots: KeySlotSummary[];
62
+ [k: string]: unknown;
63
+ }
64
+ /**
65
+ * Operator heartbeat carrying an epoch, public key and signature; reading it does not verify it.
66
+ */
67
+ export interface SignedHeartbeat {
68
+ /** Operator address claimed by the heartbeat. */
69
+ operator: string;
70
+ /** Heartbeat epoch reported by the operator; not a slot key epoch. */
71
+ epoch: number;
72
+ /** Encoded public key included with the heartbeat. */
73
+ pubkey: string;
74
+ /** Encoded heartbeat signature; callers must verify it before trusting the heartbeat. */
75
+ signature: string;
76
+ [k: string]: unknown;
77
+ }
78
+ /**
79
+ * Keeper-reported operation counts for a slot and optional subject breakdown.
80
+ */
81
+ export interface MeteringReply {
82
+ /** Slot identifier whose operation counts were requested. */
83
+ key_slot_id: string;
84
+ /** Start of the reporting interval, when supplied by the service. */
85
+ since?: string;
86
+ /** End of the reporting interval, when supplied by the service. */
87
+ until?: string;
88
+ /** Total operations counted by the service. */
89
+ total: number;
90
+ /** Optional operation counts grouped by subject. */
91
+ by_subject?: Array<{
92
+ subject: string;
93
+ count: number;
94
+ }>;
95
+ /** Optional service-provided attestation; this read helper does not verify it. */
96
+ attestation?: unknown;
97
+ [k: string]: unknown;
98
+ }
99
+ /**
100
+ * Direct keeper HTTP reads for status, keys, public keys, heartbeats and metering.
101
+ */
102
+ export declare const nodeApi: {
103
+ info: (base: string, o?: FetchOpts) => Promise<NodeInfo>;
104
+ health: (base: string, o?: FetchOpts) => Promise<{
105
+ status: string;
106
+ }>;
107
+ readyz: (base: string, o?: FetchOpts) => Promise<{
108
+ status: string;
109
+ component?: string;
110
+ }>;
111
+ keys: (base: string, o?: FetchOpts) => Promise<KeyListReply>;
112
+ keySlot: (base: string, id: string, o?: FetchOpts) => Promise<KeySlotSummary>;
113
+ keySlotPublic: (base: string, id: string, o?: FetchOpts) => Promise<{
114
+ group_public_key?: string;
115
+ epoch?: number;
116
+ }>;
117
+ heartbeat: (base: string, o?: FetchOpts) => Promise<SignedHeartbeat>;
118
+ metering: (base: string, id: string, o?: FetchOpts) => Promise<MeteringReply>;
119
+ metrics: (base: string, o?: FetchOpts) => Promise<string>;
120
+ };
121
+ /**
122
+ * Verifier-reported runtime settings and token lifetime.
123
+ */
124
+ export interface VerifierInfo {
125
+ /** Verifier software version reported by the service. */
126
+ version?: string;
127
+ /** Verifier process uptime in seconds. */
128
+ uptime_secs?: number;
129
+ /** Reported bearer-token lifetime in seconds. */
130
+ jwt_ttl_secs?: number;
131
+ /** Whether the verifier reports rate limiting as enabled. */
132
+ rate_limit_enabled?: boolean;
133
+ [k: string]: unknown;
134
+ }
135
+ /**
136
+ * Direct verifier HTTP reads for status and Prometheus metrics.
137
+ */
138
+ export declare const verifierApi: {
139
+ info: (base: string, o?: FetchOpts) => Promise<VerifierInfo>;
140
+ health: (base: string, o?: FetchOpts) => Promise<{
141
+ status: string;
142
+ }>;
143
+ metrics: (base: string, o?: FetchOpts) => Promise<string>;
144
+ };
145
+ /**
146
+ * Parse finite numeric Prometheus samples into a map keyed by metric name and labels. Ignore comment lines and nonnumeric values; histogram buckets remain separate samples.
147
+ * @param text Prometheus text exposition returned by a metrics endpoint.
148
+ */
149
+ export declare function parsePrometheus(text: string): Record<string, number>;
@@ -0,0 +1,73 @@
1
+ import { httpError } from '../errors.js';
2
+ async function fetchJson(url, opts = {}) {
3
+ const ctrl = new AbortController();
4
+ const t = setTimeout(() => ctrl.abort(), opts.timeoutMs ?? 4000);
5
+ try {
6
+ const headers = {};
7
+ if (opts.jwt)
8
+ headers.Authorization = `Bearer ${opts.jwt}`;
9
+ const res = await fetch(url, { signal: ctrl.signal, headers });
10
+ if (!res.ok)
11
+ throw await httpError(res, url);
12
+ return (await res.json());
13
+ }
14
+ finally {
15
+ clearTimeout(t);
16
+ }
17
+ }
18
+ async function fetchText(url, opts = {}) {
19
+ const ctrl = new AbortController();
20
+ const t = setTimeout(() => ctrl.abort(), opts.timeoutMs ?? 4000);
21
+ try {
22
+ const res = await fetch(url, { signal: ctrl.signal });
23
+ if (!res.ok)
24
+ throw await httpError(res, url);
25
+ return await res.text();
26
+ }
27
+ finally {
28
+ clearTimeout(t);
29
+ }
30
+ }
31
+ const trim = (u) => u.replace(/\/$/, '');
32
+ /**
33
+ * Direct keeper HTTP reads for status, keys, public keys, heartbeats and metering.
34
+ */
35
+ export const nodeApi = {
36
+ info: (base, o) => fetchJson(`${trim(base)}/v1/info`, o),
37
+ health: (base, o) => fetchJson(`${trim(base)}/health`, o),
38
+ readyz: (base, o) => fetchJson(`${trim(base)}/readyz`, o),
39
+ keys: (base, o) => fetchJson(`${trim(base)}/v1/keys`, { ...o }),
40
+ keySlot: (base, id, o) => fetchJson(`${trim(base)}/v1/keys/${id}`, o),
41
+ keySlotPublic: (base, id, o) => fetchJson(`${trim(base)}/v1/keys/${id}/public`, o),
42
+ heartbeat: (base, o) => fetchJson(`${trim(base)}/v1/heartbeat`, o),
43
+ metering: (base, id, o) => fetchJson(`${trim(base)}/v1/metering/${id}`, o),
44
+ metrics: (base, o) => fetchText(`${trim(base)}/metrics`, o),
45
+ };
46
+ /**
47
+ * Direct verifier HTTP reads for status and Prometheus metrics.
48
+ */
49
+ export const verifierApi = {
50
+ info: (base, o) => fetchJson(`${trim(base)}/v1/info`, o),
51
+ health: (base, o) => fetchJson(`${trim(base)}/health`, o),
52
+ metrics: (base, o) => fetchText(`${trim(base)}/metrics`, o),
53
+ };
54
+ /**
55
+ * Parse finite numeric Prometheus samples into a map keyed by metric name and labels. Ignore comment lines and nonnumeric values; histogram buckets remain separate samples.
56
+ * @param text Prometheus text exposition returned by a metrics endpoint.
57
+ */
58
+ export function parsePrometheus(text) {
59
+ const out = {};
60
+ for (const raw of text.split(/\r?\n/)) {
61
+ const line = raw.trim();
62
+ if (!line || line.startsWith('#'))
63
+ continue;
64
+ const sp = line.lastIndexOf(' ');
65
+ if (sp < 0)
66
+ continue;
67
+ const key = line.slice(0, sp).trim();
68
+ const val = Number(line.slice(sp + 1).trim());
69
+ if (Number.isFinite(val))
70
+ out[key] = val;
71
+ }
72
+ return out;
73
+ }
@@ -0,0 +1,164 @@
1
+ import { type RuleInput } from './ruleInput.js';
2
+ import type { Address, Hex } from 'viem';
3
+ import type { TasraChainClient } from './client.js';
4
+ import type { PresentationDelegation } from '../verifier-agent/index.js';
5
+ import { type TypedDataSigner } from '../oid4vp/verifier-agent.js';
6
+ /**
7
+ * Action identifier accepted by the creator-authorized rule provisioning endpoint.
8
+ */
9
+ export declare const PROVISION_RULE_ACTION = "provision-rule";
10
+ /**
11
+ * Creator-signed rule delivery request with the private salt used at slot creation.
12
+ */
13
+ export interface ProvisionRuleArgs extends RuleInput {
14
+ /**
15
+ * 32-byte identifier of the slot to provision.
16
+ */
17
+ slotId: Hex;
18
+ /** The 32-byte rule salt `createSlot` returned. It exists NOWHERE else. */
19
+ ruleSalt: Hex;
20
+ /** The slot's creator key (or a key it delegated to). */
21
+ signer: TypedDataSigner;
22
+ /** Seconds the authorisation stays valid (default 600; the keeper caps at 3600). */
23
+ ttlSecs?: number;
24
+ /**
25
+ * Authorization issue time in Unix seconds; defaults to the current clock.
26
+ */
27
+ nowSecs?: number;
28
+ /**
29
+ * Consent description included in the creator signature.
30
+ */
31
+ description?: string;
32
+ /**
33
+ * Cancel pending keeper HTTP requests.
34
+ */
35
+ signal?: AbortSignal;
36
+ /** Overrides the on-chain committee; for tests and for a topology chain cannot see. */
37
+ keeperUrls?: string[];
38
+ /**
39
+ * HTTP implementation used for rule delivery.
40
+ */
41
+ fetchImpl?: typeof fetch;
42
+ /**
43
+ * Which rule the keepers must store. `'active'` (default) is the slot's current rule, delivered
44
+ * once per keeper exactly as before. `'pending'` is a proposed amendment: a keeper that has not
45
+ * yet ingested the proposal is retried, and a keeper that stores it as the ACTIVE rule is an error.
46
+ */
47
+ expect?: 'active' | 'pending';
48
+ /**
49
+ * Milliseconds to keep retrying a keeper that has not yet ingested the proposal, every 3 s
50
+ * (default 120000). Used only with `expect: 'pending'`, and must not exceed `ttlSecs`, because
51
+ * one signature serves every retry.
52
+ */
53
+ retryConflictMs?: number;
54
+ /**
55
+ * A creator delegation authorizing `signer` to deliver for the creator. A rule admin delivering
56
+ * a pending amendment signs without one; keepers do not accept an admin delegation.
57
+ */
58
+ delegation?: PresentationDelegation;
59
+ }
60
+ /** One keeper's answer. `pending` marks a rule stored against a PENDING amendment. */
61
+ export interface KeeperProvisionResult {
62
+ /**
63
+ * Keeper endpoint contacted by this attempt.
64
+ */
65
+ url: string;
66
+ /**
67
+ * Whether the keeper accepted the HTTP request.
68
+ */
69
+ ok: boolean;
70
+ /** The active rule was filled in by THIS call (false when it was already present). */
71
+ provisioned?: boolean;
72
+ /**
73
+ * Whether the keeper stored the rule for a pending amendment.
74
+ */
75
+ pending?: boolean;
76
+ /**
77
+ * Pending amendment version reported by the keeper.
78
+ */
79
+ pendingVersion?: number;
80
+ /**
81
+ * HTTP status when a response was received.
82
+ */
83
+ status?: number;
84
+ /**
85
+ * Bounded response text or transport error for a failed delivery.
86
+ */
87
+ error?: string;
88
+ /** Which authority the keeper accepted the signature as, when it says. */
89
+ authorizedBy?: 'creator' | 'delegate' | 'rule_admin';
90
+ }
91
+ /**
92
+ * Committed rule hash and per-keeper delivery outcomes.
93
+ */
94
+ export interface ProvisionRuleResult {
95
+ /**
96
+ * Slot whose authorization rule was delivered.
97
+ */
98
+ slotId: Hex;
99
+ /**
100
+ * Salted commitment computed from the submitted rule and saved salt.
101
+ */
102
+ ruleCommitment: Hex;
103
+ /**
104
+ * Delivery result for each selected keeper.
105
+ */
106
+ results: KeeperProvisionResult[];
107
+ }
108
+ /**
109
+ * Build the EIP-712 authorization a keeper verifies against the slot creator. The payload digest is the salted rule commitment.
110
+ * @param input Chain, registry, slot, commitment, consent description and expiry in Unix seconds.
111
+ * @returns Typed data ready for the creator wallet to sign.
112
+ */
113
+ export declare function provisionRuleTypedData(input: {
114
+ chainId: number;
115
+ keyRegistry: Address;
116
+ slotId: Hex;
117
+ commitment: Hex;
118
+ description: string;
119
+ exp: number;
120
+ }): {
121
+ domain: {
122
+ name: string;
123
+ version: string;
124
+ chainId: number;
125
+ verifyingContract: `0x${string}`;
126
+ };
127
+ types: {
128
+ readonly PresentationOperation: readonly [{
129
+ readonly name: "chainId";
130
+ readonly type: "uint256";
131
+ }, {
132
+ readonly name: "slotId";
133
+ readonly type: "bytes32";
134
+ }, {
135
+ readonly name: "action";
136
+ readonly type: "string";
137
+ }, {
138
+ readonly name: "payloadDigest";
139
+ readonly type: "bytes32";
140
+ }, {
141
+ readonly name: "description";
142
+ readonly type: "string";
143
+ }, {
144
+ readonly name: "exp";
145
+ readonly type: "uint256";
146
+ }];
147
+ };
148
+ primaryType: "PresentationOperation";
149
+ message: {
150
+ chainId: bigint;
151
+ slotId: `0x${string}`;
152
+ action: string;
153
+ payloadDigest: `0x${string}`;
154
+ description: string;
155
+ exp: bigint;
156
+ };
157
+ };
158
+ /**
159
+ * Deliver the clear rule and its salt to every assigned keeper using creator authorization. Throws if any delivery fails; inspect cause.results for individual outcomes.
160
+ * @param chain Reader for the deployment that owns the slot.
161
+ * @param args Rule, saved salt, creator signer and optional transport controls.
162
+ * @returns Commitment and successful delivery results for every selected keeper.
163
+ */
164
+ export declare function provisionRule(chain: TasraChainClient, args: ProvisionRuleArgs): Promise<ProvisionRuleResult>;
@@ -0,0 +1,212 @@
1
+ import { requireRule } from './ruleInput.js';
2
+ import { resolveSlotKeeperUrls } from './discovery.js';
3
+ import { ruleCommitment } from './write.js';
4
+ import { RuleAmendmentError, abortableDelay } from './ruleAmendmentCore.js';
5
+ import { TasraError } from '../errors.js';
6
+ import { PRESENTATION_EIP712_NAME, PRESENTATION_EIP712_VERSION, PRESENTATION_OPERATION_TYPES, } from '../oid4vp/verifier-agent.js';
7
+ /**
8
+ * Action identifier accepted by the creator-authorized rule provisioning endpoint.
9
+ */
10
+ export const PROVISION_RULE_ACTION = 'provision-rule';
11
+ /**
12
+ * Build the EIP-712 authorization a keeper verifies against the slot creator. The payload digest is the salted rule commitment.
13
+ * @param input Chain, registry, slot, commitment, consent description and expiry in Unix seconds.
14
+ * @returns Typed data ready for the creator wallet to sign.
15
+ */
16
+ export function provisionRuleTypedData(input) {
17
+ return {
18
+ domain: {
19
+ name: PRESENTATION_EIP712_NAME,
20
+ version: PRESENTATION_EIP712_VERSION,
21
+ chainId: input.chainId,
22
+ verifyingContract: input.keyRegistry,
23
+ },
24
+ types: PRESENTATION_OPERATION_TYPES,
25
+ primaryType: 'PresentationOperation',
26
+ message: {
27
+ chainId: BigInt(input.chainId),
28
+ slotId: input.slotId,
29
+ action: PROVISION_RULE_ACTION,
30
+ payloadDigest: input.commitment,
31
+ description: input.description,
32
+ exp: BigInt(input.exp),
33
+ },
34
+ };
35
+ }
36
+ /**
37
+ * Report individual keeper delivery failures. Peer recovery requires at least one keeper to hold the committed rule; callers still receive partial failures explicitly.
38
+ */
39
+ function fanoutError(slotId, ok, total, results, pending = false) {
40
+ const failures = results.filter(r => !r.ok).map(r => `${r.url}: ${r.error ?? `HTTP ${r.status}`}`);
41
+ const tail = `\n ${failures.join('\n ')}`;
42
+ if (pending) {
43
+ // A PENDING rule is not peer-healed: a keeper that missed it stays without it. Activation needs
44
+ // n - k + 1 keepers holding it, so the failures must be re-delivered, not waited out.
45
+ return new Error(`provisionRule: ${ok} of ${total} keepers stored the pending amendment for ${slotId}. Pending rules ` +
46
+ 'are not peer-healed, and activation needs n - k + 1 keepers holding the rule: re-deliver to ' +
47
+ `the keepers below.${tail}`);
48
+ }
49
+ if (ok === 0) {
50
+ return new Error(`provisionRule: no keeper accepted the rule for ${slotId} (0 of ${total}). The slot stays ` +
51
+ 'unusable and nothing can self-heal: peer rule-heal needs at least one keeper that ' +
52
+ `already holds it.${tail}`);
53
+ }
54
+ return new Error(`provisionRule: ${ok} of ${total} keepers accepted the rule for ${slotId}. The rest should ` +
55
+ 'self-heal from a peer (each keeper re-fetches a missing rule and checks it against the ' +
56
+ `on-chain commitment), but the failures are reported rather than hidden.${tail}`);
57
+ }
58
+ /**
59
+ * Deliver the clear rule and its salt to every assigned keeper using creator authorization. Throws if any delivery fails; inspect cause.results for individual outcomes.
60
+ * @param chain Reader for the deployment that owns the slot.
61
+ * @param args Rule, saved salt, creator signer and optional transport controls.
62
+ * @returns Commitment and successful delivery results for every selected keeper.
63
+ */
64
+ export async function provisionRule(chain, args) {
65
+ args.signal?.throwIfAborted();
66
+ if (!/^0x[0-9a-fA-F]{64}$/.test(args.slotId))
67
+ throw new Error('provisionRule: slotId must be 32 bytes');
68
+ if (!/^0x[0-9a-fA-F]{64}$/.test(args.ruleSalt))
69
+ throw new Error('provisionRule: ruleSalt must be 32 bytes');
70
+ const rule = requireRule(args);
71
+ const expectPending = args.expect === 'pending';
72
+ if (args.expect !== undefined && args.expect !== 'active' && !expectPending) {
73
+ throw new TasraError(`provisionRule: expect must be 'active' or 'pending', got ${JSON.stringify(args.expect)}`);
74
+ }
75
+ const ttlSecs = args.ttlSecs ?? 600;
76
+ const retryConflictMs = args.retryConflictMs ?? 120_000;
77
+ if (!Number.isSafeInteger(retryConflictMs) || retryConflictMs < 0) {
78
+ throw new TasraError(`provisionRule: retryConflictMs must be a non-negative integer, got ${String(args.retryConflictMs)}`);
79
+ }
80
+ // One signature serves every retry, so retrying past its expiry would only collect refusals.
81
+ if (expectPending && retryConflictMs > ttlSecs * 1000) {
82
+ throw new TasraError(`provisionRule: retryConflictMs (${retryConflictMs} ms) outlives the authorization (ttlSecs ${ttlSecs}); ` +
83
+ 'raise ttlSecs (the keeper caps it at 3600) or lower retryConflictMs');
84
+ }
85
+ const commitment = ruleCommitment(args.ruleSalt, rule);
86
+ // The configured id when present, else asked of the node: the EIP-712 domain must name the
87
+ // chain the KEEPER resolved, or the signature verifies against a domain nobody signed.
88
+ const chainId = chain.client.chain?.id ?? (await chain.client.getChainId());
89
+ const keyRegistry = chain.addresses.KeyRegistry;
90
+ if (!keyRegistry)
91
+ throw new Error('provisionRule: the address book has no KeyRegistry');
92
+ const exp = (args.nowSecs ?? Math.floor(Date.now() / 1000)) + ttlSecs;
93
+ const description = args.description ?? `Provision the authorization rule for slot ${args.slotId}`;
94
+ const typedData = provisionRuleTypedData({ chainId, keyRegistry, slotId: args.slotId, commitment, description, exp });
95
+ const operationSig = await args.signer.signTypedData(typedData);
96
+ args.signal?.throwIfAborted();
97
+ const urls = args.keeperUrls ?? (await resolveSlotKeeperUrls(chain, args.slotId));
98
+ if (urls.length === 0)
99
+ throw new Error(`provisionRule: slot ${args.slotId} has no assigned keepers on chain`);
100
+ const d = args.delegation;
101
+ const body = JSON.stringify({
102
+ // Current keeper wire names; these carry the clear policy and salt, not a hash.
103
+ dcql_rule: rule,
104
+ dcql_salt: args.ruleSalt,
105
+ authorization: {
106
+ chain_id: chainId,
107
+ slot_id: args.slotId,
108
+ action: PROVISION_RULE_ACTION,
109
+ payload_digest: commitment,
110
+ description,
111
+ exp,
112
+ operation_sig: operationSig,
113
+ // Absent, not null, without a delegation: the active-path body stays byte-identical.
114
+ ...(d
115
+ ? {
116
+ delegation: {
117
+ chain_id: d.chain_id,
118
+ slot_ids: d.slot_ids,
119
+ delegate: d.delegate,
120
+ actions: d.actions,
121
+ exp: d.exp,
122
+ nonce: d.nonce,
123
+ delegation_sig: d.signature,
124
+ },
125
+ }
126
+ : {}),
127
+ },
128
+ });
129
+ const id = args.slotId.slice(2);
130
+ const doFetch = args.fetchImpl ?? fetch;
131
+ /** POST once and classify the answer on its FULL text, before it is truncated for `error`. */
132
+ async function deliverOnce(url) {
133
+ try {
134
+ const res = await doFetch(`${url.replace(/\/$/, '')}/v1/keys/${id}/rule/by-creator`, {
135
+ method: 'POST',
136
+ headers: { 'content-type': 'application/json' },
137
+ body,
138
+ signal: args.signal,
139
+ });
140
+ if (!res.ok) {
141
+ const text = await res.text().catch(() => '');
142
+ const result = { url, ok: false, status: res.status, error: text.slice(0, 300) || `HTTP ${res.status}` };
143
+ return { result, kind: classifyRefusal(res.status, text) };
144
+ }
145
+ const json = (await res.json().catch(() => ({})));
146
+ const by = json.authorized_by;
147
+ return {
148
+ kind: 'ok',
149
+ result: {
150
+ url,
151
+ ok: true,
152
+ status: res.status,
153
+ provisioned: json.provisioned === true,
154
+ pending: json.pending === true,
155
+ pendingVersion: typeof json.pending_version === 'number' ? json.pending_version : undefined,
156
+ ...(by === 'creator' || by === 'delegate' || by === 'rule_admin' ? { authorizedBy: by } : {}),
157
+ },
158
+ };
159
+ }
160
+ catch (e) {
161
+ return { result: { url, ok: false, error: e instanceof Error ? e.message : String(e) }, kind: 'fail' };
162
+ }
163
+ }
164
+ /** Under `expect: 'pending'`, retry a keeper that has not yet ingested the proposal; else one attempt. */
165
+ async function deliver(url) {
166
+ const deadline = Date.now() + retryConflictMs;
167
+ let attempt = await deliverOnce(url);
168
+ while (expectPending && attempt.kind === 'not-ingested' && Date.now() < deadline) {
169
+ await abortableDelay(PENDING_RETRY_INTERVAL_MS, args.signal);
170
+ attempt = await deliverOnce(url);
171
+ }
172
+ return attempt;
173
+ }
174
+ // One signature serves the whole committee ON PURPOSE: the same rule goes to every drawn
175
+ // keeper, so replay to a sibling is the intended behaviour, not an attack.
176
+ const attempts = await Promise.all(urls.map(deliver));
177
+ const results = attempts.map(a => a.result);
178
+ if (expectPending) {
179
+ if (attempts.some(a => a.kind === 'pending-changed')) {
180
+ const changed = attempts.filter(a => a.kind === 'pending-changed').map(a => a.result.url);
181
+ throw new RuleAmendmentError('pending-changed', args.slotId, `provisionRule: the pending amendment of slot ${args.slotId} changed while the rule was being stored ` +
182
+ `(${changed.join(', ')}); nothing was written there. Re-read readRuleAmendment and re-deliver if this rule is still pending`, { results });
183
+ }
184
+ const active = results.filter(r => r.ok && r.pending !== true).map(r => r.url);
185
+ if (active.length > 0) {
186
+ throw new RuleAmendmentError('not-pending', args.slotId, `provisionRule: expected the keepers to store a PENDING amendment for slot ${args.slotId}, but ` +
187
+ `${active.join(', ')} took the rule as ACTIVE; this rule is not the slot's pending proposal`, { results });
188
+ }
189
+ }
190
+ const ok = results.filter(r => r.ok).length;
191
+ if (ok < results.length) {
192
+ const err = fanoutError(args.slotId, ok, results.length, results, expectPending);
193
+ err.cause = { results };
194
+ err.results = results;
195
+ throw err;
196
+ }
197
+ return { slotId: args.slotId, ruleCommitment: commitment, results };
198
+ }
199
+ /** Spacing between retries of a keeper that has not yet ingested the proposal. */
200
+ const PENDING_RETRY_INTERVAL_MS = 3_000;
201
+ /**
202
+ * Classify a refusal on the keeper's full answer. A 409 other than "pending rule amendment changed"
203
+ * and the rule admin's 403 "may provision only the slot's pending amendment" both mean the keeper
204
+ * has not yet ingested `RuleUpdateProposed`; "changed" is terminal. Only `expect: 'pending'` retries.
205
+ */
206
+ function classifyRefusal(status, text) {
207
+ if (status === 409)
208
+ return text.includes('pending rule amendment changed') ? 'pending-changed' : 'not-ingested';
209
+ if (status === 403 && text.includes("may provision only the slot's pending amendment"))
210
+ return 'not-ingested';
211
+ return 'fail';
212
+ }
@@ -0,0 +1,64 @@
1
+ import { type ServiceDiscoveryTransport } from './serviceIdentity.js';
2
+ import type { TasraChainClient } from './client.js';
3
+ import type { ServiceApproval } from './services.js';
4
+ import { type CreateSessionParams, type CreateSessionResult, type SessionStatusResult } from '../verifier-agent/index.js';
5
+ /**
6
+ * Guarded HTTPS transport for service discovery and verifier-agent sessions.
7
+ */
8
+ export interface AgentTransport extends ServiceDiscoveryTransport {
9
+ /** Same socket/TLS policy as discovery; bearer is allowed only on a session GET. */
10
+ agentRequest(url: string, options: {
11
+ body?: Uint8Array;
12
+ bearer?: string;
13
+ maxBytes: number;
14
+ signal: AbortSignal;
15
+ }): Promise<Uint8Array>;
16
+ }
17
+ /** Both the application and committee verifiers must independently approve this verifier-agent identity. */
18
+ export interface ApprovedAgentProfile {
19
+ /**
20
+ * Independently approved service registry identity and revision.
21
+ */
22
+ approval: ServiceApproval;
23
+ /**
24
+ * Expected canonical verifier-agent endpoint.
25
+ */
26
+ endpoint: string;
27
+ /**
28
+ * Approved OID4VP client identifier derived from the agent DID.
29
+ */
30
+ clientId: string;
31
+ }
32
+ /**
33
+ * Session pinned to its authenticated provider, with a closure for polling that provider.
34
+ */
35
+ export interface RegisteredAgentSession extends Readonly<CreateSessionResult> {
36
+ /**
37
+ * Provider identity and endpoint pinned when the session was opened.
38
+ */
39
+ readonly profile: Readonly<ApprovedAgentProfile>;
40
+ /** Poll only the original endpoint/profile. A provider change requires a fresh wallet session. */
41
+ poll(signal?: AbortSignal): Promise<SessionStatusResult>;
42
+ }
43
+ /**
44
+ * Session creation may have reached the provider, so automatic retry is unsafe.
45
+ */
46
+ export declare class AgentSessionCreationUnknownError extends Error {
47
+ readonly profile: Readonly<ApprovedAgentProfile>;
48
+ constructor(/** Approved verifier-agent profile whose session creation outcome is unknown. */ profile: Readonly<ApprovedAgentProfile>);
49
+ }
50
+ /**
51
+ * Selection authenticates public metadata first. Once POSTed, never silently switch providers.
52
+ * @param chain Reader for the approved service registry.
53
+ * @param config Independently approved provider profiles and guarded HTTP transport.
54
+ */
55
+ export declare function createRegisteredAgentClient(chain: TasraChainClient, config: {
56
+ profiles: readonly ApprovedAgentProfile[];
57
+ transport: AgentTransport;
58
+ }): {
59
+ /** At most three discovery candidates; optional index explicitly starts a new independent session. */
60
+ createSession(params: CreateSessionParams, options?: {
61
+ profileIndex?: number;
62
+ signal?: AbortSignal;
63
+ }): Promise<RegisteredAgentSession>;
64
+ };