@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
package/CHANGELOG.md ADDED
@@ -0,0 +1,148 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package follows
5
+ semantic versioning with one pre-1.0 caveat: a minor bump may change the API, a patch
6
+ never does.
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Rule amendment on `tasra-sdk/chain`. The write client gains `proposeRuleUpdate`,
13
+ `endorseRuleUpdate`, `vetoRuleUpdate` and `activateRuleUpdate`; each refuses, before
14
+ signing, what the contract would revert (missing or immutable slot, wrong signer, an
15
+ amendment already pending, the current rule, a policy envelope on a non-`oauth` slot or
16
+ one keepers would not store, the timelock judged on chain time, too few keeper
17
+ adoptions). `readRuleAmendment` reads the active rule, the amendment policy and the
18
+ pending amendment with its adoption votes. `amendSlotRule` drives propose → deliver →
19
+ adoption → guardian endorsement → activation, resumes from the chain state when called
20
+ again, and returns `{version, ruleCommitment, proposeTx?, activateTx?}`. Refusals are a
21
+ `RuleAmendmentError` with a stable `code`.
22
+ - `provisionRule` options `expect: 'pending'` (deliver a proposed amendment; keepers that
23
+ have not yet seen the proposal are retried with the same signature, and a keeper that
24
+ stores the rule as active is an error), `retryConflictMs` (default 120000) and
25
+ `delegation` (a creator delegation). Each keeper result now carries `authorizedBy`
26
+ (`creator`, `delegate` or `rule_admin`) when the keeper reports it. The default
27
+ `expect: 'active'` delivery is unchanged.
28
+ - OAuth policy envelopes (`kk_oauth`): a slot whose holders sign in with their
29
+ organization's identity provider can commit a Rego policy over the DPoP-bound access
30
+ token's claims. `packEnvelope`, `unpackEnvelope`, `lintEnvelope` and `evaluateEnvelope`
31
+ run the network's own policy engine, shipped as a pinned WebAssembly module that is
32
+ loaded on first use and SHA-256-checked before instantiation; `isOauthEnvelope` is pure
33
+ TypeScript. `createSlot` / `createSlotCommitReveal` accept `oauthPolicy: {policy, tokens,
34
+ entrypoint?}`, require `authType: 'oauth'` for an envelope, refuse one keepers would not
35
+ store before any transaction, and return the committed string as `rule`.
36
+ `ruleCommitment` commits an envelope in canonical (RFC 8785) form. Package size: the
37
+ module adds 965,157 bytes unpacked (about 328 KB compressed); applications that never
38
+ call the engine do not load it. Third-party notices for the compiled engine are in
39
+ `NOTICE`.
40
+ - Additive `tasra-sdk/app` entry for typed slot operations, public EVM address lookup,
41
+ exact-operation authorization, a registered wallet adapter and viem accounts.
42
+ - Durable prepared creation journals with known-transaction recovery and explicit
43
+ refusal to retry an uncertain submission.
44
+ - Native FROST approval lifecycle, canonical approval payloads, strict IBE extraction,
45
+ and operation receipt preservation/verification.
46
+ - Complete encrypted-notes, document-signing and native approval TypeScript examples,
47
+ application guides and migration notes.
48
+
49
+ Install `tasra-sdk@latest` from npm. Network operations require compatible contracts
50
+ and services selected through a verified tasra-releases manifest.
51
+
52
+ - `committeeSignEoaDigest` in `tasra-sdk/committee` for request-bound threshold
53
+ Ethereum signing with verifier-agent compound tokens and membership proofs.
54
+ - SDK-only shared-account example that creates and provisions a tECDSA slot,
55
+ confirms Alice/Bob transactions, and verifies Mallory's server-side denial.
56
+ - Generated API reference and explicit SDK/deployment compatibility guidance.
57
+ - Evidence pass-through on `tasra-sdk/committee`: `committeeSign`, `committeeDecrypt` and
58
+ `requestIbeExtractionPartials` accept `evidenceCt` (the sealed presentation the verifier
59
+ agent returns beside the compound token as `evidenceCt`) and forward it to keepers;
60
+ `evidenceBindingMessage` and `verifyEvidenceBinding` check the token's evidence binding.
61
+ - `createDpopKey().tokenRequestProof({htm, htu, nonce?})` for identity providers that
62
+ require a DPoP proof on the token request itself.
63
+ - `isValidSessionId`, `MAX_SESSION_ID_LEN`, `OAUTH_RESPONSE_PATH_PREFIX` and
64
+ `OAUTH_RESPONSE_PATH_SUFFIX` in `tasra-sdk/committee`.
65
+
66
+ ### Changed
67
+
68
+ - **Breaking** (`tasra-sdk/committee`): `dpopHtu(origin, sessionId)` now takes the session
69
+ id and returns the per-session OAuth response URL
70
+ (`/v1/sessions/<sessionId>/oauth-response`); the session id must be one plain path
71
+ segment or the call throws.
72
+ - `assertCompoundTokenWire` refuses a compound token that carries only some of the
73
+ evidence fields.
74
+ - `RecipientStore.satisfies` and `validateRule` refuse a `kk_oauth` policy envelope by
75
+ name: held credentials cannot satisfy it (`canAccess` returns `false`).
76
+ - All 11 application-building skills lead with the current task workflow;
77
+ specialized and compatibility details are available in supporting references.
78
+ - The shared-account tutorial always demonstrates durable prepared creation.
79
+ - The slot-provisioning example uses the creator's signature instead of an admin JWT.
80
+
81
+ ### Removed
82
+
83
+ - **Breaking** (`tasra-sdk/committee`): `OAUTH_RESPONSE_PATH`; the response path is now
84
+ per session (`OAUTH_RESPONSE_PATH_PREFIX` + session id + `OAUTH_RESPONSE_PATH_SUFFIX`).
85
+
86
+ ### Fixed
87
+
88
+ - Every tasra-releases and repository link (docs, skills, examples, issue templates and
89
+ the generated reference `[Source]` links) now points at the `t3foundry` organisation.
90
+ - The bring-your-own-identity-provider section of the API guide now shows the `kk_oauth`
91
+ policy envelope (`oauthPolicy`) an OAuth slot uses, and how to amend it.
92
+ - Point npm package repository, issues, and homepage metadata to the publishing
93
+ GitHub repository.
94
+ - Make the funding tutorial resolve the EURC token from the verified BondingCurve
95
+ when the Fuji release manifest omits a separate token entry; reject conflicting
96
+ token addresses before writes.
97
+ - Let the Fuji application examples proceed with 0.05 AVAX of creator gas and
98
+ use a purchase amount that meets the documented 1 TSRA minimum.
99
+ - Update the development Next.js dependency past the `next/og` security advisory.
100
+ - Keep recovery salts out of public tutorial evidence; select public creation
101
+ references explicitly.
102
+ - Align note identity/result guidance with the API and include a complete standalone
103
+ Node TypeScript configuration.
104
+ - Point skills and onboarding docs to the published Fuji deployment pointer,
105
+ manifest checksum and service URLs in `t3foundry/tasra-releases`; document
106
+ bootstrap from a pinned repository commit.
107
+ - Narrow slot-creation results before reading the transaction hash in the skill's
108
+ direct/commit-reveal example.
109
+
110
+ ## [0.2.2] — 2026-09-23
111
+
112
+ ### Fixed
113
+
114
+ - Accept registered wallet Request Objects without `transaction_data`, while
115
+ preserving operation and nonce binding checks. When `transaction_data` is present,
116
+ continue to require exactly one entry matching the authorized operation, including
117
+ its description.
118
+
119
+ ## [0.2.1] — 2026-09-22
120
+
121
+ ### Fixed
122
+
123
+ - Treat relay attempts with a consumed nonce outside the 10,000-block reconciliation
124
+ window as terminal (`unresolvable`) and release the pending signer lock instead of
125
+ retrying forever. Export the `RelayReconciliation` result type from `tasra-sdk/chain`.
126
+ An unresolvable outcome does not prove that the operation failed; callers must check
127
+ the resulting chain state before repeating the operation.
128
+
129
+ ## [0.2.0] — 2026-09-22
130
+
131
+ ### Added
132
+
133
+ - Per-commitment accountant seeds for faster slot creation on compatible deployments,
134
+ with beacon-epoch fallback when a seed is unavailable.
135
+ - `requestSlotSeed`, `resolveAccountantUrls`, `ACCOUNTANT_TAG`, and the
136
+ `SlotSeed`, `SlotSeedOptions`, and `CommitRevealOptions` types in `tasra-sdk/chain`.
137
+ - Seed-request options and a `seeded` result flag on `createSlotCommitReveal`.
138
+
139
+ ### Changed
140
+
141
+ - Commit/reveal slot creation tries a seeded reveal before waiting for the beacon.
142
+ A failed seeded reveal through a relay propagates its error to preserve relay retries.
143
+ - KeyRegistry ABI includes seeded reveal methods, `commitSeedDigest`, and related
144
+ events and errors.
145
+
146
+ ## [0.1.0]
147
+
148
+ Initial release of `tasra-sdk`: a TypeScript access layer for the Tasra network.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,94 @@
1
+ Tasra SDK
2
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
3
+
4
+ This package ships a WebAssembly module, dist/auth/rego/wasm/keykeeper_rego_wasm_bg.wasm,
5
+ compiled from the Tasra network's keykeeper-rego crate (the Rego policy gate and evaluator
6
+ for OAuth authorization envelopes) together with the third-party Rust crates below. Their
7
+ notices follow. Exact versions are recorded in dist/auth/rego/wasm/PINS.json and in the
8
+ network repository's Cargo.lock at the commit PINS.json names.
9
+
10
+ --------------------------------------------------------------------------------
11
+ regorus 0.12.0 - https://github.com/microsoft/regorus
12
+ License: MIT AND Apache-2.0 AND BSD-3-Clause
13
+ (The Apache License 2.0 text is the same as this package's LICENSE file.)
14
+
15
+ MIT License
16
+
17
+ Copyright (c) Microsoft Corporation.
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ of this software and associated documentation files (the "Software"), to deal
21
+ in the Software without restriction, including without limitation the rights
22
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ copies of the Software, and to permit persons to whom the Software is
24
+ furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in all
27
+ copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ SOFTWARE
36
+
37
+ The file src/builtins/time/diff.rs contains code derived from Go's `time`
38
+ package, which carries the following license:
39
+
40
+ Copyright (c) 2009 The Go Authors. All rights reserved.
41
+
42
+ Redistribution and use in source and binary forms, with or without
43
+ modification, are permitted provided that the following conditions are
44
+ met:
45
+
46
+ * Redistributions of source code must retain the above copyright
47
+ notice, this list of conditions and the following disclaimer.
48
+ * Redistributions in binary form must reproduce the above
49
+ copyright notice, this list of conditions and the following disclaimer
50
+ in the documentation and/or other materials provided with the
51
+ distribution.
52
+ * Neither the name of Google Inc. nor the names of its
53
+ contributors may be used to endorse or promote products derived from
54
+ this software without specific prior written permission.
55
+
56
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
57
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
58
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
59
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
60
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
61
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
62
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
63
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
64
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
66
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67
+
68
+
69
+ --------------------------------------------------------------------------------
70
+ vstd, verus_builtin (Verus) - https://github.com/verus-lang/verus
71
+ License: MIT
72
+ Copyright (c) 2021 The Verus Contributors (upstream LICENSE; the published crates ship none)
73
+
74
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
75
+ software and associated documentation files (the "Software"), to deal in the Software
76
+ without restriction, including without limitation the rights to use, copy, modify, merge,
77
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
78
+ to whom the Software is furnished to do so, subject to the following conditions:
79
+
80
+ The above copyright notice and this permission notice shall be included in all copies or
81
+ substantial portions of the Software.
82
+
83
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
84
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
85
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
86
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
87
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
88
+ DEALINGS IN THE SOFTWARE.
89
+
90
+ --------------------------------------------------------------------------------
91
+ Other crates compiled into the module (serde, serde_json, sha3, num-bigint, indexmap,
92
+ hashbrown, wasm-bindgen and their dependencies) are licensed MIT OR Apache-2.0, or MIT.
93
+ The MIT terms above apply to each with that crate's own copyright notice, which its
94
+ published source distribution on crates.io carries.
package/README.md CHANGED
@@ -1,3 +1,138 @@
1
- # Temporary Holding Version
1
+ # Tasra SDK
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Build TypeScript apps that encrypt data and sign transactions through a distributed
4
+ keeper network. Use verifiable credentials to control who can decrypt or sign.
5
+
6
+ **[Start here: learn TASRA step by step](docs/README.md)**
7
+
8
+ Connect to a network, create your first slot, read and manage it, then add user
9
+ access and sign a message. Continue to complete applications when those basics
10
+ are familiar. Install the latest SDK from npm.
11
+
12
+ ## Install
13
+
14
+ Install the latest SDK from npm:
15
+
16
+ ```sh
17
+ npm install @t3foundry/tasra-sdk@latest
18
+ ```
19
+
20
+ Node.js **22.12+**, ESM, and modern browsers with WebCrypto.
21
+ Wallet and credential adapters are included; no separate application dependency is required.
22
+ [Installation and compatibility](docs/installation.md).
23
+
24
+ ```ts
25
+ import {TasraClient} from '@t3foundry/tasra-sdk/app'
26
+
27
+ // Use the manifest URL and trusted checksum from the selected tasra-releases pointer.
28
+ const tasra = await TasraClient.fromManifest(manifestUrl, {
29
+ sha256, coordinator: 'lowest-operator-id',
30
+ })
31
+ console.log(await tasra.check())
32
+ ```
33
+
34
+ The [quickstart](docs/getting-started.md) gives the complete folder, installation,
35
+ configuration, typecheck and run commands. The [application guide](docs/application-api.md) adds a creator wallet and durable
36
+ store, then creates slots with `tasra.slots.create(...)`. It also covers credentials,
37
+ shared accounts, encryption and document signing.
38
+
39
+ ## What do you want to build?
40
+
41
+ | Your goal | Start here |
42
+ |---|---|
43
+ | Read the registry first (no writes) | [TypeScript quickstart](docs/getting-started.md) |
44
+ | Encrypt data and let credential holders decrypt it | [Encrypted notes app](docs/encrypted-notes.md) |
45
+ | Create a slot for your app | [Create your first slot](docs/create-slot.md) |
46
+ | Pay for slot usage | [Buy TASRA and fund your slot](docs/funding.md) |
47
+ | Store encrypted notes for one authorized holder | [Encrypted notes app](docs/encrypted-notes.md) |
48
+ | Collect Alice's and Bob's document signatures | [Document-signing workflow](docs/document-signing.md) |
49
+ | Require multiple approvers for one signature | [Native approval recipes](docs/native-approvals.md) |
50
+ | Get an Ethereum address and sign transactions | [Shared account app](docs/shared-account.md) |
51
+ | Add a credential wallet or OAuth login | [Authentication APIs](docs/api.md#t3foundrytasra-sdkoid4vp--credential-wallets-against-the-verifier-agent) |
52
+ | Find an API or solve an error | [SDK reference](docs/reference/README.md) · [Errors](docs/errors.md) |
53
+
54
+ <a id="which-client-do-i-want"></a>
55
+
56
+ For client selection, see [Choose a client](docs/api.md#choose-a-client).
57
+
58
+ A **slot** is a network-managed key with an access rule. Use BLS slots for encryption,
59
+ FROST slots for FROST signatures, and tECDSA slots for Ethereum accounts.
60
+ [All capabilities](docs/capabilities.md) · [Documentation index](docs/README.md).
61
+
62
+ Deployment addresses and service URLs come from
63
+ [**tasra-releases**](https://github.com/t3foundry/tasra-releases).
64
+ The [Fuji configuration guide](docs/fuji.md) loads `networks/testnet/current.json`
65
+ and its manifest from one pinned commit, then verifies the checksum. Confirm service support for the intended signing, authorization or decryption
66
+ operation before executing it. A release record does not establish that support.
67
+
68
+ ## Authorize with your organization's identity provider
69
+
70
+ A slot can trust access tokens from your own OAuth identity provider. Write the access
71
+ rule as a short Rego policy over the token's claims; the SDK packs it into the slot's
72
+ rule and checks it with the same policy engine the network runs:
73
+
74
+ ```ts
75
+ import {packEnvelope, evaluateEnvelope} from '@t3foundry/tasra-sdk'
76
+
77
+ const rule = await packEnvelope(
78
+ 'package tasra.slot\n\ndefault allow := false\n\nallow if "treasury-signer" in input.tokens.corp.claims.roles\n',
79
+ {corp: {format: 'oauth+access-token+dpop', iss: [issuer], aud: [platformAudience], max_age_secs: 300}},
80
+ )
81
+ // Create the slot with {rule, authType: 'oauth'} (or pass oauthPolicy to createSlot),
82
+ // then preview a decision locally before presenting a token:
83
+ console.log(await evaluateEnvelope(rule, {holder, credentials: [{format: 'oauth+access-token+dpop', issuer, claims}]}))
84
+ ```
85
+
86
+ The engine (about 1 MB of WebAssembly) loads only when one of these functions is
87
+ called. See [OAuth authorization](docs/flows.md#integrate-oauth-authorization).
88
+
89
+ ## Try local encryption without a network
90
+
91
+ <details>
92
+ <summary>Optional: a complete offline TypeScript example</summary>
93
+
94
+ Install `@t3foundry/tasra-sdk` and `tsx`, save this as `demo.ts`, and run `npx tsx demo.ts`.
95
+ It prints `Hello Tasra`. These are public demo keys; never use them for real data.
96
+ This checks local encryption only. For live authorization, use the
97
+ [encrypted notes app](docs/encrypted-notes.md).
98
+
99
+ <!-- offline-example -->
100
+ ```ts
101
+ import {encryptEnvelope, decryptWithMasterKey, hexToBytes} from '@t3foundry/tasra-sdk'
102
+
103
+ /** Public, fixed DEMO keys. Never encrypt a real secret with these. */
104
+ function offlineRoundTrip(): string {
105
+ const msk = new Uint8Array(32)
106
+ msk[0] = 1
107
+ const mpk = hexToBytes('93e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8')
108
+ const identity = new TextEncoder().encode('demo')
109
+ try {
110
+ const envelope = encryptEnvelope(new Uint8Array(32), mpk, identity,
111
+ new TextEncoder().encode('Hello Tasra'), 0n)
112
+ return new TextDecoder().decode(decryptWithMasterKey(msk, envelope.ciphertext, identity))
113
+ } finally {
114
+ msk.fill(0)
115
+ }
116
+ }
117
+
118
+ console.log(offlineRoundTrip()) // Hello Tasra
119
+ ```
120
+
121
+ </details>
122
+
123
+ ## Use with a coding agent
124
+
125
+ Agent skills ship separately in the
126
+ [`@t3foundry/tasra-skills`](https://www.npmjs.com/package/@t3foundry/tasra-skills)
127
+ package. Follow its installation instructions to register them with your agent,
128
+ and refresh them after SDK upgrades. The same guides and examples are available
129
+ to developers without an agent.
130
+
131
+ ## Project
132
+
133
+ See [migration guidance](docs/consumer-migrations.md) and
134
+ [deployment compatibility](docs/compatibility.md) before upgrading.
135
+ The package has [not had an independent cryptographic audit](SECURITY.md#cryptographic-posture).
136
+
137
+ [Contributing](https://github.com/t3foundry/tasra-sdk/blob/develop/CONTRIBUTING.md) · [Changelog](CHANGELOG.md) ·
138
+ [Security](SECURITY.md) · [Apache-2.0 license](LICENSE)