@t3foundry/tasra-sdk 0.0.0-stage → 0.3.0-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,62 @@
1
+ # Deployment responsibilities
2
+
3
+ The SDK supplies application operations for wallets, credentials, slot creation,
4
+ signing and encryption. A usable application also needs a compatible deployment,
5
+ funding, an access policy and protected state storage.
6
+
7
+ | Component | Responsibility |
8
+ |---|---|
9
+ | Deployment | Reachable contracts and services, network manifest, supported modes and authorization formats, funding and issuer configuration. |
10
+ | SDK | Manifest loading, wallet adapters, slot commitments and provisioning, credential operations, cryptographic checks and durable operation journals. |
11
+ | Application | Access policy, consent, storage protection, issuer trust, funding decisions and results shown to users. |
12
+ | CLI | Optional command-line diagnostics and lifecycle operations. It is not required for SDK applications. |
13
+
14
+ ## Configure and check an application
15
+
16
+ 1. Install `@t3foundry/tasra-sdk@latest` and retain the lockfile.
17
+ 2. Download the network pointer and manifest from
18
+ [tasra-releases](https://github.com/t3foundry/tasra-releases) at one reviewed
19
+ commit. Verify the pointer's trusted checksum against the exact manifest bytes.
20
+ 3. Construct `TasraClient` with the release manifest and the deployment's coordinator
21
+ convention. Run `check()` to verify chain identity and registry availability.
22
+ 4. Create a wallet and private durable store. Fund the creator's public address
23
+ through the network's faucet or a wallet you control.
24
+ 5. Create identities and credentials, define the access policy and call `slots.create`
25
+ with a stable name and the intended mode and thresholds.
26
+ 6. Execute the protected operation and verify the result. Test an expected refusal
27
+ separately; a local validation error is not evidence of verifier enforcement.
28
+
29
+ Keep the same wallet, manifest, named request and store when resuming. Recorded
30
+ transaction hashes are reconciled; a submission without a known hash needs
31
+ investigation before another submission. Do not delete journals to force progress.
32
+ Expired commitments and abandoned store locks have no automatic recovery path.
33
+
34
+ ## Deployment inputs
35
+
36
+ - Network manifest, chain ID, reachable RPC and service URLs, contract addresses,
37
+ coordinator convention and trusted checksum information.
38
+ - Supported SDK and service versions, key modes, authorization formats and optional routes.
39
+ - Funding mechanisms for creator gas, Ethereum account transactions and usage or leases.
40
+ - Accepted issuer and holder formats, issuer enrollment and revocation behavior.
41
+ - Compatible CLI binaries and checksums, when a command-line workflow needs them.
42
+
43
+ New slots may pin an application-controlled issuer when the verifier supports that
44
+ issuer and credential format. Existing policies may require enrollment with an
45
+ external issuer. Creating an identity does not enroll it with another organization.
46
+
47
+ Until the committed rule is provisioned, keepers refuse protected operations.
48
+ `slots.create` performs this step. Advanced callers can use `provisionRule` with
49
+ the creator's own signature; no keeper administrator secret is required.
50
+
51
+ ## Record evidence of behavior
52
+
53
+ Record the package artifact, deployment identity, successful operation, expected
54
+ refusal and relevant transaction or request references. Keep private keys,
55
+ credentials, grants and recovery journals out of public evidence.
56
+
57
+ A build, registry read or working user interface does not establish signing,
58
+ decryption, credential acceptance or revocation. Test each required behavior on
59
+ the selected deployment. Revocation tests must allow for the issuer's documented
60
+ propagation and token-expiry window; signature verification alone is insufficient.
61
+
62
+ [Documentation index](README.md)
package/docs/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Build your first TASRA app
2
+
3
+ TASRA lets your application use a shared signing or encryption key without keeping
4
+ the whole key on one server. Your app decides who may use it.
5
+
6
+ Start with a small TypeScript project. Connect to a network, create one slot,
7
+ and learn how to read and manage it. Then add users and use the slot in an application.
8
+
9
+ ## Learn in order
10
+
11
+ | Step | What you will do |
12
+ |---|---|
13
+ | 1. [Understand the basics](basics.md) | Learn what a slot is and who controls it. |
14
+ | 2. [Connect to TASRA](getting-started.md) | Install the SDK and load a public network manifest. |
15
+ | 3. [Create your first slot](create-slot.md) | Create a signing slot with your own account. |
16
+ | 4. [Fund your slot](funding.md) | Buy TSRA and deposit usage credit before protected operations. |
17
+ | 5. [Read your slot](read-slot.md) | Check its key and status. |
18
+ | 6. [Control access](access-control.md) | Understand identities, credentials and permissions. |
19
+ | 7. [Sign or encrypt](signing-and-encryption.md) | Use the slot with a credential. |
20
+ | 8. [Manage your slot](manage-slot.md) | Renew its lease; cancel it when you are finished. |
21
+
22
+ **[Begin with the basics →](basics.md)**
23
+
24
+ <a id="build-an-app"></a>
25
+
26
+ ## After your first slot
27
+
28
+ Build a [shared Ethereum account](shared-account.md),
29
+ [private notes](encrypted-notes.md) or a [document-signing app](document-signing.md).
30
+ Each tutorial explains its additional requirements.
31
+
32
+ For AI-assisted development, use [skills and example prompts](ai-development.md).
33
+ When you need a method's exact signature, open the [SDK reference](reference/README.md).
@@ -0,0 +1,76 @@
1
+ # Give a user access
2
+
3
+ **Goal:** prepare Alice to use the slot you created. Keep that slot active.
4
+
5
+ An **identity** identifies a person or application. A **credential** is a signed
6
+ statement about that identity. An **issuer** signs it. The slot's **policy** decides
7
+ which credentials permit an operation.
8
+
9
+ Our slot accepts membership credentials from the issuer saved during creation.
10
+ Giving Alice a credential from that same issuer lets her request a signature.
11
+ Creating an identity alone would not grant access.
12
+
13
+ ## Prepare Alice
14
+
15
+ ```sh
16
+ cp node_modules/@t3foundry/tasra-sdk/examples/learning-authorize.ts .
17
+ npx tsc --noEmit
18
+ npx tsx learning-authorize.ts
19
+ ```
20
+
21
+ The script restores your issuer, creates and saves Alice's identity, and issues a
22
+ fresh membership credential. It prepares this authorization callback:
23
+
24
+ ```ts
25
+ const authorize = tasra.credentials.authorize({
26
+ verifierAgentUrl: tasra.verifierAgentUrl, signer: creator.signer,
27
+ identity: alice, credentials: [credential],
28
+ })
29
+ ```
30
+
31
+ **Success:** Alice's credential is ready. No signing request has been sent yet.
32
+ The next lesson uses `authorize` for the exact message being signed.
33
+
34
+ <details>
35
+ <summary>Complete script and how permission is checked</summary>
36
+
37
+ <!-- learning-authorize-example -->
38
+ ```ts
39
+ import {savedCreator, store, tasra} from './learning-context.js'
40
+
41
+ // Restore the issuer whose rule was committed when this slot was created.
42
+ const issuerKey = await store.load<Uint8Array>('issuer-key')
43
+ if (!issuerKey) throw new Error('Complete the create-slot lesson first')
44
+ const issuer = tasra.identities.create({seed: issuerKey})
45
+ const alice = await store.withLock('alice', async () => {
46
+ const identity = tasra.identities.create({seed: await store.load<Uint8Array>('alice-key')})
47
+ await store.save('alice-key', identity.exportPrivateKey())
48
+ return identity
49
+ })
50
+ const credential = tasra.credentials.issue({
51
+ issuer, holder: alice, type: 'urn:my-app:member', claims: {name: 'Alice'},
52
+ })
53
+ const creator = await savedCreator()
54
+ if (!tasra.verifierAgentUrl) throw new Error('The network manifest must advertise a verifier agent')
55
+
56
+ // Prepare the callback; credentials are presented only when an operation calls it.
57
+ export const authorize = tasra.credentials.authorize({
58
+ verifierAgentUrl: tasra.verifierAgentUrl, signer: creator.signer,
59
+ identity: alice, credentials: [credential],
60
+ })
61
+ console.log('Alice has a membership credential ready for the signing lesson.')
62
+ ```
63
+
64
+ The network checks Alice's credential against the slot's committed rule. It must
65
+ support the credential format and issuer accepted by that rule. This tutorial's
66
+ command initiates consent; an interactive app should supply the callback's
67
+ `approve` option to display its own consent screen.
68
+
69
+ This is a membership example. A document-encryption policy additionally needs
70
+ scopes limiting which document identities the holder may decrypt.
71
+
72
+ </details>
73
+
74
+ OAuth sign-in and multiple-person approvals come later, under **Go deeper**.
75
+
76
+ **Next: [Use your slot →](signing-and-encryption.md)**
@@ -0,0 +1,292 @@
1
+ # Skills and example prompts
2
+
3
+ Describe the application you want to build, then give your coding agent the SDK's
4
+ instructions. TASRA ships task-specific **skills**: readable `SKILL.md` files with
5
+ API guidance, examples and verification steps. They help an agent choose an
6
+ existing SDK flow, keep authorization checks intact and test the result instead
7
+ of inventing APIs or rebuilding SDK internals.
8
+
9
+ You can use the prompts below in your editor or coding agent. They start with
10
+ user outcomes; you do not need to know SDK client names first. For the operations
11
+ behind them, see [Application flows](flows.md).
12
+
13
+ ## Install and find the skills
14
+
15
+ Skills ship in a separate package, `@t3foundry/tasra-skills`. Start in your
16
+ application's directory:
17
+
18
+ ```sh
19
+ npm install @t3foundry/tasra-sdk@latest
20
+ npx @t3foundry/tasra-skills@latest init
21
+ node -p "require('@t3foundry/tasra-sdk/package.json').version"
22
+ ```
23
+
24
+ The version command reports the SDK package actually installed. Keep your
25
+ lockfile with the project. The installer copies the complete skill folders —
26
+ including each skill's `references/` folder — into `.agents/skills/`, or into
27
+ the folder you pass with `--target <dir>` for an agent that discovers skills
28
+ elsewhere.
29
+
30
+ Installing the skills places them in `.agents/skills/`. **It does not register
31
+ them with your agent unless that directory is where your agent looks.** Review
32
+ existing folders before copying so you preserve custom instructions, and start a
33
+ new session if the installed skills do not appear. Ask the agent to use
34
+ `tasra-getting-started` and the skill for your task. An agent without skill
35
+ discovery can read the installed `SKILL.md` directly when you provide its path.
36
+
37
+ After an SDK upgrade, refresh the skills by re-running
38
+ `npx @t3foundry/tasra-skills@latest init`, and record the installed version.
39
+ npm does not update `.agents/skills` copies. Paths beginning `docs/`,
40
+ `examples/` and `dist/` in skill instructions refer to `node_modules/@t3foundry/tasra-sdk/`;
41
+ `references/` stays inside the copied skill folder. See the
42
+ [`@t3foundry/tasra-skills`](https://www.npmjs.com/package/@t3foundry/tasra-skills)
43
+ package for the complete convention.
44
+
45
+ ## Choose a skill
46
+
47
+ Load the getting-started skill and the relevant task skill. You do not need to
48
+ load all instructions for every request.
49
+
50
+ | Task | Skill |
51
+ |---|---|
52
+ | Set up a TypeScript app and connect to a deployment | `tasra-getting-started` |
53
+ | Create, provision or resume a slot | `tasra-create-slot` |
54
+ | Give a user operation-specific authorization | `tasra-credentials-and-sessions` |
55
+ | Define who may use a slot or decrypt a document | `tasra-dcql-rules` |
56
+ | Write a Rego policy for an OAuth (organization IdP) slot | `tasra-rego-rules` |
57
+ | Handle refusal, cancellation and uncertain results | `tasra-handle-errors` |
58
+ | Build shared Ethereum accounts, document or FROST signing | `tasra-sign` |
59
+ | Encrypt data with BLS KEM and scoped access | `tasra-encryption` |
60
+ | Inspect deployment, registry and slot state | `tasra-chain` |
61
+ | Collect multiple approvals for one signature | `tasra-committee-path` |
62
+ | Integrate a credential wallet, issuer or OAuth provider | `tasra-oid4vp-wallet-and-verifier-agent` |
63
+
64
+ Skills are instructions, not credentials, network configuration or access grants.
65
+ They contain no operator secrets. Give the agent public deployment configuration
66
+ and explicit authority for the local test effects you want. Keep private keys,
67
+ credentials, authorization tokens and recovery journals out of prompts and public
68
+ logs. Skill installation does not start a fleet or authorize external account
69
+ creation, publishing or transactions.
70
+
71
+ ## Start with this common prompt
72
+
73
+ Use this once in a fresh project, then choose an application prompt below. Replace
74
+ `<project-name>` and supply the deployment's public manifest file or URL.
75
+
76
+ ```text
77
+ Help me build <project-name> with the latest Tasra SDK from npm. I am new to
78
+ TASRA. Use the installed tasra-getting-started skill, then only the skills needed
79
+ for my application. Read the installed docs, types and relevant complete example;
80
+ use SDK flows wherever available and do not invent APIs. Record the installed
81
+ package version without assuming a particular release.
82
+
83
+ Create a small TypeScript project with clear filenames and minimal comments
84
+ explaining the main steps. Download the selected network manifest from tasra-releases and verify its checksum. If the
85
+ manifest or a required service is missing, identify that missing input; do not
86
+ invent an endpoint or use private configuration from another project.
87
+
88
+ Use fresh application identities, wallets, credentials and slots when needed,
89
+ with private durable storage. Do not require copied learner keys or precreated
90
+ slots. Start with read-only connection checks. Before executing writes, confirm
91
+ the selected network and describe the intended effects and funding; reuse any
92
+ explicit authorization I have already given. Execute transactions only within
93
+ that authorized scope.
94
+
95
+ Give me the exact commands to install, typecheck, test and run the app. Test what
96
+ you can, show the observed results, and clearly list anything blocked or untested.
97
+ Keep public evidence separate from keys, credentials and recovery state.
98
+ ```
99
+
100
+ The selected deployment must support the requested mode, authorization format
101
+ and service routes. A successful connection check alone does not prove that a
102
+ protected operation works. Authorize network effects by naming the network,
103
+ funding source and intended transactions. Keep credentials and private keys out
104
+ of prompts; use private application storage.
105
+
106
+ ## 1. Connect and understand the environment
107
+
108
+ ```text
109
+ Create a small terminal app that connects to my selected TASRA network from its
110
+ public manifest. Show the chain, whether the configured registries are available,
111
+ and the active registered-node count. Explain what each result proves and what
112
+ it does not. Distinguish registered nodes from keepers. Do not create accounts,
113
+ slots or transactions.
114
+ ```
115
+
116
+ Use `tasra-getting-started` and
117
+ `tasra-chain`. Start from the [connection tutorial](getting-started.md).
118
+
119
+ ## 2. Create a wallet for my application
120
+
121
+ ```text
122
+ Add a wallet for my application. Generate it through the SDK, save its key
123
+ privately before it receives funds, and restore the same wallet after restart.
124
+ Show its public address and balance. Use only the network's published faucet or a wallet I control when funding is authorized. Explain the difference between
125
+ this setup wallet and an account controlled by a TASRA slot.
126
+ ```
127
+
128
+ ## 3. Let Alice and Bob use one Ethereum account
129
+
130
+ ```text
131
+ Build a team spending demo with one shared Ethereum account. Alice and Bob should
132
+ each be able to send a small authorized test transaction using their own credentials.
133
+ Mallory must be refused. Create all necessary development identities and the
134
+ shared account through the SDK. Verify the confirmed transactions and show that
135
+ Mallory's attempt did not change the account's transaction count. Either Alice
136
+ or Bob may act; this is not a requirement for both to approve each payment.
137
+ ```
138
+
139
+ Use `tasra-sign`;
140
+ [complete shared-account app](shared-account.md).
141
+
142
+ ## 4. Encrypt private notes
143
+
144
+ ```text
145
+ Build a private-notes app. Alice can encrypt a note and later read it with her
146
+ credential. Bob has a credential from the same issuer but must not read Alice's
147
+ note. Let the SDK handle encryption and authorized decryption. Test Alice's
148
+ successful read, Bob's refusal by the verifier, and detection of changed encrypted
149
+ data. Keep the encrypted note separate from private keys and credentials.
150
+ ```
151
+
152
+ Use `tasra-encryption`;
153
+ [complete encrypted-notes app](encrypted-notes.md).
154
+
155
+ ## 5. Protect document versions separately
156
+
157
+ ```text
158
+ Build a small encrypted document archive. Give each immutable document version
159
+ its own access identity. Grant Alice access to one version and show that this
160
+ does not automatically grant her a different version. Store enough public metadata
161
+ to find and decrypt an authorized version after restart. Explain which access
162
+ cannot be revoked once someone has obtained the decryption key or plaintext.
163
+ ```
164
+
165
+ ## 6. Collect two independent document signatures
166
+
167
+ ```text
168
+ Build an agreement-signing app. Alice and Bob review the same document, then each
169
+ signs with their own TASRA-backed identity. Mark the agreement complete only when
170
+ both distinct signatures verify for that exact document and request. Export the
171
+ document, expected request and signature bundle. Reject a changed document, a
172
+ signature copied from another request, and two copies of Alice's signature.
173
+ ```
174
+
175
+ Use `tasra-sign`;
176
+ [complete document-signing app](document-signing.md).
177
+
178
+ ## 7. Require two approvals for one signature
179
+
180
+ ```text
181
+ Build a release-approval workflow where Alice and Bob must both approve the same
182
+ release document before the system produces one final signature. Use the SDK's
183
+ native approval flow. Show that Alice approving twice does not replace Bob and
184
+ that an approval cannot be reused for another request. Save the request details
185
+ so the app can resume it. Explain how people approving differ from keepers signing.
186
+ ```
187
+
188
+ Use `tasra-committee-path`;
189
+ [complete native approval examples](native-approvals.md).
190
+
191
+ ## 8. Issue and verify team credentials
192
+
193
+ ```text
194
+ Build a local team-membership demo with a development issuer and separate Alice
195
+ and Bob identities. Issue credentials with their roles, verify them, and use those
196
+ roles to define access to an application operation. Show an expired credential
197
+ and a credential from an untrusted issuer being rejected by the relevant check.
198
+ Explain the difference between a valid signature, issuer trust and revocation.
199
+ Keep issuer and holder keys private and use the SDK's supported credential format.
200
+ ```
201
+
202
+ Use `tasra-credentials-and-sessions`
203
+ and `tasra-dcql-rules`.
204
+
205
+ ## 9. Connect an existing Ethereum wallet
206
+
207
+ ```text
208
+ Add a browser screen that connects my existing Ethereum wallet instead of
209
+ creating a local key. Request account access when I click Connect, show the
210
+ selected address, and check the network against my TASRA deployment. Handle
211
+ refused access and account or network changes clearly. Start with read-only
212
+ behavior; show a review screen before any later authorized transaction.
213
+ ```
214
+
215
+ This uses an Ethereum provider. A credential wallet is a separate integration.
216
+
217
+ ## 10. Authorize through an external credential wallet
218
+
219
+ ```text
220
+ Let a user authorize one document-signing request with an external credential
221
+ wallet. Show the appropriate QR code or deep link, wait for the selected verifier's
222
+ result, and continue only if authorization matches the exact request. Handle
223
+ refusal, cancellation and timeout without silently changing providers. Tell me
224
+ which wallet, credential format and verifier configuration were actually tested;
225
+ report missing integration inputs instead of claiming universal compatibility.
226
+ ```
227
+
228
+ Use `tasra-oid4vp-wallet-and-verifier-agent`.
229
+
230
+ ## 11. Use our organization's sign-in provider
231
+
232
+ ```text
233
+ Connect a protected TASRA operation to our organization's OAuth sign-in.
234
+ First inspect the SDK support and tell me which public provider settings and
235
+ application-side sign-in steps are required. Build the supported integration
236
+ around our chosen issuer and intended audience, with explicit user consent.
237
+ Keep tokens private. Test with the configured provider only when authorized;
238
+ clearly separate completed application setup from a successful end-to-end sign-in.
239
+ ```
240
+
241
+ OAuth slot setup exists, but the SDK does not supply the application's complete
242
+ IdP sign-in flow. Token acquisition and the bound DPoP signer require integration.
243
+ See [OAuth flow boundaries](flows.md#integrate-oauth-authorization).
244
+
245
+ ## 12. Resume without duplicate operations
246
+
247
+ ```text
248
+ Improve this app so restarting it continues the same slot creation or recorded
249
+ payment instead of creating another one. Use the SDK's durable operations and
250
+ keep the original private state. Test supported interruption points and confirm
251
+ that a completed operation is not submitted again. If a transaction outcome is
252
+ unknown, preserve it for reconciliation. Do not delete journals, steal abandoned
253
+ locks or claim unsupported recovery works.
254
+ ```
255
+
256
+ Use `tasra-create-slot` and
257
+ `tasra-handle-errors`.
258
+
259
+ ## 13. Prove the application works
260
+
261
+ ```text
262
+ Review this app against its intended user behavior and run its typecheck and
263
+ tests. For authorized network tests, exercise the successful action, an
264
+ unauthorized holder, changed data and relevant restart behavior. Distinguish a
265
+ local validation failure from a real verifier refusal. Save exact commands,
266
+ observed outputs and public transaction or request references in an evidence
267
+ folder with the tested source. Redact private material and list unexecuted checks.
268
+ ```
269
+
270
+ ## 14. Build a read-only slot dashboard
271
+
272
+ ```text
273
+ Build a simple dashboard for my application's slots using their public IDs and
274
+ the deployment manifest. Show each slot's mode, readiness, epoch and keeper
275
+ threshold from current public state. Explain unavailable or wrong-network results
276
+ without inventing data. Do not expose private credentials or recovery journals,
277
+ and do not suggest that a healthy registry proves protected operations will work.
278
+ ```
279
+
280
+ Use `tasra-chain`. Creating a UI framework project is
281
+ an application choice; the SDK supplies the deployment and slot operations.
282
+
283
+ ## Review what the agent produced
284
+
285
+ Check that you can follow the generated runbook from a clean application folder.
286
+ Read the policy, consent behavior and state-storage choices, then inspect executed
287
+ tests and their actual outputs. Successful compilation is useful evidence, but it
288
+ does not prove wallet interoperability or live authorization. Skills improve the
289
+ agent's instructions; your application's behavior still needs verification.
290
+
291
+ [Application flows](flows.md) · [Complete TypeScript apps](README.md#build-an-app) ·
292
+ [Errors and recovery](errors.md)