@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.
- 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
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
# @t3foundry/tasra-sdk/verifier-agent
|
|
2
|
+
|
|
3
|
+
Generated from public TypeScript exports.
|
|
4
|
+
|
|
5
|
+
[SDK reference](README.md) · [Task guides](../README.md) · [Errors](../errors.md)
|
|
6
|
+
|
|
7
|
+
## Classes
|
|
8
|
+
|
|
9
|
+
Clients, adapters and error classes.
|
|
10
|
+
|
|
11
|
+
<details>
|
|
12
|
+
<summary>Browse 1 classes</summary>
|
|
13
|
+
|
|
14
|
+
- [VerifierAgentSessionError](#verifieragentsessionerror)
|
|
15
|
+
|
|
16
|
+
</details>
|
|
17
|
+
|
|
18
|
+
### VerifierAgentSessionError
|
|
19
|
+
|
|
20
|
+
A Verifier Agent session did not produce a compound token. `kind` says why;
|
|
21
|
+
`retryable` is true only for `timeout` and `unavailable` - the session may
|
|
22
|
+
still complete, so poll again. Extends ` TasraError `.
|
|
23
|
+
|
|
24
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L134)
|
|
25
|
+
|
|
26
|
+
Import: `import {VerifierAgentSessionError} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
declare class VerifierAgentSessionError {
|
|
30
|
+
constructor(kind: VerifierAgentSessionErrorKind, correlation: string, message: string, httpStatus?: number);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- ` readonly kind: VerifierAgentSessionErrorKind; ` — Failure category used to select recovery behavior.
|
|
35
|
+
|
|
36
|
+
- ` readonly correlation: string; ` — The session id - safe to show and to log.
|
|
37
|
+
|
|
38
|
+
- ` readonly httpStatus?: number; ` — The HTTP status that produced a `protocol`/`unavailable` error, when there was one.
|
|
39
|
+
|
|
40
|
+
- ` readonly retryable: boolean; ` — `false` when retrying the identical request cannot succeed.
|
|
41
|
+
|
|
42
|
+
- ` name: string; `
|
|
43
|
+
|
|
44
|
+
- ` message: string; `
|
|
45
|
+
|
|
46
|
+
- ` stack?: string; `
|
|
47
|
+
|
|
48
|
+
- ` cause?: unknown; `
|
|
49
|
+
|
|
50
|
+
## Functions
|
|
51
|
+
|
|
52
|
+
Operations you can import and call.
|
|
53
|
+
|
|
54
|
+
<details>
|
|
55
|
+
<summary>Browse 9 functions</summary>
|
|
56
|
+
|
|
57
|
+
- [assertCompoundTokenWire](#assertcompoundtokenwire)
|
|
58
|
+
- [createOauthSession](#createoauthsession)
|
|
59
|
+
- [createOid4vpSession](#createoid4vpsession)
|
|
60
|
+
- [nextPollDelay](#nextpolldelay)
|
|
61
|
+
- [parseVerifierAgentSessionStatus](#parseverifieragentsessionstatus)
|
|
62
|
+
- [payloadDigest](#payloaddigest)
|
|
63
|
+
- [pollOid4vpSession](#polloid4vpsession)
|
|
64
|
+
- [submitOauthResponse](#submitoauthresponse)
|
|
65
|
+
- [waitForSession](#waitforsession)
|
|
66
|
+
|
|
67
|
+
</details>
|
|
68
|
+
|
|
69
|
+
### assertCompoundTokenWire
|
|
70
|
+
|
|
71
|
+
The compound token the verifier-agent hands back must be the wire shape the keepers verify -
|
|
72
|
+
checked field by field before anything is built on it.
|
|
73
|
+
|
|
74
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L162)
|
|
75
|
+
|
|
76
|
+
Import: `import {assertCompoundTokenWire} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
declare function assertCompoundTokenWire(raw: unknown, correlation: string): Record<string, unknown>;
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
| Parameter | Type | Description |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| ` raw ` | ` unknown ` | - Untrusted compound_token response value. |
|
|
85
|
+
| ` correlation ` | ` string ` | - Session identifier used to correlate validation errors. |
|
|
86
|
+
|
|
87
|
+
Returns: ` Record<string, unknown> `.
|
|
88
|
+
|
|
89
|
+
### createOauthSession
|
|
90
|
+
|
|
91
|
+
Open an `oauth` session - same creator authorisation, same committee draw, same
|
|
92
|
+
derived nonce, same poll contract as [createOid4vpSession](#createoid4vpsession). No QR, no Request
|
|
93
|
+
Object, no JWE key: the client presents an access token its own IdP minted.
|
|
94
|
+
|
|
95
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L278)
|
|
96
|
+
|
|
97
|
+
Import: `import {createOauthSession} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
declare function createOauthSession(verifierAgentUrl: string, params: CreateSessionParams): Promise<CreateOauthSessionResult>;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
| Parameter | Type | Description |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| ` verifierAgentUrl ` | ` string ` | - Verifier-agent HTTP base URL from the selected network manifest. |
|
|
106
|
+
| ` params ` | ` CreateSessionParams ` | - Signed operation, optional delegation and raw payload. |
|
|
107
|
+
|
|
108
|
+
Returns: ` Promise<CreateOauthSessionResult> `.
|
|
109
|
+
|
|
110
|
+
### createOid4vpSession
|
|
111
|
+
|
|
112
|
+
Create an OID4VP session on the Verifier Agent.
|
|
113
|
+
|
|
114
|
+
The verifier-agent derives a nonce, generates an ECDH key for JWE, and returns a QR
|
|
115
|
+
payload the wallet scans. The session ID and poll secret are used to poll
|
|
116
|
+
for the result.
|
|
117
|
+
|
|
118
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L238)
|
|
119
|
+
|
|
120
|
+
Import: `import {createOid4vpSession} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
declare function createOid4vpSession(verifierAgentUrl: string, params: CreateSessionParams): Promise<CreateSessionResult>;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
| Parameter | Type | Description |
|
|
127
|
+
|---|---|---|
|
|
128
|
+
| ` verifierAgentUrl ` | ` string ` | - Verifier-agent HTTP base URL from the selected network manifest. |
|
|
129
|
+
| ` params ` | ` CreateSessionParams ` | - Signed operation, optional delegation and raw payload. |
|
|
130
|
+
|
|
131
|
+
Returns: ` Promise<CreateSessionResult> `.
|
|
132
|
+
|
|
133
|
+
### nextPollDelay
|
|
134
|
+
|
|
135
|
+
The next polling delay: geometric growth (times1.5) capped at `max`, plus or minus20 % full jitter.
|
|
136
|
+
Pure, so the schedule is testable without timers.
|
|
137
|
+
|
|
138
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L499)
|
|
139
|
+
|
|
140
|
+
Import: `import {nextPollDelay} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
declare function nextPollDelay(previousMs: number, baseMs: number, maxMs: number, random?: () => number): number;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
| Parameter | Type | Description |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| ` previousMs ` | ` number ` | - Previous polling delay in milliseconds, or zero before the first poll. |
|
|
149
|
+
| ` baseMs ` | ` number ` | - Initial polling interval in milliseconds. |
|
|
150
|
+
| ` maxMs ` | ` number ` | - Maximum interval before jitter is applied. |
|
|
151
|
+
| ` random? ` | ` () => number ` | - Random source returning a value between zero and one. |
|
|
152
|
+
|
|
153
|
+
Returns: ` number `.
|
|
154
|
+
|
|
155
|
+
### parseVerifierAgentSessionStatus
|
|
156
|
+
|
|
157
|
+
Shared validation for the explicit-URL and registered-agent transports.
|
|
158
|
+
|
|
159
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L456)
|
|
160
|
+
|
|
161
|
+
Import: `import {parseVerifierAgentSessionStatus} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
declare function parseVerifierAgentSessionStatus(data: Record<string, unknown>, sessionId: string): SessionStatusResult;
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
| Parameter | Type | Description |
|
|
168
|
+
|---|---|---|
|
|
169
|
+
| ` data ` | ` Record<string, unknown> ` | - Untrusted JSON session response. |
|
|
170
|
+
| ` sessionId ` | ` string ` | - Session identifier used to correlate validation errors. |
|
|
171
|
+
|
|
172
|
+
Returns: ` SessionStatusResult `.
|
|
173
|
+
|
|
174
|
+
### payloadDigest
|
|
175
|
+
|
|
176
|
+
Compute the `payload_digest` for a given action and message.
|
|
177
|
+
|
|
178
|
+
For `sign` and `ibe-extract`, this is `sha256(message_bytes)` as 0x-hex.
|
|
179
|
+
Other actions should supply the digest directly.
|
|
180
|
+
|
|
181
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L215)
|
|
182
|
+
|
|
183
|
+
Import: `import {payloadDigest} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
declare function payloadDigest(action: string, messageHex: string): string;
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
| Parameter | Type | Description |
|
|
190
|
+
|---|---|---|
|
|
191
|
+
| ` action ` | ` string ` | - Operation name: sign and ibe-extract hash the supplied bytes. |
|
|
192
|
+
| ` messageHex ` | ` string ` | - Hexadecimal message bytes or an already computed digest for other actions. |
|
|
193
|
+
|
|
194
|
+
Returns: ` string `.
|
|
195
|
+
|
|
196
|
+
### pollOid4vpSession
|
|
197
|
+
|
|
198
|
+
Fetch and validate one authorization session status. Transport failures and HTTP 502, 503 or 504 produce an unavailable error; malformed or other failed replies produce a protocol error. The polling secret is sent in the Authorization header.
|
|
199
|
+
|
|
200
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L424)
|
|
201
|
+
|
|
202
|
+
Import: `import {pollOid4vpSession} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
declare function pollOid4vpSession(verifierAgentUrl: string, sessionId: string, pollSecret: string): Promise<SessionStatusResult>;
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
| Parameter | Type | Description |
|
|
209
|
+
|---|---|---|
|
|
210
|
+
| ` verifierAgentUrl ` | ` string ` | - Verifier-agent HTTP base URL. |
|
|
211
|
+
| ` sessionId ` | ` string ` | - Opened session identifier. |
|
|
212
|
+
| ` pollSecret ` | ` string ` | - Secret returned at session creation; do not expose it in logs. |
|
|
213
|
+
|
|
214
|
+
Returns: ` Promise<SessionStatusResult> `.
|
|
215
|
+
|
|
216
|
+
### submitOauthResponse
|
|
217
|
+
|
|
218
|
+
Submit a DPoP-bound access token and proof to an OAuth session. The signer must use the key bound to that token. Retry once when the server responds with a DPoP nonce challenge.
|
|
219
|
+
|
|
220
|
+
Speaks the RFC 9449 §9 resource-server contract — token in `Authorization: DPoP`, proof in
|
|
221
|
+
`DPoP:` — so a conformant client library needs no custom code. It also handles the
|
|
222
|
+
`use_dpop_nonce` challenge ITSELF: on a `401` carrying `DPoP-Nonce`, it re-mints the proof
|
|
223
|
+
with the server's nonce and resends ONCE. One retry, not a loop: a server that keeps
|
|
224
|
+
challenging is broken, and retrying forever would hide that.
|
|
225
|
+
|
|
226
|
+
`signer` must be the key the token is bound to — see `../auth/dpop.js` for the two shapes.
|
|
227
|
+
|
|
228
|
+
Note: the proof is signed over `dpopHtu` — the agent's PUBLIC origin plus this session's route,
|
|
229
|
+
as [createOauthSession](#createoauthsession) returned it — and posted to `verifierAgentUrl`. When the two
|
|
230
|
+
name the same host (the normal case) they are the same URL. When a client reaches the
|
|
231
|
+
agent through a different base URL, the proof must still name the public one: that is
|
|
232
|
+
the origin the verifiers approved.
|
|
233
|
+
|
|
234
|
+
Throws `VerifierAgentSessionError`: `refused` when the agent reports the session failed
|
|
235
|
+
(the committee refused, or could not be reached — `message` says which; not retryable on
|
|
236
|
+
this session), `unavailable` for other 502/503/504, `protocol` for any other non-2xx.
|
|
237
|
+
|
|
238
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L346)
|
|
239
|
+
|
|
240
|
+
Import: `import {submitOauthResponse} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
declare function submitOauthResponse(verifierAgentUrl: string, args: {
|
|
244
|
+
sessionId: string;
|
|
245
|
+
pollSecret: string;
|
|
246
|
+
accessToken: string;
|
|
247
|
+
nonce: string;
|
|
248
|
+
dpopHtu: string;
|
|
249
|
+
signer: DpopSigner;
|
|
250
|
+
}): Promise<void>;
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
| Parameter | Type | Description |
|
|
254
|
+
|---|---|---|
|
|
255
|
+
| ` verifierAgentUrl ` | ` string ` | - Verifier-agent HTTP base URL. |
|
|
256
|
+
| ` args ` | ` { sessionId: string; pollSecret: string; accessToken: string; nonce: string; dpopHtu: string; signer: DpopSigner; } ` | - Session credentials, DPoP-bound access token, nonce, `dpopHtu` and matching signer. |
|
|
257
|
+
|
|
258
|
+
Returns: ` Promise<void> `.
|
|
259
|
+
|
|
260
|
+
### waitForSession
|
|
261
|
+
|
|
262
|
+
Poll until the session reaches a terminal state (done or failed) - bounded by
|
|
263
|
+
`timeoutMs`, with a growing jittered interval so many clients never poll in lock-step.
|
|
264
|
+
A transient `unavailable` answer (a 503, a dropped connection) is retried within the
|
|
265
|
+
deadline; a `protocol` answer stops at once; the deadline is a `timeout` error; the
|
|
266
|
+
caller's `signal` is a `cancelled` error. A terminal `failed` is RETURNED (the caller
|
|
267
|
+
decides how to explain it) - see `awaitVerifierAgentResult` for the version that throws `refused`.
|
|
268
|
+
|
|
269
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L521)
|
|
270
|
+
|
|
271
|
+
Import: `import {waitForSession} from '@t3foundry/tasra-sdk/verifier-agent'`
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
declare function waitForSession(verifierAgentUrl: string, sessionId: string, pollSecret: string, intervalMs?: number, timeoutMs?: number, opts?: WaitOpts): Promise<SessionStatusResult>;
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
| Parameter | Type | Description |
|
|
278
|
+
|---|---|---|
|
|
279
|
+
| ` verifierAgentUrl ` | ` string ` | - Verifier-agent HTTP base URL. |
|
|
280
|
+
| ` sessionId ` | ` string ` | - Opened session identifier. |
|
|
281
|
+
| ` pollSecret ` | ` string ` | - bearer token returned by `createOid4vpSession` |
|
|
282
|
+
| ` intervalMs? ` | ` number ` | - initial polling interval in milliseconds (default 2000) |
|
|
283
|
+
| ` timeoutMs? ` | ` number ` | - total deadline in milliseconds (default 300000 = 5 min) |
|
|
284
|
+
| ` opts? ` | ` WaitOpts ` | - Cancellation, phase callback and polling backoff controls. |
|
|
285
|
+
|
|
286
|
+
Returns: ` Promise<SessionStatusResult> `.
|
|
287
|
+
|
|
288
|
+
## Types
|
|
289
|
+
|
|
290
|
+
Options, data structures and return types.
|
|
291
|
+
|
|
292
|
+
<details>
|
|
293
|
+
<summary>Browse 9 types</summary>
|
|
294
|
+
|
|
295
|
+
- [CreateOauthSessionResult](#createoauthsessionresult)
|
|
296
|
+
- [CreateSessionParams](#createsessionparams)
|
|
297
|
+
- [CreateSessionResult](#createsessionresult)
|
|
298
|
+
- [PresentationDelegation](#presentationdelegation)
|
|
299
|
+
- [PresentationOperation](#presentationoperation)
|
|
300
|
+
- [SessionPhase](#sessionphase)
|
|
301
|
+
- [SessionStatusResult](#sessionstatusresult)
|
|
302
|
+
- [VerifierAgentSessionErrorKind](#verifieragentsessionerrorkind)
|
|
303
|
+
- [WaitOpts](#waitopts)
|
|
304
|
+
|
|
305
|
+
</details>
|
|
306
|
+
|
|
307
|
+
### CreateOauthSessionResult
|
|
308
|
+
|
|
309
|
+
an `oauth` session - the client brings a DPoP-bound access token.
|
|
310
|
+
|
|
311
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L80)
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
export interface CreateOauthSessionResult {
|
|
315
|
+
sessionId: string;
|
|
316
|
+
pollSecret: string;
|
|
317
|
+
nonce: string;
|
|
318
|
+
dpopHtu: string;
|
|
319
|
+
platformAudience: string;
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Fields:
|
|
324
|
+
|
|
325
|
+
- **` sessionId `**: Opened authorization session identifier.
|
|
326
|
+
- **` pollSecret `**: Session secret used for polling and OAuth submission. Never expose it in logs.
|
|
327
|
+
- **` nonce `**: Initial DPoP challenge nonce for this session.
|
|
328
|
+
- **` dpopHtu `**: Canonical OAuth response URI to bind into the DPoP proof.
|
|
329
|
+
- **` platformAudience `**: Audience the identity provider must include in the access token for this platform.
|
|
330
|
+
|
|
331
|
+
### CreateSessionParams
|
|
332
|
+
|
|
333
|
+
Signed operation, optional delegation and payload submitted to the verifier agent.
|
|
334
|
+
|
|
335
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L56)
|
|
336
|
+
|
|
337
|
+
```ts
|
|
338
|
+
export interface CreateSessionParams {
|
|
339
|
+
operation: PresentationOperation;
|
|
340
|
+
operationSig: string;
|
|
341
|
+
delegation?: PresentationDelegation;
|
|
342
|
+
messageHex: string;
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Fields:
|
|
347
|
+
|
|
348
|
+
- **` operation `**: Signed operation details presented for authorization.
|
|
349
|
+
- **` operationSig `**: 0x-hex 65-byte EIP-712 signature over the operation
|
|
350
|
+
- **` delegation `**: Optional EIP-712 delegation from the slot creator
|
|
351
|
+
- **` messageHex `**: The raw payload as 0x-hex
|
|
352
|
+
|
|
353
|
+
### CreateSessionResult
|
|
354
|
+
|
|
355
|
+
Wallet presentation link and polling credentials for an opened authorization session.
|
|
356
|
+
|
|
357
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L68)
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
export interface CreateSessionResult {
|
|
361
|
+
sessionId: string;
|
|
362
|
+
pollSecret: string;
|
|
363
|
+
qrPayload: string;
|
|
364
|
+
requestUri: string;
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Fields:
|
|
369
|
+
|
|
370
|
+
- **` sessionId `**: Opened authorization session identifier.
|
|
371
|
+
- **` pollSecret `**: Bearer token for polling - treat as a secret
|
|
372
|
+
- **` qrPayload `**: OpenID4VP deep link for a wallet or QR code.
|
|
373
|
+
- **` requestUri `**: URL from which the wallet retrieves the signed request.
|
|
374
|
+
|
|
375
|
+
### PresentationDelegation
|
|
376
|
+
|
|
377
|
+
EIP-712 delegation from the slot creator to a delegate address.
|
|
378
|
+
|
|
379
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L38)
|
|
380
|
+
|
|
381
|
+
```ts
|
|
382
|
+
export interface PresentationDelegation {
|
|
383
|
+
chain_id: number;
|
|
384
|
+
slot_ids: string[];
|
|
385
|
+
delegate: string;
|
|
386
|
+
actions: string[];
|
|
387
|
+
exp: number;
|
|
388
|
+
nonce: number;
|
|
389
|
+
signature: string;
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Fields:
|
|
394
|
+
|
|
395
|
+
- **` chain_id `**: EVM chain identifier.
|
|
396
|
+
- **` slot_ids `**: Slot identifiers covered by this delegation.
|
|
397
|
+
- **` delegate `**: 0x-hex 20-byte delegate address
|
|
398
|
+
- **` actions `**: Operation names the delegate may authorize.
|
|
399
|
+
- **` exp `**: Expiration time in Unix seconds.
|
|
400
|
+
- **` nonce `**: Delegation nonce included in the signed payload.
|
|
401
|
+
- **` signature `**: 0x-hex 65-byte EIP-712 signature
|
|
402
|
+
|
|
403
|
+
### PresentationOperation
|
|
404
|
+
|
|
405
|
+
Operation details signed by a slot creator or delegate for credential authorization.
|
|
406
|
+
|
|
407
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L22)
|
|
408
|
+
|
|
409
|
+
```ts
|
|
410
|
+
export interface PresentationOperation {
|
|
411
|
+
chain_id: number;
|
|
412
|
+
slot_id: string;
|
|
413
|
+
action: string;
|
|
414
|
+
payload_digest: string;
|
|
415
|
+
description: string;
|
|
416
|
+
exp: number;
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
Fields:
|
|
421
|
+
|
|
422
|
+
- **` chain_id `**: EVM chain identifier.
|
|
423
|
+
- **` slot_id `**: 0x-hex 32-byte slot identifier
|
|
424
|
+
- **` action `**: "sign" | "decrypt" | "ibe-extract" | "dual-approve"
|
|
425
|
+
- **` payload_digest `**: 0x-hex 32-byte digest (sha256 of the message for sign/ibe-extract)
|
|
426
|
+
- **` description `**: Human-readable description shown in transaction_data
|
|
427
|
+
- **` exp `**: Unix timestamp - when the authorization expires
|
|
428
|
+
|
|
429
|
+
### SessionPhase
|
|
430
|
+
|
|
431
|
+
Displayable authorization progress. A done phase means the committee answered; it does not mean the requested signing or decryption operation executed.
|
|
432
|
+
|
|
433
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L94)
|
|
434
|
+
|
|
435
|
+
```ts
|
|
436
|
+
export type SessionPhase = 'awaiting_wallet' | 'verifying' | 'done' | 'failed';
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### SessionStatusResult
|
|
440
|
+
|
|
441
|
+
Authorization session progress and optional committee result or failure detail.
|
|
442
|
+
|
|
443
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L97)
|
|
444
|
+
|
|
445
|
+
```ts
|
|
446
|
+
export interface SessionStatusResult {
|
|
447
|
+
status: 'pending' | 'done' | 'failed';
|
|
448
|
+
phase: SessionPhase;
|
|
449
|
+
compoundToken?: Record<string, unknown>;
|
|
450
|
+
verifierProofs?: unknown;
|
|
451
|
+
bindingPreimage?: Record<string, unknown>;
|
|
452
|
+
error?: string;
|
|
453
|
+
evidenceCt?: string;
|
|
454
|
+
}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
Fields:
|
|
458
|
+
|
|
459
|
+
- **` status `**: Pending, completed or failed authorization state.
|
|
460
|
+
- **` phase `**: Displayable progress within the authorization lifecycle.
|
|
461
|
+
- **` compoundToken `**: Committee token returned after successful authorization.
|
|
462
|
+
- **` verifierProofs `**: Verifier membership proofs for the selected snapshot.
|
|
463
|
+
- **` bindingPreimage `**: Operation context used to derive the request-binding hash.
|
|
464
|
+
- **` error `**: Optional failure detail reported by the verifier agent.
|
|
465
|
+
- **` evidenceCt `**: the sealed presentation (base64url `bincode(Ciphertext)`) the token's `evidence_hash` names — post it to the keeper beside the token as `evidence_ct`.
|
|
466
|
+
|
|
467
|
+
### VerifierAgentSessionErrorKind
|
|
468
|
+
|
|
469
|
+
Why a session did not yield a token - the class the UI explains, with a NON-SECRET
|
|
470
|
+
correlation reference (the session id; the poll secret is never part of an error).
|
|
471
|
+
|
|
472
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L117)
|
|
473
|
+
|
|
474
|
+
```ts
|
|
475
|
+
export type VerifierAgentSessionErrorKind = 'timeout' | 'refused' | 'unavailable' | 'protocol' | 'cancelled';
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
### WaitOpts
|
|
479
|
+
|
|
480
|
+
Polling backoff, cancellation, progress callback and randomness options.
|
|
481
|
+
|
|
482
|
+
[Source](https://github.com/t3foundry/tasra-sdk/blob/develop/src/verifier-agent/index.ts#L479)
|
|
483
|
+
|
|
484
|
+
```ts
|
|
485
|
+
export interface WaitOpts {
|
|
486
|
+
maxIntervalMs?: number;
|
|
487
|
+
signal?: AbortSignal;
|
|
488
|
+
onPhase?: (phase: SessionPhase) => void;
|
|
489
|
+
random?: () => number;
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
Fields:
|
|
494
|
+
|
|
495
|
+
- **` maxIntervalMs `**: Ceiling for the growing interval (default 4 times intervalMs).
|
|
496
|
+
- **` signal `**: Cancel (a user closed the wallet prompt): rejects with `cancelled`.
|
|
497
|
+
- **` onPhase `**: Called on every poll with the phase the UI may show.
|
|
498
|
+
- **` random `**: Randomness for the jitter (tests inject a fixed value).
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Build an Ethereum account Alice and Bob can use
|
|
2
|
+
|
|
3
|
+
Create one shared Ethereum account, let Alice and Bob each send a transaction,
|
|
4
|
+
and verify that Mallory is refused. The app uses **@t3foundry/tasra-sdk as its only runtime
|
|
5
|
+
dependency**. It creates its own wallets, credentials and slot; no learner account,
|
|
6
|
+
private key, slot ID or CLI setup is copied from another project.
|
|
7
|
+
|
|
8
|
+
Install the latest SDK from npm in step 2. Check [deployment compatibility](compatibility.md)
|
|
9
|
+
before running the app.
|
|
10
|
+
|
|
11
|
+
## 1. Prepare the network connection
|
|
12
|
+
|
|
13
|
+
Install Node.js **22.12+** (24 recommended). The example downloads the testnet
|
|
14
|
+
pointer and manifest from [tasra-releases](https://github.com/t3foundry/tasra-releases)
|
|
15
|
+
and checks the manifest checksum. It resolves the RPC, contracts and verifier from
|
|
16
|
+
that configuration, with an explicit `lowest-operator-id` coordinator convention.
|
|
17
|
+
|
|
18
|
+
The selected deployment must support tECDSA key generation, creator-signed rule
|
|
19
|
+
provisioning, OID4VP authorization and transaction signing. This example requests
|
|
20
|
+
2-of-3 keepers and a 2-of-3 verifier policy, using SD-JWT credentials bound to
|
|
21
|
+
fresh `did:jwk` identities. A manifest or registry check does not establish support
|
|
22
|
+
for those operations. Any deployment-specific usage credits must also be available.
|
|
23
|
+
|
|
24
|
+
The application generates its own creator wallet and prints its public address.
|
|
25
|
+
Fund it with AVAX using the [official Fuji C-Chain faucet](https://core.app/tools/testnet-faucet/?subnet=c&token=c) or a wallet you control. No shared private
|
|
26
|
+
key or precreated learner account is required.
|
|
27
|
+
|
|
28
|
+
## 2. Create your application
|
|
29
|
+
|
|
30
|
+
In a new terminal, create the project and install the latest SDK from npm:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
mkdir my-shared-account
|
|
34
|
+
cd my-shared-account
|
|
35
|
+
npm init -y
|
|
36
|
+
npm pkg set type=module
|
|
37
|
+
npm install @t3foundry/tasra-sdk@latest
|
|
38
|
+
npm install --save-dev typescript tsx @types/node
|
|
39
|
+
cp node_modules/@t3foundry/tasra-sdk/examples/shared-account.ts app.ts
|
|
40
|
+
cp node_modules/@t3foundry/tasra-sdk/examples/tutorial-support.ts tutorial-support.ts
|
|
41
|
+
cp node_modules/@t3foundry/tasra-sdk/examples/tutorial-negative.ts tutorial-negative.ts
|
|
42
|
+
cp node_modules/@t3foundry/tasra-sdk/examples/network.ts network.ts
|
|
43
|
+
cp node_modules/@t3foundry/tasra-sdk/examples/fund-slot.ts .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
These copy commands use a macOS/Linux shell or WSL. You can copy
|
|
47
|
+
the same files with your IDE. Open `app.ts`: it contains the slot, credential and
|
|
48
|
+
wallet operations. `tutorial-support.ts` supplies shared network and identity setup and
|
|
49
|
+
public evidence output; `tutorial-negative.ts` exercises verifier rejection.
|
|
50
|
+
The SDK implements slot orchestration, credential creation and wallet signing.
|
|
51
|
+
|
|
52
|
+
Save **`.gitignore`** with this line:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
.tasra/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Save **`tsconfig.json`**:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"compilerOptions": {
|
|
63
|
+
"target": "ES2022",
|
|
64
|
+
"module": "NodeNext",
|
|
65
|
+
"moduleResolution": "NodeNext",
|
|
66
|
+
"resolveJsonModule": true,
|
|
67
|
+
"strict": true,
|
|
68
|
+
"skipLibCheck": true,
|
|
69
|
+
"noEmit": true,
|
|
70
|
+
"types": ["node"]
|
|
71
|
+
},
|
|
72
|
+
"include": ["*.ts"]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 3. Check and execute
|
|
77
|
+
|
|
78
|
+
Before protected operations, the terminal example pauses for **TSRA usage credit**.
|
|
79
|
+
In a second terminal in the same project, run its printed `fund-slot.ts ... status`
|
|
80
|
+
command. Follow [Fund a slot](funding.md) to obtain EURC, buy TSRA from BondingCurve,
|
|
81
|
+
and deposit TSRA into the printed slot. Replace `.tasra/first-slot` in those commands
|
|
82
|
+
with this app's printed directory. Fund every new slot; creator AVAX pays gas and
|
|
83
|
+
does not provide usage credits. The app waits up to 15 minutes per slot.
|
|
84
|
+
|
|
85
|
+
First typecheck the app (the same command on macOS, Linux and Windows):
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
npx tsc --noEmit
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Run the application:
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
npx tsx network.ts
|
|
95
|
+
npx tsx app.ts
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The app prints its creator address and chain, then waits up to 15 minutes for
|
|
99
|
+
at least 0.05 AVAX. In a separate window, use the network’s faucet or transfer
|
|
100
|
+
native tokens from a wallet you control. Fund the printed address on the printed chain. The
|
|
101
|
+
creator pays setup transactions and funds the shared account's transaction gas.
|
|
102
|
+
|
|
103
|
+
Key generation and threshold signing can take time. The app records the shared
|
|
104
|
+
account address, Alice's and Bob's confirmed transactions, and Mallory's refusal.
|
|
105
|
+
It prints the evidence location at the end.
|
|
106
|
+
|
|
107
|
+
Each invocation starts a fresh demonstration with a **new slot** and isolated
|
|
108
|
+
private store. An interrupted invocation is not resumed by starting the tutorial
|
|
109
|
+
again. Preserve its store and reconcile any pending transactions first. The SDK's
|
|
110
|
+
named operations support resuming the same intent when your application reopens
|
|
111
|
+
the same store; see [recovery boundaries](application-api.md#recovery-boundaries).
|
|
112
|
+
|
|
113
|
+
## 4. Read the application
|
|
114
|
+
|
|
115
|
+
| Step | Application API | Result |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| Connect | `new TasraClient({manifest, store})` | Public deployment configuration and private durable state. |
|
|
118
|
+
| Create users | `tasra.identities.create`, `tasra.credentials.issue` | A fresh issuer and separate holder-bound credentials. |
|
|
119
|
+
| Define access | `tasra.credentials.policy` | Only the intended credential holders can request signing. |
|
|
120
|
+
| Create the account | `tasra.slots.create` with `mode: 'ecdsa'` | Commitment, creation, key generation and rule provisioning handled by the SDK. |
|
|
121
|
+
| Send transactions | `tasra.credentials.authorize`, `tasra.wallets.fromSlot`, `transfer` | Each exact transaction is authorized, signed and confirmed. |
|
|
122
|
+
| Check refusal | The separate negative-test helper submits a nonmatching presentation | The verifier refuses Mallory and the account nonce does not change. |
|
|
123
|
+
|
|
124
|
+
Two of three **keepers** cooperate to sign. Either authorized **user**, Alice or
|
|
125
|
+
Bob, may initiate a transaction; this is not a two-user approval workflow.
|
|
126
|
+
The app submits zero-value self-transfers with nonces `0` and `1` from the same
|
|
127
|
+
account. It checks the receipts and verifies that Mallory's request leaves the
|
|
128
|
+
nonce at `2`. The refusal must come from the verifier; local credential filtering
|
|
129
|
+
is not counted as server-side evidence.
|
|
130
|
+
|
|
131
|
+
For two people approving one signature, use [native approvals](native-approvals.md).
|
|
132
|
+
For two independent document signatures, use [document signing](document-signing.md).
|
|
133
|
+
|
|
134
|
+
## 5. Check the results
|
|
135
|
+
|
|
136
|
+
Open the printed run directory:
|
|
137
|
+
|
|
138
|
+
- `evidence.json`: the slot/account, confirmed transactions and verifier-refusal result.
|
|
139
|
+
- `alice-receipt.json` and `bob-receipt.json`: the actual chain receipts.
|
|
140
|
+
|
|
141
|
+
The evidence records public account activity. The rest of `.tasra/` contains
|
|
142
|
+
private identities, credentials and recovery state. Share only reviewed evidence
|
|
143
|
+
files, never the entire directory.
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
## If it stops
|
|
149
|
+
|
|
150
|
+
| Symptom | Next action |
|
|
151
|
+
|---|---|
|
|
152
|
+
| Cannot import `@t3foundry/tasra-sdk/app` | Run `npm install @t3foundry/tasra-sdk@latest` inside your app directory. |
|
|
153
|
+
| Missing configuration or helper file | Copy every file listed in step 2 and run from the app folder. |
|
|
154
|
+
| Connection refused | Check RPC access and the downloaded release manifest. |
|
|
155
|
+
| Certificate verification failure | Check the service certificate and system trust; keep TLS verification enabled. |
|
|
156
|
+
| Slot is not ready | Inspect its DKG status and preserve the private store. |
|
|
157
|
+
| No keeper accepted the rule | Confirm creator-signed provisioning support and the selected deployment identity. |
|
|
158
|
+
| Authorization refused for Alice/Bob | Check issuer and verifier compatibility; a denial is not a connectivity retry. |
|
|
159
|
+
| Submission outcome is uncertain | Reconcile the recorded hash before retrying; do not discard the journal. |
|
|
160
|
+
|
|
161
|
+
[Application source](../examples/shared-account.ts) ·
|
|
162
|
+
[Application API](application-api.md) · [Documentation index](README.md)
|
|
163
|
+
|
|
164
|
+
`npx tsx network.ts` saves the verified manifest and its checksum pin. Keep both
|
|
165
|
+
files with the application so restarts use the same deployment. The examples use
|
|
166
|
+
`lowest-operator-id` as the explicit coordinator convention; confirm it matches
|
|
167
|
+
the selected service. Fund each newly printed creator address with at least 0.05
|
|
168
|
+
AVAX on Fuji before continuing; more may be needed if gas costs rise.
|