@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.
- package/CHANGELOG.md +148 -0
- package/LICENSE +202 -0
- package/NOTICE +94 -0
- package/README.md +137 -2
- package/SECURITY.md +115 -0
- package/dist/app/approvals.d.ts +50 -0
- package/dist/app/approvals.js +90 -0
- package/dist/app/authorization.d.ts +19 -0
- package/dist/app/authorization.js +20 -0
- package/dist/app/client.d.ts +231 -0
- package/dist/app/client.js +272 -0
- package/dist/app/creation.d.ts +73 -0
- package/dist/app/creation.js +77 -0
- package/dist/app/deployment.d.ts +36 -0
- package/dist/app/deployment.js +18 -0
- package/dist/app/identity.d.ts +211 -0
- package/dist/app/identity.js +287 -0
- package/dist/app/index.d.ts +22 -0
- package/dist/app/index.js +12 -0
- package/dist/app/manifest.d.ts +74 -0
- package/dist/app/manifest.js +120 -0
- package/dist/app/node.d.ts +30 -0
- package/dist/app/node.js +159 -0
- package/dist/app/ready-slot.d.ts +157 -0
- package/dist/app/ready-slot.js +199 -0
- package/dist/app/tasra-client.d.ts +125 -0
- package/dist/app/tasra-client.js +79 -0
- package/dist/app/viem.d.ts +10 -0
- package/dist/app/viem.js +32 -0
- package/dist/app/wallet.d.ts +126 -0
- package/dist/app/wallet.js +137 -0
- package/dist/auth/dpop.d.ts +86 -0
- package/dist/auth/dpop.js +142 -0
- package/dist/auth/holderProof.d.ts +102 -0
- package/dist/auth/holderProof.js +161 -0
- package/dist/auth/identityScope.d.ts +19 -0
- package/dist/auth/identityScope.js +82 -0
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.js +13 -0
- package/dist/auth/oid4vp.d.ts +230 -0
- package/dist/auth/oid4vp.js +780 -0
- package/dist/auth/rego/wasm/PINS.json +11 -0
- package/dist/auth/rego/wasm/keykeeper_rego_wasm.d.ts +76 -0
- package/dist/auth/rego/wasm/keykeeper_rego_wasm.js +379 -0
- package/dist/auth/rego/wasm/keykeeper_rego_wasm_bg.wasm +0 -0
- package/dist/auth/rego.d.ts +192 -0
- package/dist/auth/rego.js +492 -0
- package/dist/auth/verifier.d.ts +166 -0
- package/dist/auth/verifier.js +211 -0
- package/dist/chain/abis/accountantSetRegistry.d.ts +441 -0
- package/dist/chain/abis/accountantSetRegistry.js +574 -0
- package/dist/chain/abis/accountantSlashing.d.ts +2071 -0
- package/dist/chain/abis/accountantSlashing.js +2670 -0
- package/dist/chain/abis/bondingCurve.d.ts +398 -0
- package/dist/chain/abis/bondingCurve.js +521 -0
- package/dist/chain/abis/equivocationSlasher.d.ts +292 -0
- package/dist/chain/abis/equivocationSlasher.js +379 -0
- package/dist/chain/abis/fixedTasraPriceOracle.d.ts +52 -0
- package/dist/chain/abis/fixedTasraPriceOracle.js +72 -0
- package/dist/chain/abis/index.d.ts +12801 -0
- package/dist/chain/abis/index.js +64 -0
- package/dist/chain/abis/keeperShareRegistry.d.ts +519 -0
- package/dist/chain/abis/keeperShareRegistry.js +675 -0
- package/dist/chain/abis/keyRegistry.d.ts +2421 -0
- package/dist/chain/abis/keyRegistry.js +3114 -0
- package/dist/chain/abis/livenessRegistry.d.ts +402 -0
- package/dist/chain/abis/livenessRegistry.js +524 -0
- package/dist/chain/abis/mockEurc.d.ts +210 -0
- package/dist/chain/abis/mockEurc.js +276 -0
- package/dist/chain/abis/nodeRegistry.d.ts +1630 -0
- package/dist/chain/abis/nodeRegistry.js +2113 -0
- package/dist/chain/abis/platformExecutor.d.ts +328 -0
- package/dist/chain/abis/platformExecutor.js +429 -0
- package/dist/chain/abis/prevrandaoSaltBeacon.d.ts +16 -0
- package/dist/chain/abis/prevrandaoSaltBeacon.js +24 -0
- package/dist/chain/abis/serviceRegistry.d.ts +556 -0
- package/dist/chain/abis/serviceRegistry.js +719 -0
- package/dist/chain/abis/settlement.d.ts +1624 -0
- package/dist/chain/abis/settlement.js +2096 -0
- package/dist/chain/abis/tasraSwapRouter.d.ts +92 -0
- package/dist/chain/abis/tasraSwapRouter.js +122 -0
- package/dist/chain/abis/tasraToken.d.ts +455 -0
- package/dist/chain/abis/tasraToken.js +599 -0
- package/dist/chain/abis/tasraVestingVault.d.ts +165 -0
- package/dist/chain/abis/tasraVestingVault.js +215 -0
- package/dist/chain/abis/thresholdRandomBeacon.d.ts +378 -0
- package/dist/chain/abis/thresholdRandomBeacon.js +494 -0
- package/dist/chain/abis/treasury.d.ts +301 -0
- package/dist/chain/abis/treasury.js +390 -0
- package/dist/chain/abis/verifierSetRegistry.d.ts +445 -0
- package/dist/chain/abis/verifierSetRegistry.js +579 -0
- package/dist/chain/client.d.ts +212 -0
- package/dist/chain/client.js +576 -0
- package/dist/chain/commitmentRecovery.d.ts +21 -0
- package/dist/chain/commitmentRecovery.js +44 -0
- package/dist/chain/committeeClient.d.ts +102 -0
- package/dist/chain/committeeClient.js +137 -0
- package/dist/chain/deployments.d.ts +56 -0
- package/dist/chain/deployments.js +269 -0
- package/dist/chain/discovery.d.ts +49 -0
- package/dist/chain/discovery.js +107 -0
- package/dist/chain/events.d.ts +58 -0
- package/dist/chain/events.js +125 -0
- package/dist/chain/format.d.ts +25 -0
- package/dist/chain/format.js +51 -0
- package/dist/chain/index.d.ts +41 -0
- package/dist/chain/index.js +56 -0
- package/dist/chain/manifest.d.ts +165 -0
- package/dist/chain/manifest.js +132 -0
- package/dist/chain/network-profiles.json +75 -0
- package/dist/chain/networks.d.ts +73 -0
- package/dist/chain/networks.js +62 -0
- package/dist/chain/node.d.ts +44 -0
- package/dist/chain/node.js +176 -0
- package/dist/chain/offchain.d.ts +149 -0
- package/dist/chain/offchain.js +73 -0
- package/dist/chain/provisionRule.d.ts +164 -0
- package/dist/chain/provisionRule.js +212 -0
- package/dist/chain/registeredAgent.d.ts +64 -0
- package/dist/chain/registeredAgent.js +140 -0
- package/dist/chain/registeredOperation.d.ts +49 -0
- package/dist/chain/registeredOperation.js +136 -0
- package/dist/chain/registeredRelay.d.ts +206 -0
- package/dist/chain/registeredRelay.js +312 -0
- package/dist/chain/revertReason.d.ts +14 -0
- package/dist/chain/revertReason.js +62 -0
- package/dist/chain/ruleAmendment.d.ts +80 -0
- package/dist/chain/ruleAmendment.js +195 -0
- package/dist/chain/ruleAmendmentCore.d.ts +129 -0
- package/dist/chain/ruleAmendmentCore.js +152 -0
- package/dist/chain/ruleInput.d.ts +10 -0
- package/dist/chain/ruleInput.js +13 -0
- package/dist/chain/serviceIdentity.d.ts +176 -0
- package/dist/chain/serviceIdentity.js +237 -0
- package/dist/chain/serviceProfiles.d.ts +39 -0
- package/dist/chain/serviceProfiles.js +74 -0
- package/dist/chain/services.d.ts +141 -0
- package/dist/chain/services.js +79 -0
- package/dist/chain/slotClient.d.ts +55 -0
- package/dist/chain/slotClient.js +62 -0
- package/dist/chain/slotSeed.d.ts +31 -0
- package/dist/chain/slotSeed.js +98 -0
- package/dist/chain/write.d.ts +431 -0
- package/dist/chain/write.js +958 -0
- package/dist/client/client.d.ts +112 -0
- package/dist/client/client.js +111 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +2 -0
- package/dist/client/session.d.ts +67 -0
- package/dist/client/session.js +238 -0
- package/dist/committee/client.d.ts +284 -0
- package/dist/committee/client.js +351 -0
- package/dist/committee/dual-sign.d.ts +110 -0
- package/dist/committee/dual-sign.js +202 -0
- package/dist/committee/ecdsa.d.ts +36 -0
- package/dist/committee/ecdsa.js +45 -0
- package/dist/committee/extraction.d.ts +82 -0
- package/dist/committee/extraction.js +96 -0
- package/dist/committee/index.d.ts +19 -0
- package/dist/committee/index.js +13 -0
- package/dist/committee/oauth.d.ts +51 -0
- package/dist/committee/oauth.js +90 -0
- package/dist/committee/receipts.d.ts +51 -0
- package/dist/committee/receipts.js +59 -0
- package/dist/committee/request.d.ts +264 -0
- package/dist/committee/request.js +305 -0
- package/dist/committee/token.d.ts +274 -0
- package/dist/committee/token.js +418 -0
- package/dist/crypto/constants.d.ts +10 -0
- package/dist/crypto/constants.js +32 -0
- package/dist/crypto/detect.d.ts +20 -0
- package/dist/crypto/detect.js +44 -0
- package/dist/crypto/envelope.d.ts +60 -0
- package/dist/crypto/envelope.js +243 -0
- package/dist/crypto/frost.d.ts +49 -0
- package/dist/crypto/frost.js +152 -0
- package/dist/crypto/hex.d.ts +7 -0
- package/dist/crypto/hex.js +24 -0
- package/dist/crypto/ibe-blob.d.ts +114 -0
- package/dist/crypto/ibe-blob.js +208 -0
- package/dist/crypto/ibe.d.ts +88 -0
- package/dist/crypto/ibe.js +262 -0
- package/dist/crypto/index.d.ts +12 -0
- package/dist/crypto/index.js +12 -0
- package/dist/crypto/kem.d.ts +55 -0
- package/dist/crypto/kem.js +241 -0
- package/dist/decryption/client.d.ts +64 -0
- package/dist/decryption/client.js +82 -0
- package/dist/decryption/index.d.ts +2 -0
- package/dist/decryption/index.js +2 -0
- package/dist/errors.d.ts +124 -0
- package/dist/errors.js +167 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +98 -0
- package/dist/keys/index.d.ts +1 -0
- package/dist/keys/index.js +4 -0
- package/dist/keys/node-client.d.ts +27 -0
- package/dist/keys/node-client.js +97 -0
- package/dist/oid4vp/binding.d.ts +76 -0
- package/dist/oid4vp/binding.js +118 -0
- package/dist/oid4vp/did-web.d.ts +49 -0
- package/dist/oid4vp/did-web.js +57 -0
- package/dist/oid4vp/index.d.ts +9 -0
- package/dist/oid4vp/index.js +10 -0
- package/dist/oid4vp/jose.d.ts +166 -0
- package/dist/oid4vp/jose.js +242 -0
- package/dist/oid4vp/jwe.d.ts +30 -0
- package/dist/oid4vp/jwe.js +93 -0
- package/dist/oid4vp/oid4vci.d.ts +84 -0
- package/dist/oid4vp/oid4vci.js +85 -0
- package/dist/oid4vp/request-object.d.ts +109 -0
- package/dist/oid4vp/request-object.js +96 -0
- package/dist/oid4vp/sd-jwt.d.ts +177 -0
- package/dist/oid4vp/sd-jwt.js +208 -0
- package/dist/oid4vp/verifier-agent.d.ts +161 -0
- package/dist/oid4vp/verifier-agent.js +132 -0
- package/dist/oid4vp/wallet.d.ts +116 -0
- package/dist/oid4vp/wallet.js +108 -0
- package/dist/recipient/store.d.ts +67 -0
- package/dist/recipient/store.js +98 -0
- package/dist/signing/ecdsa.d.ts +49 -0
- package/dist/signing/ecdsa.js +79 -0
- package/dist/signing/frost.d.ts +88 -0
- package/dist/signing/frost.js +145 -0
- package/dist/signing/index.d.ts +4 -0
- package/dist/signing/index.js +3 -0
- package/dist/slots/faucet.d.ts +23 -0
- package/dist/slots/faucet.js +35 -0
- package/dist/slots/index.d.ts +2 -0
- package/dist/slots/index.js +4 -0
- package/dist/verifier-agent/index.d.ts +241 -0
- package/dist/verifier-agent/index.js +411 -0
- package/docs/DEVELOPER-EXPERIENCE.md +62 -0
- package/docs/README.md +33 -0
- package/docs/access-control.md +76 -0
- package/docs/ai-development.md +292 -0
- package/docs/api.md +338 -0
- package/docs/application-api.md +335 -0
- package/docs/architecture.md +65 -0
- package/docs/basics.md +48 -0
- package/docs/capabilities.md +86 -0
- package/docs/chain.md +153 -0
- package/docs/compatibility.md +36 -0
- package/docs/consumer-migrations.md +80 -0
- package/docs/create-slot.md +104 -0
- package/docs/document-signing.md +243 -0
- package/docs/encrypted-notes.md +129 -0
- package/docs/encryption.md +100 -0
- package/docs/errors.md +76 -0
- package/docs/flows.md +289 -0
- package/docs/fuji.md +127 -0
- package/docs/funding.md +126 -0
- package/docs/getting-started.md +94 -0
- package/docs/glossary.md +44 -0
- package/docs/installation.md +132 -0
- package/docs/manage-slot.md +95 -0
- package/docs/native-approvals.md +124 -0
- package/docs/prerequisites.md +137 -0
- package/docs/read-slot.md +41 -0
- package/docs/reference/README.md +30 -0
- package/docs/reference/app-node.md +102 -0
- package/docs/reference/app.md +1737 -0
- package/docs/reference/chain-node.md +159 -0
- package/docs/reference/chain.md +3609 -0
- package/docs/reference/committee.md +2176 -0
- package/docs/reference/main.md +4068 -0
- package/docs/reference/oid4vp.md +2547 -0
- package/docs/reference/verifier-agent.md +498 -0
- package/docs/shared-account.md +168 -0
- package/docs/signing-and-encryption.md +52 -0
- package/docs/signing.md +172 -0
- package/examples/committee-slot.ts +16 -0
- package/examples/connect-fuji.ts +41 -0
- package/examples/connect-network.ts +14 -0
- package/examples/credential-approvals.ts +46 -0
- package/examples/document-signing/README.md +59 -0
- package/examples/document-signing/backend.ts +132 -0
- package/examples/document-signing/build.mjs +19 -0
- package/examples/document-signing/config.ts +34 -0
- package/examples/document-signing/gitignore.template +9 -0
- package/examples/document-signing/model.ts +140 -0
- package/examples/document-signing/network.ts +58 -0
- package/examples/document-signing/package.json +25 -0
- package/examples/document-signing/public/index.html +27 -0
- package/examples/document-signing/public/sample.pdf +31 -0
- package/examples/document-signing/public/styles.css +531 -0
- package/examples/document-signing/server.ts +358 -0
- package/examples/document-signing/setup.ts +111 -0
- package/examples/document-signing/store.ts +105 -0
- package/examples/document-signing/tsconfig.json +24 -0
- package/examples/document-signing/verify.ts +24 -0
- package/examples/document-signing/web/app.ts +312 -0
- package/examples/document-signing/web/preview.ts +67 -0
- package/examples/document-signing/web/wallet.ts +146 -0
- package/examples/document-signing/workflow.test.ts +228 -0
- package/examples/document-signing/workflow.ts +241 -0
- package/examples/document-signing.ts +96 -0
- package/examples/encrypted-notes.ts +86 -0
- package/examples/ethers-signer.ts +204 -0
- package/examples/fund-slot.ts +73 -0
- package/examples/getting-started.ts +25 -0
- package/examples/learning-authorize.ts +23 -0
- package/examples/learning-cancel-slot.ts +11 -0
- package/examples/learning-context.ts +28 -0
- package/examples/learning-create-slot.ts +25 -0
- package/examples/learning-read-slot.ts +8 -0
- package/examples/learning-renew-slot.ts +12 -0
- package/examples/learning-sign.ts +8 -0
- package/examples/live-config.ts +71 -0
- package/examples/minimal.ts +6 -0
- package/examples/native-approvals.ts +57 -0
- package/examples/network.ts +58 -0
- package/examples/offline.ts +16 -0
- package/examples/personal-vault.ts +20 -0
- package/examples/provision-slot.ts +47 -0
- package/examples/shared-account.ts +46 -0
- package/examples/slot-address.ts +13 -0
- package/examples/slot-creation.ts +9 -0
- package/examples/tutorial-negative.ts +26 -0
- package/examples/tutorial-support.ts +76 -0
- package/examples/viem-account.ts +203 -0
- package/package.json +303 -4
package/docs/api.md
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
# Advanced clients and OAuth
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Start with the [shared-account tutorial](shared-account.md) for a complete app.
|
|
5
|
+
The [generated reference](reference/README.md) covers public signatures, option
|
|
6
|
+
fields, return types, and source comments across all eight library entry points. This page maps
|
|
7
|
+
imports to tasks; [chain](chain.md), [signing](signing.md), and [errors](errors.md)
|
|
8
|
+
provide operation details. Code fragments below assume their named inputs already exist.
|
|
9
|
+
|
|
10
|
+
## Choose a client
|
|
11
|
+
|
|
12
|
+
Start new applications with `TasraClient` from `@t3foundry/tasra-sdk/app`. The runtime class
|
|
13
|
+
is separate from the root module's existing `TasraClient` session-client type.
|
|
14
|
+
Install the latest SDK with `npm install @t3foundry/tasra-sdk@latest`; see
|
|
15
|
+
[installation](installation.md) for runtime and TypeScript setup.
|
|
16
|
+
|
|
17
|
+
| Entry point | Import | Use it for | Requires |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| `new TasraClient({manifest})` / `TasraClient.fromManifest(url)` | `@t3foundry/tasra-sdk/app` | Create slots, use wallets and credentials, encrypt and sign | Public deployment manifest; wallet and durable store for slot creation |
|
|
20
|
+
| `createFileStore` | `@t3foundry/tasra-sdk/app/node` | Private durable state for a Node application | A private local directory |
|
|
21
|
+
| `createTasraChainClient` | `@t3foundry/tasra-sdk/chain` | Read contracts and discover the network | RPC, chain ID, deployment addresses |
|
|
22
|
+
| `createTasraWriteClient` | `@t3foundry/tasra-sdk/chain` | Create slots, fund them, change on-chain state | Deployment configuration and funded transaction signer |
|
|
23
|
+
| `createCommitteeSlotClient` | `@t3foundry/tasra-sdk/chain` | Credential-gated threshold encryption/decryption and FROST signing | Chain client, slot, holder, credentials and verifier proofs |
|
|
24
|
+
| `createTasraSlotClient` | `@t3foundry/tasra-sdk/chain` | Chain-discovered managed sessions | Chain client, identity and session authentication |
|
|
25
|
+
| `createTasraClient` | `@t3foundry/tasra-sdk` | Managed sessions with explicit endpoints | Keeper URLs and session authentication; verifier for credential redemption |
|
|
26
|
+
|
|
27
|
+
The remaining factories support advanced integrations and existing applications.
|
|
28
|
+
Managed-session local decryption requires an **exportable** BLS slot. Threshold
|
|
29
|
+
custody uses the committee client; it does not export the master key.
|
|
30
|
+
For Ethereum signatures, see [`signEoaDigest`](signing.md), not committee FROST signing.
|
|
31
|
+
|
|
32
|
+
## Common results
|
|
33
|
+
|
|
34
|
+
| Call | Returns | Related guide |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `tasra.check()` | Chain and registry availability; authorization compatibility remains unknown | [Quickstart](getting-started.md) |
|
|
37
|
+
| `tasra.slots.create(request)` | Ready typed slot with its committed access policy provisioned | [Application API](application-api.md#create-a-wallet-identity-and-slot) |
|
|
38
|
+
| `tasra.wallets.create()` / `tasra.wallets.connect(provider)` | Local wallet / promise of an external-wallet adapter | [Application API](application-api.md) |
|
|
39
|
+
| `tasra.wallets.fromSlot(slotId, {authorize})` | Promise of a threshold Ethereum wallet with named durable transfers | [Shared account](shared-account.md) |
|
|
40
|
+
| `tasra.identities.create()` | Fresh holder identity with a DID and explicit private-key export | [Credentials](application-api.md#issue-credentials-and-authorize-a-user) |
|
|
41
|
+
| `tasra.credentials.issue(input)` / `authorize(input)` | SD-JWT credential / operation authorizer | [Credentials](application-api.md#issue-credentials-and-authorize-a-user) |
|
|
42
|
+
| `parsePinnedNetworkManifest(text, sha256)` | Validated `NetworkManifest`; throws on checksum or schema mismatch | [Fuji configuration](fuji.md) |
|
|
43
|
+
| `createTasraChainClient(config)` | `TasraChainClient` with `client` and typed `readers` | [Chain reference](chain.md#create-a-read-client) |
|
|
44
|
+
| `chain.readers.keyRegistry.getKeySlot(slotId)` | Promise of slot state, including `exists`, `mode`, `publicKey`, `epoch`, `cancelled` | [Address lookup](signing.md#get-the-ethereum-address) |
|
|
45
|
+
| `addressFromEoaPubkey(pubkey)` | EIP-55 checksummed Ethereum address | [Address lookup](signing.md#get-the-ethereum-address) |
|
|
46
|
+
| `committeeSignEoaDigest(options)` | Promise of `{groupPublicKey, r, s, yParity}` using request-bound authorization | [Complete tutorial](shared-account.md) |
|
|
47
|
+
| `signEoaDigest(options)` | Promise of `{groupPublicKey, r, s, yParity}` | [Signing](signing.md) |
|
|
48
|
+
| `client.openSession(slotId, auth)` | Promise of a managed `Session` | [Exportable vault](encryption.md#if-you-want-an-exportable-personal-vault) |
|
|
49
|
+
|
|
50
|
+
## Application entry exports
|
|
51
|
+
|
|
52
|
+
`@t3foundry/tasra-sdk/app` provides `TasraClient`, the manifest loader, wallet and identity
|
|
53
|
+
adapters, credential helpers, slot creation and native approval helpers.
|
|
54
|
+
`@t3foundry/tasra-sdk/app/node` provides `createFileStore`; keep this Node-only import out of
|
|
55
|
+
browser bundles. See the [application guide](application-api.md) for the normal
|
|
56
|
+
workflow and [generated application reference](reference/app.md) for complete signatures.
|
|
57
|
+
|
|
58
|
+
## Main entry exports
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
| Group | Symbols |
|
|
62
|
+
|---|---|
|
|
63
|
+
| **Managed client** | `createTasraClient`, `TasraClient`, `Session`, `SessionAuth`, `VpJwtAuth`, `OpenSessionOpts`, `SignOpts` |
|
|
64
|
+
| **Errors** | `TasraError`, `TasraHttpError`, `AuthDeniedError`, `NodeUnreachableError`, `ThresholdNotMetError`, `SlotRotatedError`, `CommitteeAuthorizeError`, `DcqlMalformedError`, `VerifierAgentSessionError`, `isAuthDenied`, `isRetryable` |
|
|
65
|
+
| Crypto | `encryptEnvelope`, `decryptWithMasterKey`, `toBytes`, `fromBytes`, `buildTasraText`, `parseTasraPost`, `isTasraPost`, `GroupEnvelope` |
|
|
66
|
+
| Identity-scoped IBE | `ibeEncrypt`, `ibeCombineExtract`, `ibeCombineDecrypt`, `ibeDecryptWithKey`, `requestIbeExtractionPartials`; **large objects**: `ibeSealBlob`, `ibeOpenBlob`, `ibeUnwrapBlobKey`, `ibeBlobDecryptKey`, `ibeDecryptBlobChunk`, `ibeBlobChunkRange`, `ibeBlobDigest`, `IbeBlobHeader` |
|
|
67
|
+
| Node client | `fetchMpk`, `fetchAndAssembleKey` |
|
|
68
|
+
| Signing | `signCustody`, `signWithShardDelivery`, `signUserRequest`, `signEoaDigest`, `ethSignatureV`, `addressFromEoaPubkey`, `aggregateFrostSignature`, `verifyFrostSignature` |
|
|
69
|
+
| Decryption (threshold) | `decryptCustody`, `decryptWithShardDelivery`, `combineDecryptShares`, `verifyDecryptShare` |
|
|
70
|
+
| Verifier auth + JWT | `redeemCredential`, `redeemRenewalToken`, `createRenewal`, `revokeRenewal`, `issueAdminCredential`, `revokeSlotUser`, `verifyPresentation`, `verifyVpJwt`, `decodeJwtClaims`, `jwtExpMs`, `isJwtExpiringSoon` + `IssuedToken`, `JwtClaims` |
|
|
71
|
+
| DCQL (OID4VP-DCQL) | `validateDcql`, `evaluateDcql`, `selectDcql`, `canonicalizeDcql`, `isOid4vpRule`, `jsonCredential`, `evaluateIdentityScoped`, `scopeCovers`, `DcqlMalformedError`, `DCQL_MAX_RULE_LEN` + `DcqlQuery`, `CredentialView` |
|
|
72
|
+
| Verifier Agent sessions | `createOid4vpSession`, `pollOid4vpSession`, `waitForSession`, `payloadDigest`, `VerifierAgentSessionError`; `oauth` kind: `createOauthSession`, `submitOauthResponse` + `CreateSessionParams`, `CreateOauthSessionResult`, `SessionStatusResult` |
|
|
73
|
+
| DPoP (RFC 9449) | `createDpopKey`, `auth0DpopSigner`, `jwkThumbprint`, `accessTokenHash`, `isHeaderSafeNonce` + `DpopSigner`, `DpopKey` |
|
|
74
|
+
| Committee tokens | not on the main entry — see [`@t3foundry/tasra-sdk/committee`](#t3foundrytasra-sdkcommittee--protocol-internals) |
|
|
75
|
+
| Slot funding | `httpFaucet` (sovereign slot creation lives in `@t3foundry/tasra-sdk/chain`) |
|
|
76
|
+
| Utils | `hexToBytes` |
|
|
77
|
+
|
|
78
|
+
For new apps, use `tasra.slots.bls(...)` and `tasra.slots.frost(...)` for
|
|
79
|
+
credential-gated threshold custody. `createCommitteeSlotClient` remains available
|
|
80
|
+
for advanced committee integrations. Managed
|
|
81
|
+
`Session.decrypt` requires an exportable personal-vault slot; the session primitives,
|
|
82
|
+
verifier-auth helpers, and crypto are what it composes (use them directly when you
|
|
83
|
+
need finer control). To resolve endpoints from chain instead of hardcoding them, use the
|
|
84
|
+
`@t3foundry/tasra-sdk/chain` clients (`createTasraSlotClient` / `createCommitteeSlotClient`).
|
|
85
|
+
Verifier-auth helpers are pure HTTP/JSON; JWT inspection is client-side only (expiry/UX),
|
|
86
|
+
never a signature check. DCQL is a **generic** evaluator — scope *semantics* are the
|
|
87
|
+
consuming product's concern.
|
|
88
|
+
|
|
89
|
+
## Large objects under IBE — `ibeSealBlob` / `ibeOpenBlob`
|
|
90
|
+
|
|
91
|
+
`ibeEncrypt` is a KEM for a small payload. For an image, a scan series or any multi-megabyte
|
|
92
|
+
object, seal an **envelope**: a fresh 32-byte data key IBE-wrapped to the identity, the body
|
|
93
|
+
AES-256-GCM in fixed chunks (WebCrypto, default 1 MiB), each chunk's nonce
|
|
94
|
+
`blobId[0..8] ‖ be32(i)` and its AAD `"keykeeper/ibe-blob/v1" ‖ blobId ‖ be32(i) ‖ last ‖ identity`
|
|
95
|
+
— so a chunk cannot be reordered, dropped, truncated or replayed under another identity.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import {ibeSealBlob, ibeOpenBlob, ibeUnwrapBlobKey, ibeBlobDecryptKey, ibeDecryptBlobChunk, ibeBlobChunkRange} from '@t3foundry/tasra-sdk'
|
|
99
|
+
|
|
100
|
+
// producer (offline, nothing but the slot's public MPK)
|
|
101
|
+
const {header, body} = await ibeSealBlob(mpk, 'did:key:zPatient/imaging/2026-09', pngBytes, {contentType: 'image/png'})
|
|
102
|
+
// store `body` as a blob and `header` beside it (header.wrappedKey is the IBE ciphertext of the data key)
|
|
103
|
+
|
|
104
|
+
// consumer, after an identity-scoped extraction gave it sk_ID for that identity
|
|
105
|
+
const png = await ibeOpenBlob(skId, header, body) // whole object in memory, or …
|
|
106
|
+
const dek = ibeUnwrapBlobKey(skId, header) // … stream it:
|
|
107
|
+
const key = await ibeBlobDecryptKey(dek)
|
|
108
|
+
for (let i = 0; i < header.chunkCount; i++) {
|
|
109
|
+
const {start, end} = ibeBlobChunkRange(header, i) // byte range of chunk i in `body`
|
|
110
|
+
const plain = await ibeDecryptBlobChunk(key, header, i, await fetchRange(start, end))
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`sk_ID` is a per-identity capability, so one extraction opens every object sealed to that
|
|
115
|
+
identity; time-box identities (`…/2026-09`) rather than expecting to revoke one. Use a producer-authenticated manifest containing both the header and the body
|
|
116
|
+
digest (`ibeBlobDigest(body)`) so the consumer can reject substituted metadata or
|
|
117
|
+
ciphertext before decrypting. A signed body digest alone does not protect the header.
|
|
118
|
+
|
|
119
|
+
Chunk size must be an integer of at least 1024 bytes. Empty input still has one
|
|
120
|
+
chunk: zero plaintext bytes and a 16-byte authentication tag. Exact chunk-size
|
|
121
|
+
multiples add no extra chunk; the last partial chunk contains the remaining bytes.
|
|
122
|
+
`ibeBlobChunkRange` returns an exclusive `end`; an HTTP Range request ends at
|
|
123
|
+
`end - 1`. Validate safe-integer indices in `[0, header.chunkCount)` and use a trusted
|
|
124
|
+
header. The SDK rejects negative and past-end indices; it does not validate every
|
|
125
|
+
malformed header or fractional index. Authenticate the header alongside the body
|
|
126
|
+
digest before trusting metadata such as `contentType`.
|
|
127
|
+
|
|
128
|
+
## `@t3foundry/tasra-sdk/oid4vp` — credential wallets against the Verifier Agent
|
|
129
|
+
|
|
130
|
+
The wallet protocol uses OpenID4VP 1.0 with DCQL, SD-JWT VC + KB-JWT, JARM
|
|
131
|
+
`direct_post.jwt`, and OpenID4VCI pre-authorized issuance. This subpath supports
|
|
132
|
+
two application roles:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
// APP / RELYING PARTY: sign the operation with the slot creator's EVM key (EIP-712
|
|
136
|
+
// PresentationOperation), open a session on the verifier-agent, hand the openid4vp:// payload to a wallet,
|
|
137
|
+
// collect the compound token — the credentials never come back here.
|
|
138
|
+
import {openVerifierAgentSession, awaitVerifierAgentResult} from '@t3foundry/tasra-sdk/oid4vp'
|
|
139
|
+
const session = await openVerifierAgentSession({verifierAgentUrl, chainId, keyRegistry, slotId, action: 'sign', message, description, signer: creatorAccount})
|
|
140
|
+
showQr(session.qrPayload)
|
|
141
|
+
const {token} = await awaitVerifierAgentResult(session) // checks token.request_hash against the session
|
|
142
|
+
|
|
143
|
+
// WALLET: receive a credential from any OpenID4VCI issuer, then answer a request: fetch + verify
|
|
144
|
+
// the JAR (did:web → the verifier-agent's set document), plan against its dcql_query, let the user pick ONE
|
|
145
|
+
// credential, disclose only the claims asked for, bind with a KB-JWT, encrypt, POST.
|
|
146
|
+
import {randomHolderKey, receiveCredential, presentToRequestUri} from '@t3foundry/tasra-sdk/oid4vp'
|
|
147
|
+
const holder = randomHolderKey() // P-256 did:jwk, cnf.kid = did#0
|
|
148
|
+
const {credential} = await receiveCredential({offerUri, holder})
|
|
149
|
+
await presentToRequestUri(qrPayload, [{sdJwt: credential}], holder, {choose: askUser})
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
`planPresentation` / `buildResponse` / `submitResponse` are the steps behind `presentToRequestUri`
|
|
153
|
+
for a UI that wants a consent screen between them. One credential per presentation: a rule that
|
|
154
|
+
needs two credentials must use `credential_sets` with single-credential options (what the Hovi
|
|
155
|
+
Wallet can satisfy). Issuers use `issueSdJwtVc` (P-256 `did:key` or `did:jwk` issuer); the
|
|
156
|
+
request binding (`requestHash`, `derivedNonce`) lives in `binding` for the verifier-agent
|
|
157
|
+
side. A wallet copies the nonce; it never interprets it.
|
|
158
|
+
|
|
159
|
+
## Bring your own identity provider — OAuth + DPoP against the Verifier Agent
|
|
160
|
+
|
|
161
|
+
A slot created with `authType: 'oauth'` is authorized by an access token your users already get
|
|
162
|
+
from your own IdP, sender-constrained with DPoP (RFC 9449). Its rule is a `kk_oauth` policy
|
|
163
|
+
envelope: a Rego v1 policy over the DPoP-bound token's claims, plus a `tokens` map the network
|
|
164
|
+
enforces before the policy runs — the token format, the pinned issuer, the platform audience and
|
|
165
|
+
the maximum token age. Create the slot with an `oauthPolicy`; the SDK packs the envelope with the
|
|
166
|
+
network's own engine and refuses one keepers would not store, before any chain call:
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import {platformAudience} from '@t3foundry/tasra-sdk/committee'
|
|
170
|
+
|
|
171
|
+
const POLICY = `package tasra.slot
|
|
172
|
+
|
|
173
|
+
default allow := false
|
|
174
|
+
|
|
175
|
+
allow if "treasury-signer" in input.tokens.corp.claims.realm_access.roles
|
|
176
|
+
`
|
|
177
|
+
const tokens = {corp: {format: 'oauth+access-token+dpop', iss: ['https://idp.example.com/realms/acme'],
|
|
178
|
+
aud: [platformAudience(agentOrigin, chainId)], max_age_secs: 300}}
|
|
179
|
+
|
|
180
|
+
const created = await writer.createSlot({
|
|
181
|
+
authType: 'oauth', oauthPolicy: {policy: POLICY, tokens}, mode: 'frost', k: 2, n: 3,
|
|
182
|
+
rulePolicy: {admin: adminAddress, guardian: writer.address, timelockSecs: 3600},
|
|
183
|
+
})
|
|
184
|
+
// created.rule is the packed envelope: persist it with created.ruleSalt, then provisionRule(...)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`createSlotCommitReveal` takes the same arguments. The policy decides on claims only; it never
|
|
188
|
+
re-checks issuer, audience or age. Test it locally with `evaluateEnvelope` before committing it.
|
|
189
|
+
The audience
|
|
190
|
+
is derived, never chosen — `platformAudience(agentOrigin, chainId)` from
|
|
191
|
+
`@t3foundry/tasra-sdk/committee`, or read it back from any `createOauthSession` reply.
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
import {auth0DpopSigner, createOauthSession, submitOauthResponse, waitForSession} from '@t3foundry/tasra-sdk'
|
|
195
|
+
import {presentationOperationTypedData} from '@t3foundry/tasra-sdk/oid4vp'
|
|
196
|
+
|
|
197
|
+
const {typedData, operation, messageHex} = presentationOperationTypedData({
|
|
198
|
+
chainId, keyRegistry, slotId, action: 'sign', message, description: 'Treasury payout #42',
|
|
199
|
+
})
|
|
200
|
+
const operationSig = await creatorSigner.signTypedData(typedData)
|
|
201
|
+
|
|
202
|
+
const session = await createOauthSession(verifierAgentUrl, {operation, operationSig, messageHex})
|
|
203
|
+
// → {sessionId, pollSecret, nonce, dpopHtu, platformAudience} — no QR, no Request Object
|
|
204
|
+
|
|
205
|
+
await submitOauthResponse(verifierAgentUrl, {
|
|
206
|
+
sessionId: session.sessionId, pollSecret: session.pollSecret,
|
|
207
|
+
accessToken, nonce: session.nonce, dpopHtu: session.dpopHtu,
|
|
208
|
+
signer, // MUST sign with the key the token is bound to
|
|
209
|
+
})
|
|
210
|
+
const result = await waitForSession(verifierAgentUrl, session.sessionId, session.pollSecret)
|
|
211
|
+
if (result.status !== 'done') throw new Error(`refused: ${result.error}`)
|
|
212
|
+
// result.compoundToken + result.verifierProofs → the keeper's /v1/committee/sign
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**The signer is decided by where your token's DPoP key lives:**
|
|
216
|
+
|
|
217
|
+
| Your token came from | `signer` |
|
|
218
|
+
|---|---|
|
|
219
|
+
| `auth0-spa-js` with `useDpop` | `auth0DpopSigner((args) => auth0.generateDpopProof(args))` |
|
|
220
|
+
| `oidc-client-ts` with `dpop` enabled | `{proof: ({htm, htu, nonce}) => userManager.dpopProof(htu, user, htm, nonce)}` (it computes `ath` from the user's token) |
|
|
221
|
+
| your own token request with a key from `createDpopKey()` | `key.signer` |
|
|
222
|
+
|
|
223
|
+
To obtain the token with a `createDpopKey()` key, put `await key.tokenRequestProof({htm: 'POST',
|
|
224
|
+
htu: tokenEndpoint})` in the token request's `DPoP` header (add `nonce` only if the IdP answered
|
|
225
|
+
`use_dpop_nonce`); a token-request proof carries no `ath`, because there is no token yet. Then
|
|
226
|
+
present with `key.signer`.
|
|
227
|
+
|
|
228
|
+
**Note: the `htu` is this session's route on the agent's PUBLIC origin:**
|
|
229
|
+
`{agentOrigin}/v1/sessions/{sessionId}/oauth-response`, returned as `session.dpopHtu`. When you
|
|
230
|
+
call the agent at that origin, it is exactly the URL `submitOauthResponse` posts to, so a
|
|
231
|
+
generic DPoP client that derives `htu` from the request URL works too. If you reach the agent
|
|
232
|
+
through a different base URL (an internal hostname, a proxy), sign over `session.dpopHtu` — the
|
|
233
|
+
origin the verifiers approved — not over the URL you called.
|
|
234
|
+
|
|
235
|
+
**Note: a refused delivery throws.** When the committee refuses (wrong role, stale token, wrong
|
|
236
|
+
audience…) the agent answers the POST itself with `{status: "failed", error}` — `403` for a
|
|
237
|
+
refusal, `503` when the drawn quorum could not be reached — and `submitOauthResponse` throws
|
|
238
|
+
`VerifierAgentSessionError` with `kind: 'refused'` and the verifiers' reasons in `message`. The
|
|
239
|
+
session is over; open a new one to retry. On success, `waitForSession` returns the token.
|
|
240
|
+
`submitOauthResponse` answers the agent's `use_dpop_nonce` challenge once by itself.
|
|
241
|
+
|
|
242
|
+
What the platform proves this way is PRESENCE, not intent — the user never sees the
|
|
243
|
+
operation; pin dual control on slots that need intent. Configuring a tenant identity
|
|
244
|
+
provider is a deployment task, documented by whoever operates the network.
|
|
245
|
+
|
|
246
|
+
### Amend the rule
|
|
247
|
+
|
|
248
|
+
A slot created with a `rulePolicy` can change its rule without changing its key. The rule admin
|
|
249
|
+
proposes the new rule, it is delivered to the keepers, the keepers adopt it, and once the delay
|
|
250
|
+
has passed it is activated. `amendSlotRule` drives every step, checks everything it can before
|
|
251
|
+
signing, and resumes where the chain is when called again with the same rule:
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
import {amendSlotRule, createTasraChainClient, createTasraWriteClient, readRuleAmendment} from '@t3foundry/tasra-sdk/chain'
|
|
255
|
+
import {privateKeyToAccount} from 'viem/accounts'
|
|
256
|
+
|
|
257
|
+
// The slot was created with rulePolicy {admin: adminAddress, guardian: creatorAddress, timelockSecs: 3600}.
|
|
258
|
+
const chain = createTasraChainClient({rpcUrl, chainId, addresses})
|
|
259
|
+
const admin = createTasraWriteClient({rpcUrl, chainId, addresses, privateKey: adminKey})
|
|
260
|
+
const creator = createTasraWriteClient({rpcUrl, chainId, addresses, privateKey: creatorKey})
|
|
261
|
+
|
|
262
|
+
const status = await readRuleAmendment(chain, slotId) // status.policy === null: the rule can never change
|
|
263
|
+
const amended = await amendSlotRule(admin, chain, {
|
|
264
|
+
slotId,
|
|
265
|
+
ruleSalt, // the slot's saved rule salt
|
|
266
|
+
oauthPolicy: {policy: NEW_POLICY, tokens},
|
|
267
|
+
deliverer: privateKeyToAccount(creatorKey), // signs the delivery to the keepers
|
|
268
|
+
guardian: creator, // endorses, which waives the remaining delay
|
|
269
|
+
onPhase: phase => console.log(phase), // proposed, delivered, adopted, endorsed, activated
|
|
270
|
+
})
|
|
271
|
+
// → {version, ruleCommitment, proposeTx?, activateTx?}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
- `readRuleAmendment(chain, slotId)` returns the active commitment, the policy (`null` when the
|
|
275
|
+
rule can never change) and the pending amendment with its keeper adoption votes.
|
|
276
|
+
- `proposeRuleUpdate`, `endorseRuleUpdate`, `vetoRuleUpdate` and `activateRuleUpdate` on the write
|
|
277
|
+
client are the single steps. Each checks the contract's preconditions before signing and throws
|
|
278
|
+
`RuleAmendmentError` with a `code`.
|
|
279
|
+
- `provisionRule(chain, {…, expect: 'pending'})` delivers a proposed rule, waiting for keepers
|
|
280
|
+
that have not yet seen the proposal. The creator, a creator delegate or the rule admin may sign it.
|
|
281
|
+
|
|
282
|
+
**An amendable rule means whoever holds the admin key can change who may sign with this key,
|
|
283
|
+
without changing the key.** Keep the admin key as safe as the slot itself. The guardian can veto
|
|
284
|
+
during the delay; without a guardian nobody can. Slots created without a rule admin can never
|
|
285
|
+
become amendable. A proposal no keeper stores never activates, and a new one is refused while it
|
|
286
|
+
is pending, so lint the new policy first.
|
|
287
|
+
|
|
288
|
+
## Sealed committee evidence — `evidence_ct`
|
|
289
|
+
|
|
290
|
+
Each drawn verifier seals the presentation it evaluated to the accountant set's certified
|
|
291
|
+
evidence key, and signs a second message binding that ciphertext to the token it signed. When
|
|
292
|
+
the committee sealed one, the compound token carries three optional fields and the Verifier
|
|
293
|
+
Agent's poll reply carries the ciphertext BESIDE the token:
|
|
294
|
+
|
|
295
|
+
| Where | Field | What |
|
|
296
|
+
|---|---|---|
|
|
297
|
+
| `compound_token` | `evidence_hash` | `0x..` keccak256 of `bincode(ciphertext)` |
|
|
298
|
+
| `compound_token` | `evidence_key_id` | `0x..` keccak256 of the evidence key it is sealed to |
|
|
299
|
+
| `compound_token` | `evidence_signatures` | `[{verifier_index, signature}]` — each over `evidenceBindingMessage(tokenHash, evidenceHash, evidenceKeyId)` |
|
|
300
|
+
| poll reply | `evidence_ct` | base64url `bincode(ciphertext)` — surfaced as `evidenceCt` |
|
|
301
|
+
|
|
302
|
+
The three token fields come together or not at all (`assertCompoundTokenWire` refuses anything
|
|
303
|
+
else). They are NOT inside the token's signed canonical bytes, so `committee-token-vectors.json`
|
|
304
|
+
is unchanged. Hand `evidenceCt` to every keeper call (`committeeSign`, `committeeDecrypt`,
|
|
305
|
+
`requestIbeExtractionPartials` take an optional `evidenceCt`, posted as `evidence_ct`): a keeper
|
|
306
|
+
with `require_committee_evidence` refuses a token without it, and retains it so a mis-issuance
|
|
307
|
+
can be challenged. Nothing in the ciphertext is readable without a threshold of accountants.
|
|
308
|
+
`evidenceBindingMessage` / `verifyEvidenceBinding` (on `@t3foundry/tasra-sdk/committee`) mirror the
|
|
309
|
+
Rust functions and are pinned to `test/committee-evidence-vectors.json`.
|
|
310
|
+
|
|
311
|
+
## `@t3foundry/tasra-sdk/committee` — protocol internals
|
|
312
|
+
|
|
313
|
+
The compound-token layer — committee draw, canonical hashing, ed25519 quorum
|
|
314
|
+
verification, verifier-set Merkle proofs, wire codecs, and the
|
|
315
|
+
`/v1/committee-authorize` orchestration — lives behind its own subpath:
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
import {verifyCompoundToken, selectVerifierCommittee} from '@t3foundry/tasra-sdk/committee'
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
It also carries the derivations `platformAudience(origin, chainId)` and
|
|
322
|
+
`dpopHtu(origin, sessionId)` (+ `normalizeOrigin`, `isValidSessionId`,
|
|
323
|
+
`OAUTH_RESPONSE_PATH_PREFIX`/`_SUFFIX`), vector-pinned byte for byte
|
|
324
|
+
against `keykeeper-committee`'s `oauth` module (`test/dpop.ts`).
|
|
325
|
+
|
|
326
|
+
**Most consumers never need it.** Typed slots on `TasraClient` handle these
|
|
327
|
+
operations. Advanced integrations can use `createCommitteeSlotClient` from
|
|
328
|
+
`@t3foundry/tasra-sdk/chain`; reach for protocol primitives when implementing or auditing the
|
|
329
|
+
protocol itself.
|
|
330
|
+
|
|
331
|
+
These ~35 symbols are deep protocol internals — canonical hashing, Merkle proofs,
|
|
332
|
+
the committee draw, wire codecs — and they are **not** on the main entry, so
|
|
333
|
+
`import {…} from '@t3foundry/tasra-sdk'` autocompletes to the managed surface rather
|
|
334
|
+
than to `compoundTokenCanonicalBytes`.
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
[Back to the README](../README.md) · [Documentation index](README.md)
|