@invisible-labs/sdk 0.6.0-devnet.1 → 0.6.0-devnet.3

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 (41) hide show
  1. package/README.md +141 -173
  2. package/dist/{chunk-TQNNTV5F.js → chunk-4X5OCCQW.js} +3 -3
  3. package/dist/{chunk-TQNNTV5F.js.map → chunk-4X5OCCQW.js.map} +1 -1
  4. package/dist/{chunk-7DSVN3MV.js → chunk-BWCGNTN5.js} +13 -5
  5. package/dist/chunk-BWCGNTN5.js.map +1 -0
  6. package/dist/{chunk-NCY4FCYU.js → chunk-DIA6U2CV.js} +19 -3
  7. package/dist/chunk-DIA6U2CV.js.map +1 -0
  8. package/dist/{chunk-OHIM2YWU.js → chunk-GHBQF3A7.js} +2 -2
  9. package/dist/chunk-GHBQF3A7.js.map +1 -0
  10. package/dist/{chunk-SZAYO2L5.js → chunk-NHEHCUS5.js} +3 -3
  11. package/dist/{chunk-SZAYO2L5.js.map → chunk-NHEHCUS5.js.map} +1 -1
  12. package/dist/{chunk-LBC7ALYO.js → chunk-NKRVQXRP.js} +58 -3
  13. package/dist/chunk-NKRVQXRP.js.map +1 -0
  14. package/dist/{chunk-XUWBGET5.js → chunk-QQSI3ZD7.js} +23 -7
  15. package/dist/chunk-QQSI3ZD7.js.map +1 -0
  16. package/dist/{chunk-JRMKCE3S.js → chunk-V5HXJRBW.js} +3 -3
  17. package/dist/{chunk-JRMKCE3S.js.map → chunk-V5HXJRBW.js.map} +1 -1
  18. package/dist/{coordinator-7Y45MCCZ.js → coordinator-VVJ33WF2.js} +3 -3
  19. package/dist/{coordinator-7Y45MCCZ.js.map → coordinator-VVJ33WF2.js.map} +1 -1
  20. package/dist/{createSession-D3ym-Ira.d.ts → errors-N2touVm4.d.ts} +2 -54
  21. package/dist/events.js +3 -3
  22. package/dist/index.d.ts +60 -4
  23. package/dist/index.js +7 -7
  24. package/dist/lp.d.ts +8 -1
  25. package/dist/lp.js +109 -22
  26. package/dist/lp.js.map +1 -1
  27. package/dist/presets.d.ts +3 -3
  28. package/dist/presets.js +13 -6
  29. package/dist/presets.js.map +1 -1
  30. package/dist/stats.js +1 -1
  31. package/dist/storage.js +1 -1
  32. package/dist/{types.generated-CHGSbmLp.d.ts → types.generated-BSEBz4jR.d.ts} +1 -0
  33. package/dist/user.d.ts +26 -143
  34. package/dist/user.js +42 -30
  35. package/dist/user.js.map +1 -1
  36. package/package.json +8 -5
  37. package/dist/chunk-7DSVN3MV.js.map +0 -1
  38. package/dist/chunk-LBC7ALYO.js.map +0 -1
  39. package/dist/chunk-NCY4FCYU.js.map +0 -1
  40. package/dist/chunk-OHIM2YWU.js.map +0 -1
  41. package/dist/chunk-XUWBGET5.js.map +0 -1
package/README.md CHANGED
@@ -1,210 +1,178 @@
1
1
  # @invisible-labs/sdk
2
2
 
3
- Frontend-integration TypeScript SDK for the Invisible protocol.
3
+ TypeScript SDK for building private SOL transfer integrations with Invisible.
4
4
 
5
- This package is the single programmatic entrypoint for every user and LP
6
- interaction with an attested Invisible coordinator. It is the contract defined
7
- in [docs/sdk-specification.md](../../docs/sdk-specification.md). The current
8
- build exposes both the functional normal-user pre-deposit request and the
9
- frontend coordinator facade.
5
+ [Documentation](https://docs.invisible.exchange/docs/sdk/) ·
6
+ [Quickstart](https://docs.invisible.exchange/docs/sdk/quickstart/) ·
7
+ [API reference](https://docs.invisible.exchange/docs/sdk/reference/) ·
8
+ [Trust model](https://docs.invisible.exchange/docs/security/)
10
9
 
11
- > Status: **frontend integration SDK**. The attested `/ws-noise` session,
12
- > normal-user contract request and coordinator session, and LP lifecycle helpers
13
- > are functional. Target surfaces that are not wired to the live coordinator
14
- > still throw `NotImplementedError`; no command fakes success.
10
+ > Devnet beta. This release targets Solana devnet. APIs may change before a stable release.
15
11
 
16
- ## Entrypoints
17
-
18
- | Import | Covers |
19
- | ----------------------------- | ----------------------------------------------------- |
20
- | `@invisible-labs/sdk` | `createSession`, attestation and coordinator controls |
21
- | `@invisible-labs/sdk/user` | normal-user commands (private transfer) |
22
- | `@invisible-labs/sdk/lp` | liquidity-provider lifecycle |
23
- | `@invisible-labs/sdk/stats` | actor-safe read projections |
24
- | `@invisible-labs/sdk/events` | sync subscriptions |
25
- | `@invisible-labs/sdk/storage` | storage adapters |
26
- | `@invisible-labs/sdk/presets` | optional Invisible coordinator endpoint presets |
12
+ This package is the programmatic entrypoint for user and LP interaction with an attested Invisible
13
+ coordinator. The normal-user surface uses one functional sequence over a caller-owned session:
14
+ `createSession`, `contractRequest`, `sync`, `requestRefund`, then `closeSession`.
27
15
 
28
- Each actor entrypoint is independently importable; pulling one in must not drag
29
- the others into a consumer bundle.
16
+ ## Install
30
17
 
31
- See [ARCHITECTURE.md](./ARCHITECTURE.md) for the layered module map (mermaid).
18
+ ```bash
19
+ npm install @invisible-labs/sdk@devnet
20
+ ```
32
21
 
33
- ## Private-transfer amount limits
22
+ ## Entrypoints
34
23
 
35
- Use the public user-entry constants for inclusive preflight validation. Values
36
- are expressed in lamports, matching the `amountLamports` request field.
24
+ | Import | Covers |
25
+ | ----------------------------- | ------------------------------------------------------ |
26
+ | `@invisible-labs/sdk` | `createSession`, attestation, and coordinator controls |
27
+ | `@invisible-labs/sdk/user` | normal-user commands: private transfer, sync, refund |
28
+ | `@invisible-labs/sdk/lp` | liquidity-provider lifecycle |
29
+ | `@invisible-labs/sdk/stats` | actor-safe read projections |
30
+ | `@invisible-labs/sdk/events` | sync subscriptions |
31
+ | `@invisible-labs/sdk/storage` | storage adapters |
32
+ | `@invisible-labs/sdk/presets` | optional coordinator endpoint presets |
37
33
 
38
- ```ts
39
- import { MAX_ENTRY_AMOUNT_LAMPORTS, MIN_ENTRY_AMOUNT_LAMPORTS } from "@invisible-labs/sdk/user";
34
+ Each actor entrypoint is independently importable; pulling one in must not drag the others into a
35
+ consumer bundle. See [ARCHITECTURE.md](./ARCHITECTURE.md) for the layered module map.
40
36
 
41
- const isValidEntryAmount = (amountLamports: number) =>
42
- amountLamports >= MIN_ENTRY_AMOUNT_LAMPORTS && amountLamports <= MAX_ENTRY_AMOUNT_LAMPORTS;
43
- ```
37
+ ## Private transfer
44
38
 
45
- ## Quickstart
39
+ The canonical normal-user flow uses one attested session and the functional SDK commands:
46
40
 
47
41
  ```ts
48
- import { createCoordinatorSession } from "@invisible-labs/sdk/user";
42
+ import { closeSession, createSession } from "@invisible-labs/sdk";
43
+ import {
44
+ contractRequest,
45
+ recoveryCodeFromHex,
46
+ requestRefund,
47
+ sync,
48
+ } from "@invisible-labs/sdk/user";
49
49
 
50
50
  const coordinator = {
51
51
  endpoints: [
52
52
  /* CoordinatorEndpoint[] - supply your own, or use @invisible-labs/sdk/presets */
53
53
  ],
54
54
  };
55
+ const payoutPolicy = {
56
+ destinations: [{ address: receiverPublicKey, sharePercent: 100 }],
57
+ totalDeadlineMs: 0,
58
+ };
59
+
60
+ const session = await createSession({ coordinator });
61
+ try {
62
+ const contract = await contractRequest(session, {
63
+ amountLamports: 3_000_000_000,
64
+ payoutPolicy,
65
+ });
66
+ const status = await sync(session, contract.swapId, contract.syncSecret);
67
+ console.log(status.state, status.coordinatorTimestampMs);
68
+
69
+ if (status.actor_sync?.snapshot.refundability === "available_now") {
70
+ const receipt = await requestRefund(session, {
71
+ recoveryCode: recoveryCodeFromHex(contract.recoveryCodeHex!),
72
+ });
73
+ console.log(receipt.requestId, receipt.amountLamports);
74
+ }
75
+ } finally {
76
+ closeSession(session);
77
+ }
78
+ ```
79
+
80
+ `contractRequest` resolves after durable delegation and before the deposit is observed. Its result
81
+ contains `swapId`, `depositAddress`, `depositExpiresAtMs`, `syncSecret`, and the generated Recovery
82
+ Code. Persist the sync secret and Recovery Code before asking the user to deposit. Send exactly
83
+ `amountLamports` to the deposit address. The `sync` response contains actor-scoped lifecycle truth
84
+ and the coordinator response timestamp; it does not expose an internal payout due timestamp. A
85
+ refund receipt also carries the coordinator-authoritative accepted amount; use that value for
86
+ pending refund accounting and use `sync` for final landing, cancellation, and fee-loss outcomes.
87
+
88
+ ## Private-transfer amount limits
55
89
 
56
- const user = createCoordinatorSession({ coordinator });
90
+ Use the public user-entry constants for inclusive preflight validation. Values are expressed in
91
+ lamports, matching the `amountLamports` request field. The current V0 bounds are `1.5 SOL`
92
+ (`1_500_000_000` lamports) minimum and `100 SOL` (`100_000_000_000` lamports) maximum.
93
+ The SDK rejects non-safe integers and values outside these bounds before sending a coordinator
94
+ request.
57
95
 
58
- await user.runSwap({ amountLamports: 3_000_000_000, payoutSpec });
96
+ ```ts
97
+ import { MAX_ENTRY_AMOUNT_LAMPORTS, MIN_ENTRY_AMOUNT_LAMPORTS } from "@invisible-labs/sdk/user";
98
+
99
+ const isValidEntryAmount = (amountLamports: number) =>
100
+ Number.isSafeInteger(amountLamports) &&
101
+ amountLamports >= MIN_ENTRY_AMOUNT_LAMPORTS &&
102
+ amountLamports <= MAX_ENTRY_AMOUNT_LAMPORTS;
59
103
  ```
60
104
 
61
- The quickstart above is the full normal-user transfer path. For a bot or server
62
- integration that owns the deposit step, use `contractRequest` from
63
- `@invisible-labs/sdk/user`. It resolves after durable delegation and returns
64
- `swapId`, `depositAddress`, `depositExpiresAtMs`, `syncSecret`, and the generated
65
- Recovery Code before waiting for a deposit. Set `payoutPolicy.totalDeadlineMs`
66
- to `0` for instant payout, or to `3_600_000`, `86_400_000`, or `604_800_000`
67
- milliseconds for the supported 1-hour, 24-hour, or 7-day scheduled windows.
68
-
69
- ## What is real vs NO-OP today
70
-
71
- Real and usable now:
72
-
73
- - `createSession` opens a live WebSocket, runs Noise XX, verifies TDX
74
- attestation, and returns an attested `Session`.
75
- - `createCoordinatorSession` in `@invisible-labs/sdk/user` drives the normal-user
76
- contract, sync, refund-withdrawal, and event flow used by the web app.
77
- - The functional `contractRequest`, `requestRefund`, and `sync` exports in
78
- `@invisible-labs/sdk/user` send the same normal-user protocol commands on a
79
- caller-owned attested session.
80
- - `createLpLifecycleClient` and the LP free functions in `@invisible-labs/sdk/lp`
81
- drive position open/recover, DKG, funding, refill, withdrawal, confirmation,
82
- and listing. Lower-level LP coordinator and DKG helpers remain available.
83
- - Input validation: `PayoutPolicy` and LP plan checks throw `PolicyValidationError`;
84
- LP client-side lifecycle states throw `LpLifecycleError`.
85
- - The closed `InvisibleError` taxonomy and `normalizeError`.
86
- - `coordinator.endpoints`, `attestation.current` / `policy` (read-only).
87
- - `stats.derivedRefundableLamports` (pure local computation).
88
- - `inMemoryStorage`, `browserStorage`, `extensionStorage`; the `presets`
89
- endpoint helpers.
90
- - `presets.invisibleDevnet(approvedBinaryHash)` targets the public devnet through
91
- the hardened Azure coordinator in prod mode with the release MRTD, Intel root,
92
- MAA, and exact coordinator binary hash pins. The approved 64-hex binary hash
93
- is required at preset construction; no unapproved default is embedded.
94
-
95
- Deferred (throws `NotImplementedError` until each target surface is finalized):
96
-
97
- - Spec-level user free functions other than the live `contractRequest`,
98
- `requestRefund`, and `sync` functions, actor-safe stats, and `events`
99
- subscriptions when they are not the frontend-facing coordinator helpers
100
- listed above.
101
- - Server-HKDF storage. The current web app keeps its local recovery material in
102
- its persisted app store; SDK consumers can choose their own storage controls.
103
-
104
- Before public npm distribution, the remaining deferred functions will either be
105
- wired to the coordinator helpers or removed from the published surface.
105
+ ## Live and deferred surfaces
106
+
107
+ Live today:
108
+
109
+ - `createSession` opens a live WebSocket, runs Noise XX, verifies TDX attestation, and returns an
110
+ attested `Session`.
111
+ - `contractRequest`, `sync`, and `requestRefund` are the only normal-user command path over a
112
+ caller-owned attested session. `closeSession` ends the flow.
113
+ - LP lifecycle helpers drive position open/recover, DKG, funding, refill, withdrawal, confirmation,
114
+ and listing.
115
+ - Input validation throws typed `PolicyValidationError`; the closed `InvisibleError` taxonomy and
116
+ `normalizeError` are available to callers.
117
+
118
+ Other target surfaces throw `NotImplementedError` until each is finalized. No command fakes success.
106
119
 
107
120
  ## Recovery material and storage
108
121
 
109
- The SDK does not yet persist recovery material automatically from
110
- `createSession`. Consumers that need restart or tab-close recovery must keep the
111
- relevant values themselves, using SDK storage helpers or their own storage layer:
122
+ The SDK does not persist recovery material automatically. Consumers that need restart or tab-close
123
+ recovery must store the relevant values themselves:
124
+
125
+ | Material | Needed for | Guidance |
126
+ | ----------------------- | ----------------------------------------------- | ------------------------------------------------------- |
127
+ | `swapId` + `syncSecret` | Re-sync a private-transfer status view | Persist before asking the user to deposit. |
128
+ | User Recovery Code | Request an origin-bound private-transfer refund | Treat it like a seed phrase and persist it immediately. |
129
+ | LP Position Code | Recover and operate an LP position | Keep it out of logs and treat it like a seed phrase. |
112
130
 
113
- | Material | Needed for | Current guidance |
114
- | ----------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
115
- | `swapId` + `syncSecret` | Re-sync a private-transfer status view. | `contractRequest` returns both values and supports `onSyncSecretReady({ secretHex })`; store them before asking the user to deposit. |
116
- | User Recovery Code | Request an origin-bound private-transfer refund. | Persist `onRecoveryCodeReady({ codeHex })` immediately, or pass caller-managed recovery material. Products with stricter local-storage requirements can encrypt it. |
117
- | LP Position Code | Recover and operate an LP position. | Treat like a seed phrase. The SDK keeps derived LP auth only in memory. |
131
+ The web app persists private-transfer recovery material locally so users can resume flows. SDK
132
+ consumers can choose `browserStorage`, `extensionStorage`, or their own encrypted storage layer.
118
133
 
119
- The Invisible web app currently persists private-transfer `refundCode` and
120
- `syncSecret` locally so users can resume flows. That is the current product
121
- tradeoff. Integrators can use `browserStorage` or `extensionStorage` as local
122
- byte stores, or they can pre-encrypt/wrap values before storing them if their
123
- product requires that.
134
+ LP DKG requests are bounded. If a browser worker stops responding, the SDK terminates the local
135
+ workers and attempts the signed position-scoped DKG abort command within a bounded cleanup window
136
+ before returning the original failure. LP recovery sends the same cleanup command for an
137
+ incomplete position, so a reload does not wait for the coordinator's session expiry.
124
138
 
125
- Server integrations can keep raw recovery material in their own database/vault,
126
- or derive material from a master secret with domain-separated HKDF. For
127
- pre-acceptance material such as `syncSecret`, use a stable context available
128
- before the coordinator receives `sync_commitment`; `swapId` is only available
129
- after acceptance.
139
+ ## Security model
140
+
141
+ The SDK establishes an encrypted Noise XX channel and verifies TDX attestation before sensitive
142
+ protocol material is sent. Verification failures stop the session. Integrators remain responsible
143
+ for loading coordinator measurements from an approved release source, protecting Recovery Codes and
144
+ sync secrets, persisting recovery material before deposit, using fresh payout destinations, and
145
+ handling reconnects through `sync` instead of blindly repeating commands.
146
+
147
+ Invisible is trust-minimized, not trustless. Attestation verifies an approved coordinator build; it
148
+ does not prove that the code is bug-free. Privacy can be weakened by low pool depth, timing, amount
149
+ correlation, destination reuse, and off-chain metadata.
150
+
151
+ ## Devnet limitations
152
+
153
+ - Solana devnet and SOL only.
154
+ - No settlement SLA.
155
+ - Current normal-user transfers support one payout destination.
156
+ - Availability and privacy strength depend on current pool conditions.
157
+ - Some documented target APIs are not yet available in the devnet beta.
158
+
159
+ Use only APIs marked as live in the [current reference](https://docs.invisible.exchange/docs/sdk/reference/).
130
160
 
131
161
  ## Not in this SDK
132
162
 
133
- Protocol-fee (admin) payout is deliberately **out of scope** for the SDK. It
134
- lives in a separate, fully isolated, non-public admin frontend. See
135
- [ADR-0120](../../docs/adr/0120-protocol-fee-payout-lives-in-isolated-admin-frontend.md).
136
-
137
- ## Packaging and publishing
138
-
139
- The package is bundled with [tsup](./tsup.config.ts) into a **self-contained
140
- artifact** so it can be installed by an external consumer that has none of this
141
- monorepo's workspace links:
142
-
143
- - The three workspace-internal packages (`@invisible/shared`, `protocol`,
144
- `frost`) are `file:` deps that npm does not rewrite on publish. They are
145
- **inlined** into `dist` (`noExternal`) and live in `devDependencies`, so the
146
- published runtime `dependencies` contain zero `file:` specifiers.
147
- - The **FROST wasm** is inlined into the bundle. The SDK uses a swappable wasm
148
- loader: from source the web app and vitest use
149
- [`frostWasm.dev.ts`](./src/frost/frostWasm.dev.ts) (Vite-friendly asset URL /
150
- Node `file:` read), while tsup swaps in
151
- [`frostWasm.bundled.ts`](./src/frost/frostWasm.bundled.ts) (esbuild `binary`
152
- loader -> inlined bytes) for the published artifact, so there is no runtime
153
- asset path or `import.meta.url` resolution to break in a consumer's bundler.
154
- - Only published third-party packages (`ajv`, `@peculiar/x509`, `@stablelib/*`)
155
- stay external and are declared in `dependencies`.
163
+ Protocol-fee admin payout is out of scope for the SDK. It lives behind a separate admin surface.
164
+
165
+ ## Packaging
166
+
167
+ The package is bundled with tsup into a self-contained artifact. Workspace-internal packages and the
168
+ FROST WASM are inlined into the published bundle, while published third-party packages remain
169
+ external dependencies.
156
170
 
157
171
  ```bash
158
- npm run prepare:frost # build or restore frost/pkg for SDK source/bundling
159
- npm run build # tsup: bundled dist + .d.ts
160
- npm run verify:exports # assert exports, bundled dist, and FROST wasm init
161
- npm run smoke:prod-attestation -- --host tee-azure.invisible.exchange --mrtd <96-hex> --binary-hash <64-hex-approved> --azure-maa-issuer <https-url> --azure-maa-jwks-url <https-url> --azure-maa-policy-hash <base64url>
162
- npm run smoke:publish # publish -> install -> typecheck -> import on Verdaccio
163
- npm run publish:public:noop # credential-free public manifest validation
164
- VERSION=<version> NPM_DIST_TAG=devnet npm run publish:public -- --confirm @invisible-labs/sdk@<version>
172
+ npm run build
173
+ npm run verify:exports
165
174
  ```
166
175
 
167
- The SDK `build` and `prepack` scripts run `prepare:frost` first, so direct
168
- package builds, `smoke:publish`, and `publish:private` are hermetic from a clean
169
- checkout. In GitHub CI, the first SDK preparation uses the clean FROST WASM
170
- build path, then later SDK build/pack guards in the same job reuse that prepared
171
- artifact. From the repository root, `npm run test:sdk` uses the same SDK
172
- preparer before typecheck, tests, conformance, bundle, export check, and pack
173
- dry-run. The export check also rejects unresolved workspace imports, rejects the
174
- source-only FROST wasm loader path in built `dist`, and instantiates the bundled
175
- FROST wasm once through `dkgRound1`.
176
- `smoke:prod-attestation` also builds first, then verifies a live production
177
- coordinator with `createSession`, `requiredMode=prod`, the supplied MRTD and
178
- approved binary hash pins, Azure MAA pins, and mandatory DCAP collateral.
179
-
180
- ### Publish flow (Verdaccio -> GitHub Packages -> npmjs)
181
-
182
- The package manifest is public-publishable, but public npmjs publication remains
183
- manual. Private GitHub Packages publishing still stages a versioned copy under
184
- `@invisible-labs/sdk`. The progression, each step gated on the previous one
185
- passing:
186
-
187
- 1. **Local (Verdaccio).** `npm run smoke:publish` boots a throwaway local
188
- registry, stages a publishable copy (private flag flipped, unique test
189
- version), publishes it, then installs, typechecks, and imports it from a
190
- clean consumer project. Zero external footprint. Use this to confirm the
191
- tarball works.
192
- 2. **Private remote (GitHub Packages).** Intermediate validation against a real
193
- remote without going public. The executable path is `publish:private`, which
194
- stages the workspace package as `@invisible-labs/sdk` because GitHub Packages
195
- requires the package scope to match the `Invisible-Labs` org. Authenticate
196
- with a PAT or `GITHUB_TOKEN` with `write:packages`, then run:
197
- ```bash
198
- NODE_AUTH_TOKEN=<token> VERSION=0.0.1 npm run publish:private
199
- ```
200
- The release workflow runs this path automatically for SDK-relevant changes
201
- and publishes `<package version>-dev.<run_number>.<run_attempt>` with the
202
- private `dev` dist-tag.
203
- Consumers install the private `dev` dist-tag and import `@invisible-labs/sdk`
204
- directly, with no npm alias; see [`PUBLISHING.md`](./PUBLISHING.md).
205
- 3. **Public validation no-op.** Production promotion runs `publish:public:noop`
206
- with the exact `packages/sdk` version. This verifies the public-publishable
207
- manifest without npmjs credentials or publication.
208
- 4. **Public (npmjs).** After the release commit is on `main`, an authorized npm
209
- publisher runs the manual npmjs publish flow in [`PUBLISHING.md`](./PUBLISHING.md).
210
- CI does not publish to npmjs.
176
+ The prod-attestation smoke normally rebuilds the SDK. Its `--prebuilt-sdk`
177
+ option is reserved for an integrity-bound runtime that already contains the
178
+ exact built `dist`; ordinary operator runs must omit it.
@@ -6,12 +6,12 @@ var LP_DEFAULT_TARGET_SHARDS = 200;
6
6
  var LP_MAX_TARGET_SHARDS = 300;
7
7
  var LP_DEFAULT_REFILL_BATCH_SIZE = 50;
8
8
  var LP_MAX_REFILL_BATCH_SIZE = 50;
9
- var PRODUCT_MIN_ENTRY_LAMPORTS = 4e8;
9
+ var PRODUCT_MIN_ENTRY_LAMPORTS = 15e8;
10
10
  var PRODUCT_MAX_ENTRY_LAMPORTS = 1e11;
11
11
  function isValidLpPositionId(lpPositionId) {
12
12
  return lpPositionId.length >= LP_POSITION_ID_MIN_LENGTH && lpPositionId.length <= LP_POSITION_ID_MAX_LENGTH && LP_POSITION_ID_PATTERN.test(lpPositionId);
13
13
  }
14
14
 
15
15
  export { LP_DEFAULT_REFILL_BATCH_SIZE, LP_DEFAULT_TARGET_SHARDS, LP_MAX_REFILL_BATCH_SIZE, LP_MAX_TARGET_SHARDS, PRODUCT_MAX_ENTRY_LAMPORTS, PRODUCT_MIN_ENTRY_LAMPORTS, isValidLpPositionId };
16
- //# sourceMappingURL=chunk-TQNNTV5F.js.map
17
- //# sourceMappingURL=chunk-TQNNTV5F.js.map
16
+ //# sourceMappingURL=chunk-4X5OCCQW.js.map
17
+ //# sourceMappingURL=chunk-4X5OCCQW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../shared/src/index.ts"],"names":[],"mappings":";AAgBO,IAAM,yBAAA,GAA4B,CAAA;AAClC,IAAM,yBAAA,GAA4B,EAAA;AAClC,IAAM,sBAAA,GAAyB,kBAAA;AAC/B,IAAM,wBAAA,GAA2B;AACjC,IAAM,oBAAA,GAAuB;AAC7B,IAAM,4BAAA,GAA+B;AACrC,IAAM,wBAAA,GAA2B;AAKjC,IAAM,0BAAA,GAA6B;AACnC,IAAM,0BAAA,GAA6B;AAGnC,SAAS,oBAAoB,YAAA,EAA+B;AACjE,EAAA,OACE,YAAA,CAAa,UAAU,yBAAA,IACvB,YAAA,CAAa,UAAU,yBAAA,IACvB,sBAAA,CAAuB,KAAK,YAAY,CAAA;AAE5C","file":"chunk-TQNNTV5F.js","sourcesContent":["/**\n * Shared workspace entrypoint.\n *\n * Keep exports here pure and reusable across workspaces. Do not put React,\n * DOM-only, libp2p runtime state, or feature-specific glue in this package.\n */\nexport function sleep(ms: number): Promise<void> {\n if (ms <= 0) {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport const LP_POSITION_ID_MIN_LENGTH = 3;\nexport const LP_POSITION_ID_MAX_LENGTH = 96;\nexport const LP_POSITION_ID_PATTERN = /^[A-Za-z0-9_-]+$/;\nexport const LP_DEFAULT_TARGET_SHARDS = 200;\nexport const LP_MAX_TARGET_SHARDS = 300;\nexport const LP_DEFAULT_REFILL_BATCH_SIZE = 50;\nexport const LP_MAX_REFILL_BATCH_SIZE = 50;\n\n// Temporary TypeScript mirrors of the Rust TEE entry limits, plus the distinct\n// mainnet UI default. Keep them guarded by `npm run product-limits:check` until\n// cross-language generated product constants exist.\nexport const PRODUCT_MIN_ENTRY_LAMPORTS = 400_000_000;\nexport const PRODUCT_MAX_ENTRY_LAMPORTS = 100_000_000_000;\nexport const PRODUCT_DEFAULT_MAINNET_ENTRY_LAMPORTS = 3_000_000_000;\n\nexport function isValidLpPositionId(lpPositionId: string): boolean {\n return (\n lpPositionId.length >= LP_POSITION_ID_MIN_LENGTH &&\n lpPositionId.length <= LP_POSITION_ID_MAX_LENGTH &&\n LP_POSITION_ID_PATTERN.test(lpPositionId)\n );\n}\n"]}
1
+ {"version":3,"sources":["../../shared/src/index.ts"],"names":[],"mappings":";AAgBO,IAAM,yBAAA,GAA4B,CAAA;AAClC,IAAM,yBAAA,GAA4B,EAAA;AAClC,IAAM,sBAAA,GAAyB,kBAAA;AAC/B,IAAM,wBAAA,GAA2B;AACjC,IAAM,oBAAA,GAAuB;AAC7B,IAAM,4BAAA,GAA+B;AACrC,IAAM,wBAAA,GAA2B;AAKjC,IAAM,0BAAA,GAA6B;AACnC,IAAM,0BAAA,GAA6B;AAGnC,SAAS,oBAAoB,YAAA,EAA+B;AACjE,EAAA,OACE,YAAA,CAAa,UAAU,yBAAA,IACvB,YAAA,CAAa,UAAU,yBAAA,IACvB,sBAAA,CAAuB,KAAK,YAAY,CAAA;AAE5C","file":"chunk-4X5OCCQW.js","sourcesContent":["/**\n * Shared workspace entrypoint.\n *\n * Keep exports here pure and reusable across workspaces. Do not put React,\n * DOM-only, libp2p runtime state, or feature-specific glue in this package.\n */\nexport function sleep(ms: number): Promise<void> {\n if (ms <= 0) {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport const LP_POSITION_ID_MIN_LENGTH = 3;\nexport const LP_POSITION_ID_MAX_LENGTH = 96;\nexport const LP_POSITION_ID_PATTERN = /^[A-Za-z0-9_-]+$/;\nexport const LP_DEFAULT_TARGET_SHARDS = 200;\nexport const LP_MAX_TARGET_SHARDS = 300;\nexport const LP_DEFAULT_REFILL_BATCH_SIZE = 50;\nexport const LP_MAX_REFILL_BATCH_SIZE = 50;\n\n// Temporary TypeScript mirrors of the Rust TEE entry limits, plus the distinct\n// mainnet UI default. Keep them guarded by `npm run product-limits:check` until\n// cross-language generated product constants exist.\nexport const PRODUCT_MIN_ENTRY_LAMPORTS = 1_500_000_000;\nexport const PRODUCT_MAX_ENTRY_LAMPORTS = 100_000_000_000;\nexport const PRODUCT_DEFAULT_MAINNET_ENTRY_LAMPORTS = 1_500_000_000;\n\nexport function isValidLpPositionId(lpPositionId: string): boolean {\n return (\n lpPositionId.length >= LP_POSITION_ID_MIN_LENGTH &&\n lpPositionId.length <= LP_POSITION_ID_MAX_LENGTH &&\n LP_POSITION_ID_PATTERN.test(lpPositionId)\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { failSessionClosed, createSessionHandle, getSessionState, closeSessionState } from './chunk-JRMKCE3S.js';
2
- import { verifyAttestation, assertAttestResponse } from './chunk-NCY4FCYU.js';
3
- import { TransportError, AttestationError } from './chunk-OHIM2YWU.js';
1
+ import { failSessionClosed, createSessionHandle, getSessionState, closeSessionState } from './chunk-V5HXJRBW.js';
2
+ import { verifyAttestation, assertAttestResponse } from './chunk-DIA6U2CV.js';
3
+ import { TransportError, AttestationError } from './chunk-GHBQF3A7.js';
4
4
  import { generateKeyPair, sharedKey } from '@stablelib/x25519';
5
5
  import { ChaCha20Poly1305 } from '@stablelib/chacha20poly1305';
6
6
  import { hash, SHA256 } from '@stablelib/sha256';
@@ -398,6 +398,7 @@ function toAttestationPolicy(endpoint) {
398
398
  // ignore the MRTD pin inside the verifier.
399
399
  expectedMrtd: pin.mrtd,
400
400
  ...pin.binaryHash ? { expectedBinaryHash: pin.binaryHash } : {},
401
+ ...pin.runtimeProfile ? { expectedRuntimeProfile: pin.runtimeProfile } : {},
401
402
  allowMissingDcapCollateral: pin.allowMissingDcapCollateral === true,
402
403
  allowLocalAttestation
403
404
  };
@@ -694,6 +695,7 @@ async function establishAttestedChannel(params) {
694
695
  mrtd: channel.attestation.mrtd,
695
696
  mode: channel.attestation.mode,
696
697
  binaryHash: channel.attestation.binaryHash,
698
+ runtimeProfile: channel.attestation.runtimeProfile,
697
699
  pubkeyHex: channel.attestation.pubkeyHex,
698
700
  localAttestation: channel.attestation.localAttestation,
699
701
  rtmr0: channel.attestation.rtmr0,
@@ -723,6 +725,7 @@ function performAttestation(_transport, handshake) {
723
725
  mrtd: channel.attestation.mrtd,
724
726
  mode: channel.attestation.mode,
725
727
  binaryHash: channel.attestation.binaryHash,
728
+ runtimeProfile: channel.attestation.runtimeProfile,
726
729
  pubkeyHex: channel.attestation.pubkeyHex,
727
730
  localAttestation: channel.attestation.localAttestation,
728
731
  rtmr0: channel.attestation.rtmr0,
@@ -872,6 +875,10 @@ var coordinatorPoolConfig_schema_default = {
872
875
  pattern: "^[0-9a-fA-F]{64}$",
873
876
  description: "Optional SHA-256 hash of the approved coordinator binary; required for production Azure attestation."
874
877
  },
878
+ runtimeProfile: {
879
+ enum: ["prod-hardened", "prod-devnet-simplified"],
880
+ description: "Optional compile-time coordinator runtime profile; production simplified deployments must pin it."
881
+ },
875
882
  intelRootFingerprint: {
876
883
  type: "string",
877
884
  description: "Hex SHA-256 of the Intel root cert."
@@ -1023,6 +1030,7 @@ async function reattest(state, endpoint, timeoutMs = DEFAULT_REATTEST_TIMEOUT_MS
1023
1030
  mrtd: metadata.mrtd,
1024
1031
  mode: metadata.mode,
1025
1032
  binaryHash: metadata.binaryHash,
1033
+ runtimeProfile: metadata.runtimeProfile,
1026
1034
  pubkeyHex: metadata.pubkeyHex,
1027
1035
  localAttestation: metadata.localAttestation,
1028
1036
  rtmr0: metadata.rtmr0,
@@ -1141,5 +1149,5 @@ async function runReattest(state, endpoint) {
1141
1149
  }
1142
1150
 
1143
1151
  export { closeSession, createExponentialBackoff, createSession, createStateController, formatAjvErrors, noiseWebSocketTransport, performAttestation, performNoiseHandshake, reattestSerialized, validatePayoutPolicyShape };
1144
- //# sourceMappingURL=chunk-7DSVN3MV.js.map
1145
- //# sourceMappingURL=chunk-7DSVN3MV.js.map
1152
+ //# sourceMappingURL=chunk-BWCGNTN5.js.map
1153
+ //# sourceMappingURL=chunk-BWCGNTN5.js.map