@calimero-network/mero-js 35.2.0 → 35.3.0
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/README.md +39 -11
- package/dist/client/approvals.d.ts +2 -0
- package/dist/client/approvals.js +8 -1
- package/dist/client/calimero-client.d.ts +14 -2
- package/dist/client/calimero-client.js +21 -2
- package/dist/client/files.d.ts +2 -1
- package/dist/client/files.js +2 -5
- package/dist/client/index.d.ts +4 -3
- package/dist/client/index.js +2 -2
- package/dist/client/package-capabilities.d.ts +42 -0
- package/dist/client/package-capabilities.js +2 -0
- package/dist/index.browser.mjs +4 -4
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +208 -35
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +208 -35
- package/dist/index.mjs.map +3 -3
- package/dist/runtime/attestation.d.ts +28 -1
- package/dist/runtime/attestation.js +95 -20
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/transport.d.ts +39 -2
- package/dist/runtime/transport.js +97 -8
- package/dist/runtime.browser.mjs +1 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
# Mero.js — the JavaScript client for Calimero 1.0
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Your app's whole backend, like Firebase. Except nobody can read your data, not even us.
|
|
4
|
+
[Calimero](https://calimero-network.github.io/core/) gives an app auth (passkeys,
|
|
5
|
+
sessions, scoped API keys), a database (replicated app state), functions (Rust app
|
|
6
|
+
methods, compute jobs, timers, pipelines), realtime (events, presence), sealed file
|
|
7
|
+
and blob storage, search, hosting for its frontend and typed clients, all running
|
|
8
|
+
inside attested Intel TDX hardware. Clients check a node's attestation against
|
|
9
|
+
Sigstore-signed releases before they send it anything, then talk to it over a sealed
|
|
10
|
+
Noise channel.
|
|
11
|
+
|
|
12
|
+
This package is the JavaScript/TypeScript client, for the browser and Node 18+.
|
|
13
|
+
`CalimeroClient` verifies the node's TDX attestation, seals every request to it end
|
|
14
|
+
to end (Noise NK, `calimero/sealed-http/v2`), signs people in with WebAuthn passkeys
|
|
15
|
+
and machines with API keys, and calls your app. It is byte-compatible with core's
|
|
16
|
+
`calimero-sealed` and `calimero-client`.
|
|
17
|
+
|
|
18
|
+
What you can do with it:
|
|
19
|
+
|
|
20
|
+
- Connect to a Calimero Cloud cluster by name, with failover between its nodes.
|
|
21
|
+
- Sign up and sign in with passkeys, use API keys, and ask for passkey consent on sensitive calls.
|
|
22
|
+
- Install packages, create app instances, and call and view their methods.
|
|
23
|
+
- Follow an app's events and presence as streams.
|
|
24
|
+
- Upload and download sealed files and blobs.
|
|
25
|
+
- Manage organizations, teams, invites, deployments and every other route of the node, through methods generated from core's OpenAPI document.
|
|
26
|
+
- Build and sign a compute-only pipeline package (`.mpk`).
|
|
9
27
|
|
|
10
28
|
> **From version 27 this is the Calimero 1.0 client only.** The v1 SDK for merod 0.x nodes
|
|
11
29
|
> (`MeroJs`, the admin and auth API clients, JSON-RPC, contexts and namespaces)
|
|
@@ -52,7 +70,7 @@ for await (const event of client.events(app)) console.log(event);
|
|
|
52
70
|
await client.apps.upgrade({ app, version: '1.1.0' }, { confirm: passkeyConfirm(browserPasskey()) }); // the owner approves
|
|
53
71
|
```
|
|
54
72
|
|
|
55
|
-
A development cluster (`
|
|
73
|
+
A development cluster (`meroctl local up`, `merod run --dev`) sends mock quotes,
|
|
56
74
|
which pass only with `policy: { allowMock: true }`. Nothing is read from the
|
|
57
75
|
environment.
|
|
58
76
|
|
|
@@ -109,6 +127,7 @@ flows and streams a single route cannot be:
|
|
|
109
127
|
- **Credentials**: `signUp(passkey, name, { invite?, origin?, signal? })`, `signIn(passkey, { origin?, signal? })`, `refresh`, `signOut`, `signOutEverywhere`, `useSession`, `useApiKey`, `addPasskey(newPasskey, approver)`.
|
|
110
128
|
- **Account recovery** (core #4844): signed out, `startAccountRecovery(code, passkey)` and, 72 hours later, `finishAccountRecovery(passkey, accountId?)`. The code itself is `client.auth.recoveryCreate({}, { confirm })`.
|
|
111
129
|
- **Organization recovery**: `startRecovery(org, seed)` (the seed signs here and never leaves the process); `newRecoverySeed`, `recoveryPublicKey`.
|
|
130
|
+
- **Files**: `uploadFile(app, data)` (a large file goes up in parts), `exportFile(app, id)` and `exportFileTo(app, id, sink)` (the plaintext, checked against its id, size and hash).
|
|
112
131
|
- **Blobs**: `downloadBlob(app, id)`, `downloadBlobGranted(app, id, grant)` (bytes; `client.apps.blobDownload` answers a `Blob` with its type).
|
|
113
132
|
- **Streams**: `events(app, from?, signal?)`, `presenceStream(app, signal?)`.
|
|
114
133
|
- **Approvals from an app**: `pendingApprovals(org?)`, `appsReportAll(org)`, then `openConsentPage(request, …)` to send the user to the node's consent page, and `waitForConsent(requestId)`; back on `returnTo`, `resumeConsent()` reads the decision on the request this page started from the node (never from the URL) and refuses a return for another request, one still pending, or one a newer request replaced (`CONSENT_REPLACED`: an account has one undecided request per node). Besides releases, upgrades and outbound hosts, `createOrgConsent`, `createInviteConsent` and `acceptInviteConsent` ask for a new organization, an invite or joining with one, and `leaveOrgConsent`, `removeMemberConsent`, `setMemberRoleConsent`, `setMemberTeamsConsent`, `removeMemberTeamsConsent`, `revokeInviteConsent`, `renameOrgConsent`, `deleteOrgConsent`, `setCapabilitiesConsent` and `setAllAppsConsent` for managing one; the result's `outcome` (`{ orgId }`, `{ token }`, `{ org }`, a rename's `{ orgId, name }`, a deletion's `{ apps }`) is typed by `kind`. Show the answer's `code` to the user before sending them to `url` (`openConsentPage`'s `confirm` hook); they should see the same code on the page (`confirmationCode(requestId)` checks it). See [Ask your users to approve node images and app upgrades](https://calimero-network.github.io/mero-js/guides/user-approvals/).
|
|
@@ -369,12 +388,12 @@ MEROD_BINARY=/path/to/merod KV_STORE_WASM=/path/to/kv_store.wasm pnpm test:clust
|
|
|
369
388
|
`KV_STORE_WASM` is core's kv component (`apps/v2-fixtures/kv`, a `calimero:app`
|
|
370
389
|
component for `wasm32-wasip2`). Without the variables they use
|
|
371
390
|
`../core/target/debug/merod` and `../core/target/app-components/kv.wasm` from a
|
|
372
|
-
sibling core checkout, built there
|
|
391
|
+
sibling core checkout (1.0.0-rc.24 or later), built there with core's
|
|
392
|
+
`meroctl`:
|
|
373
393
|
|
|
374
394
|
```bash
|
|
375
|
-
cargo build -p merod
|
|
376
|
-
|
|
377
|
-
mero-app-build apps/v2-fixtures/kv --out target/app-components/kv.wasm
|
|
395
|
+
cargo build -p merod -p meroctl
|
|
396
|
+
target/debug/meroctl app build apps/v2-fixtures/kv --out target/app-components/kv.wasm
|
|
378
397
|
```
|
|
379
398
|
|
|
380
399
|
`scripts/download-released-merod.sh` fetches the newest released 1.0 `merod`
|
|
@@ -382,6 +401,15 @@ and the `app.wasm` of its `kv-store-test-fixture.mpk` (as `./merod` and
|
|
|
382
401
|
`./kv_store.wasm`), which is what CI runs them against; core's `e2e.yml` runs
|
|
383
402
|
the same suite against core's own tree.
|
|
384
403
|
|
|
404
|
+
## Related repositories
|
|
405
|
+
|
|
406
|
+
- [core](https://github.com/calimero-network/core): the node (`merod`), the Rust SDK and client, `meroctl`, and the [docs](https://calimero-network.github.io/core/).
|
|
407
|
+
- [mero-tee](https://github.com/calimero-network/mero-tee): the TDX node images and the signed releases this client verifies.
|
|
408
|
+
- [app-registry](https://github.com/calimero-network/app-registry): the registry of signed app packages.
|
|
409
|
+
- [mero-react](https://github.com/calimero-network/mero-react): React bindings built on this client.
|
|
410
|
+
- [calimero-client-py](https://github.com/calimero-network/calimero-client-py), [swift-sdk](https://github.com/calimero-network/swift-sdk), [kotlin-sdk](https://github.com/calimero-network/kotlin-sdk): the clients for Python, Swift and Kotlin.
|
|
411
|
+
- [apps](https://github.com/calimero-network/apps): Calimero apps.
|
|
412
|
+
|
|
385
413
|
## License
|
|
386
414
|
|
|
387
415
|
MIT — see [LICENSE](LICENSE).
|
|
@@ -258,6 +258,8 @@ export declare const RELEASE_VERIFIER = "https://mero-tee.vercel.app";
|
|
|
258
258
|
export declare function releaseNotesUrl(version: string): string;
|
|
259
259
|
/** The public verifier's page for a mero-tee release. */
|
|
260
260
|
export declare function verifyReleaseUrl(version: string): string;
|
|
261
|
+
/** The public verifier's page for a node: it fetches a fresh quote from `nodeUrl` and checks it against `release`. */
|
|
262
|
+
export declare function verifyNodeUrl(nodeUrl: string, release: string): string;
|
|
261
263
|
/** A mero-tee release the cluster's nodes run that the scope has not approved. */
|
|
262
264
|
export interface PendingRelease {
|
|
263
265
|
version: string;
|
package/dist/client/approvals.js
CHANGED
|
@@ -122,9 +122,16 @@ export const RELEASE_VERIFIER = 'https://mero-tee.vercel.app';
|
|
|
122
122
|
export function releaseNotesUrl(version) {
|
|
123
123
|
return `https://github.com/calimero-network/mero-tee/releases/tag/mero-tee-v${encodeURIComponent(version)}`;
|
|
124
124
|
}
|
|
125
|
+
function verifierUrl(query) {
|
|
126
|
+
return `${RELEASE_VERIFIER}/mero-tee?${new URLSearchParams(query)}`;
|
|
127
|
+
}
|
|
125
128
|
/** The public verifier's page for a mero-tee release. */
|
|
126
129
|
export function verifyReleaseUrl(version) {
|
|
127
|
-
return
|
|
130
|
+
return verifierUrl({ release_tag: `mero-tee-v${version}` });
|
|
131
|
+
}
|
|
132
|
+
/** The public verifier's page for a node: it fetches a fresh quote from `nodeUrl` and checks it against `release`. */
|
|
133
|
+
export function verifyNodeUrl(nodeUrl, release) {
|
|
134
|
+
return verifierUrl({ node_url: nodeUrl.replace(/\/+$/, ''), release_tag: `mero-tee-v${release}` });
|
|
128
135
|
}
|
|
129
136
|
/**
|
|
130
137
|
* The pending list from a scope's report pages (every page's apps
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
* const { result } = await cloud.call(appId, 'set', { key: 'a', value: '1' });
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
|
-
import { DEFAULT_RETRY, NodeTransport, retryDelayMs, type CalimeroSession, type NodeEvent, type RetryOptions } from '../runtime/transport.js';
|
|
13
|
-
import { type NodePolicy } from '../runtime/attestation.js';
|
|
12
|
+
import { DEFAULT_RETRY, NodeTransport, retryDelayMs, type CalimeroSession, type NodeEvent, type NodeVerificationState, type RetryOptions } from '../runtime/transport.js';
|
|
13
|
+
import { type NodePolicy, type NodeVerification } from '../runtime/attestation.js';
|
|
14
14
|
import { type PasskeyProvider } from '../runtime/passkey.js';
|
|
15
15
|
import { type RouteClientOptions } from '../routes/route-client.js';
|
|
16
|
+
import type { PackageCapabilities } from './package-capabilities.js';
|
|
16
17
|
import { type Routes } from '../generated/methods.js';
|
|
17
18
|
import { type ExportedFile, type FileSink } from './files.js';
|
|
18
19
|
import { type AppsReport, type ConsentRequest, type ConsentResult, type ConsentStarted, type OpenConsentOptions, type ResumeConsentOptions, type PendingApprovals } from './approvals.js';
|
|
@@ -265,12 +266,22 @@ export declare class CalimeroClient {
|
|
|
265
266
|
get nodeUrl(): string;
|
|
266
267
|
/** Every node this client may use, in the order it moves through them. */
|
|
267
268
|
get nodes(): string[];
|
|
269
|
+
/** What the check of node `url` (from {@link nodes}; default: in use) established, or `undefined` before it first ran. */
|
|
270
|
+
verification(url?: string): NodeVerificationState | undefined;
|
|
271
|
+
/** Wait for the check requests wait for, starting it if needed, and answer its outcome (not thrown) without a request. */
|
|
272
|
+
verify(url?: string): Promise<NodeVerificationState>;
|
|
268
273
|
/** Authenticate every request with an API key. */
|
|
269
274
|
useApiKey(key: string): void;
|
|
270
275
|
useSession(session: CalimeroSession): void;
|
|
271
276
|
get session(): CalimeroSession | undefined;
|
|
272
277
|
/** A JSON request through the transport, to an untyped path. */
|
|
273
278
|
private json;
|
|
279
|
+
/** Attest `app` on node `url` (from {@link nodes}; default: in use): the record's `appHash` is the one the node bound. */
|
|
280
|
+
attestApp(app: string, url?: string): Promise<NodeVerification>;
|
|
281
|
+
/** The manifest facts and ABI of a package version (of `service`, for a multi-service release), for a signed-in caller. */
|
|
282
|
+
packageCapabilities(pkg: string, version: string, options?: {
|
|
283
|
+
service?: string;
|
|
284
|
+
}): Promise<PackageCapabilities>;
|
|
274
285
|
/**
|
|
275
286
|
* Create an account with a new passkey, and sign in. The node then asks the
|
|
276
287
|
* new passkey to sign the account it creates (`412 CONFIRM_REQUIRED`), so a
|
|
@@ -352,6 +363,7 @@ export declare class CalimeroClient {
|
|
|
352
363
|
finishAccountRecovery(passkey: PasskeyProvider, accountId?: string): Promise<CalimeroSession>;
|
|
353
364
|
/** One of `app`'s blobs, by id (base58 or hex). */
|
|
354
365
|
downloadBlob(app: string, id: string): Promise<Uint8Array>;
|
|
366
|
+
private get exportClient();
|
|
355
367
|
/**
|
|
356
368
|
* Write the plaintext of sealed file `id` of component app `app` to `sink`, checked against its id,
|
|
357
369
|
* size and hash. On rejection, discard what `sink` received: it is authentic but may be a prefix of
|
|
@@ -144,6 +144,14 @@ export class CalimeroClient {
|
|
|
144
144
|
get nodes() {
|
|
145
145
|
return this.transport.nodes;
|
|
146
146
|
}
|
|
147
|
+
/** What the check of node `url` (from {@link nodes}; default: in use) established, or `undefined` before it first ran. */
|
|
148
|
+
verification(url) {
|
|
149
|
+
return this.transport.verification(url);
|
|
150
|
+
}
|
|
151
|
+
/** Wait for the check requests wait for, starting it if needed, and answer its outcome (not thrown) without a request. */
|
|
152
|
+
verify(url) {
|
|
153
|
+
return this.transport.verify(url);
|
|
154
|
+
}
|
|
147
155
|
/** Authenticate every request with an API key. */
|
|
148
156
|
useApiKey(key) {
|
|
149
157
|
this.transport.useApiKey(key);
|
|
@@ -158,6 +166,14 @@ export class CalimeroClient {
|
|
|
158
166
|
json(method, path, body) {
|
|
159
167
|
return this.transport.json(method, path, { body });
|
|
160
168
|
}
|
|
169
|
+
/** Attest `app` on node `url` (from {@link nodes}; default: in use): the record's `appHash` is the one the node bound. */
|
|
170
|
+
attestApp(app, url) {
|
|
171
|
+
return this.transport.attestApp(app, url);
|
|
172
|
+
}
|
|
173
|
+
/** The manifest facts and ABI of a package version (of `service`, for a multi-service release), for a signed-in caller. */
|
|
174
|
+
packageCapabilities(pkg, version, options = {}) {
|
|
175
|
+
return this.transport.json('GET', routePath('packages/{package}/{version}/capabilities', { package: pkg, version }), { query: { service: options.service } });
|
|
176
|
+
}
|
|
161
177
|
// ---------------------------------------------------------------- identity
|
|
162
178
|
/**
|
|
163
179
|
* Create an account with a new passkey, and sign in. The node then asks the
|
|
@@ -334,17 +350,20 @@ export class CalimeroClient {
|
|
|
334
350
|
async downloadBlob(app, id) {
|
|
335
351
|
return new Uint8Array(await (await this.apps.blobDownload({ app, id })).arrayBuffer());
|
|
336
352
|
}
|
|
353
|
+
get exportClient() {
|
|
354
|
+
return { exportsExport: this.apps.exportsExport, request: this.transport.request.bind(this.transport) };
|
|
355
|
+
}
|
|
337
356
|
/**
|
|
338
357
|
* Write the plaintext of sealed file `id` of component app `app` to `sink`, checked against its id,
|
|
339
358
|
* size and hash. On rejection, discard what `sink` received: it is authentic but may be a prefix of
|
|
340
359
|
* the file. A failed check is an `ExportError`; `signal` aborts the download.
|
|
341
360
|
*/
|
|
342
361
|
exportFileTo(app, id, sink, signal) {
|
|
343
|
-
return exportFileTo(this.
|
|
362
|
+
return exportFileTo(this.exportClient, app, id, sink, signal);
|
|
344
363
|
}
|
|
345
364
|
/** The plaintext of sealed file `id` of component app `app`, in memory; use {@link exportFileTo} for a large one. */
|
|
346
365
|
exportFile(app, id, signal) {
|
|
347
|
-
return exportFile(this.
|
|
366
|
+
return exportFile(this.exportClient, app, id, signal);
|
|
348
367
|
}
|
|
349
368
|
/**
|
|
350
369
|
* Download a component app's blob with a grant one of its runs handed out
|
package/dist/client/files.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* for this call, and nothing it says is believed until it checks out.
|
|
5
5
|
*/
|
|
6
6
|
import { type Transport } from '../runtime/transport.js';
|
|
7
|
+
import type { AppsRoutes } from '../generated/methods.js';
|
|
7
8
|
export { ExportError, type ExportErrorCode } from '../sealed/file.js';
|
|
8
9
|
/** Where an export writes the plaintext, in order. A `WritableStreamDefaultWriter` fits. */
|
|
9
10
|
export interface FileSink {
|
|
@@ -15,7 +16,7 @@ export interface ExportedFile {
|
|
|
15
16
|
/** SHA-256 of the plaintext, hex. */
|
|
16
17
|
sha256: string;
|
|
17
18
|
}
|
|
18
|
-
type ExportTransport = Pick<Transport, '
|
|
19
|
+
type ExportTransport = Pick<Transport, 'request'> & Pick<AppsRoutes, 'exportsExport'>;
|
|
19
20
|
/**
|
|
20
21
|
* Write the plaintext of sealed file `id` (64 hex) of app `app` to `sink`, one
|
|
21
22
|
* segment at a time. Each segment is checked against its hash before it is
|
package/dist/client/files.js
CHANGED
|
@@ -96,11 +96,7 @@ export async function exportFileTo(transport, app, id, sink, signal, recipientSe
|
|
|
96
96
|
}
|
|
97
97
|
async function exportChecked(transport, app, id, sink, signal, recipientSecret) {
|
|
98
98
|
const recipient = await x25519KeyPair(recipientSecret);
|
|
99
|
-
|
|
100
|
-
const answer = checked(await transport.json('POST', routePath('apps/{app}/files/{id}/export', { app, id }), {
|
|
101
|
-
body: { recipient: hex(recipient.publicKey) },
|
|
102
|
-
signal,
|
|
103
|
-
}));
|
|
99
|
+
const answer = checked(await transport.exportsExport({ app, id, recipient: hex(recipient.publicKey) }, { signal }));
|
|
104
100
|
const { segments, named } = answer;
|
|
105
101
|
if (segments.length === 0 || hex(await fileId(segments)) !== hex(named) || hex(named) !== id) {
|
|
106
102
|
throw new ExportError('NOT_THE_FILE', `the node answered segments that are not the file ${id}`);
|
|
@@ -110,6 +106,7 @@ async function exportChecked(transport, app, id, sink, signal, recipientSecret)
|
|
|
110
106
|
for (let k = 0; k < segments.length; k += 1) {
|
|
111
107
|
if (signal?.aborted)
|
|
112
108
|
throw aborted();
|
|
109
|
+
// The generated segment method buffers the whole body, so this stays on the streaming request.
|
|
113
110
|
const response = await transport.request('GET', routePath('apps/{app}/files/{id}/segments/{k}', { app, id, k }), {
|
|
114
111
|
signal,
|
|
115
112
|
});
|
package/dist/client/index.d.ts
CHANGED
|
@@ -6,12 +6,13 @@ export type { DirectoryFailure } from '../runtime/directory.js';
|
|
|
6
6
|
export { AppError, ArgsTooLarge, BadOrigin, CalimeroError, ClusterNotUpgraded, ConfirmCancelled, ConfirmPromptBlocked, ConfirmRequired, IdempotencyMismatch, LoginRequired, ConsentStale, FeatureNotActive, NotFound, NotServing, OriginNotRegistered, OriginTaken, PasskeyUnknownHere, QuotaExceeded, RecoveryNotReady, ReleaseDeadlineError, RuntimeTooOld, SignUpRefused, TrapError, UnavailableError, WrongNode, WrongRecoveryCode, errorFrom, } from '../runtime/errors.js';
|
|
7
7
|
export type { Committed, SignUpRefusal } from '../runtime/errors.js';
|
|
8
8
|
export type { AppInfo, AppTeam, AppTeams, BlobInfo, FileData, FileInfo, DeadLetter, Deployer, FrontendManifest, PackageOrigin, SignInOptions, AccountRecovery, SignUpOptions, SignUpPolicy, CallResult, CalimeroClientOptions, CalimeroConnectOptions, NodeEvent, CalimeroSession, PackageInfo, RetryOptions, OrgInfo, OrgInvite, OrgMode, RecoveryTimes, PresenceEntry, ScopeAppsResult, ScopedAppTeam, TeamInfo, UpgradeRun, ViewResult, } from './calimero-client.js';
|
|
9
|
-
export {
|
|
10
|
-
export
|
|
9
|
+
export type { AppAbi, AppAbiMethod, AppMethodKind, PackageCapabilities } from './package-capabilities.js';
|
|
10
|
+
export { claimedRelease, fetchAttestedKey, freshCollateral, MOCK_QUOTE_HEADER, verifyNode } from '../runtime/attestation.js';
|
|
11
|
+
export type { AttestationDoc, NodePolicy, NodeReleasePolicy, NodeVerification } from '../runtime/attestation.js';
|
|
11
12
|
export { browserPasskey, b64url, fromB64url, passkeyConfirm } from '../runtime/passkey.js';
|
|
12
13
|
export { MAX_RECOVERY_NONCE_BYTES, RECOVERY_DOMAIN, newRecoverySeed, parseRecoverySeed, recoveryMessage, recoveryPublicKey, recoverySeedText, signRecovery, } from './recovery-key.js';
|
|
13
14
|
export type { ConfirmCallback, ConfirmChallenge, PasskeyConfirmOptions, AssertionJSON, PasskeyCreateOptions, PasskeyGetOptions, PasskeyProvider, PasskeyUserVerification, RegistrationJSON, } from '../runtime/passkey.js';
|
|
14
|
-
export { CONSENT_STORAGE_KEY, MAX_REPORT_PAGE, RELEASE_VERIFIER, acceptInviteConsent, compareVersions, confirmationCode, consentReturn, createInviteConsent, createOrgConsent, deleteOrgConsent, leaveOrgConsent, removeMemberConsent, removeMemberTeamsConsent, renameOrgConsent, revokeInviteConsent, setAllAppsConsent, setCapabilitiesConsent, setMemberRoleConsent, setMemberTeamsConsent, pageQuery, pendingApprovalsFrom, publisherBindingBytes, publisherBindingMessage, releaseConsent, releaseNotesUrl, stalledBy, upgradeConsent, verifyReleaseUrl, withdrawConsent, withoutConsentReturn, } from './approvals.js';
|
|
15
|
+
export { CONSENT_STORAGE_KEY, MAX_REPORT_PAGE, RELEASE_VERIFIER, acceptInviteConsent, compareVersions, confirmationCode, consentReturn, createInviteConsent, createOrgConsent, deleteOrgConsent, leaveOrgConsent, removeMemberConsent, removeMemberTeamsConsent, renameOrgConsent, revokeInviteConsent, setAllAppsConsent, setCapabilitiesConsent, setMemberRoleConsent, setMemberTeamsConsent, pageQuery, pendingApprovalsFrom, publisherBindingBytes, publisherBindingMessage, releaseConsent, releaseNotesUrl, stalledBy, upgradeConsent, verifyNodeUrl, verifyReleaseUrl, withdrawConsent, withoutConsentReturn, } from './approvals.js';
|
|
15
16
|
export type { ActorKind, AppsReport, Authority, CapabilitiesConsentSubject, ConsentKind, ConsentOutcomes, ConsentRequest, ConsentResult, ConsentResultOf, ConsentScope, ConsentStarted, InviteConsentSubject, InviteRole, MemberTeamConsent, OrgRole, TeamRole, OpenConsentOptions, ResumeConsentOptions, Governance, LatestBlocked, PageOptions, PendingApprovals, PendingRelease, PendingUpgrade, ReleaseDeadline, ReleaseRules, ReportScope, ReportedApp, ReportedBundle, RuntimeShortNode, } from './approvals.js';
|
|
16
17
|
export { DEFAULT_ORG_CAPABILITIES, ORG_CAPABILITIES, orgCapabilities } from './capabilities.js';
|
|
17
18
|
export type { OrgCapability } from './capabilities.js';
|
package/dist/client/index.js
CHANGED
|
@@ -11,8 +11,8 @@ export { CalimeroClient, FILE_PART_BYTES, deployerKey, frontendManifest, pageDep
|
|
|
11
11
|
export { ExportError } from './files.js';
|
|
12
12
|
export { DEFAULT_DIRECTORY, DirectoryError } from '../runtime/directory.js';
|
|
13
13
|
export { AppError, ArgsTooLarge, BadOrigin, CalimeroError, ClusterNotUpgraded, ConfirmCancelled, ConfirmPromptBlocked, ConfirmRequired, IdempotencyMismatch, LoginRequired, ConsentStale, FeatureNotActive, NotFound, NotServing, OriginNotRegistered, OriginTaken, PasskeyUnknownHere, QuotaExceeded, RecoveryNotReady, ReleaseDeadlineError, RuntimeTooOld, SignUpRefused, TrapError, UnavailableError, WrongNode, WrongRecoveryCode, errorFrom, } from '../runtime/errors.js';
|
|
14
|
-
export { claimedRelease, fetchAttestedKey, freshCollateral, MOCK_QUOTE_HEADER } from '../runtime/attestation.js';
|
|
14
|
+
export { claimedRelease, fetchAttestedKey, freshCollateral, MOCK_QUOTE_HEADER, verifyNode } from '../runtime/attestation.js';
|
|
15
15
|
export { browserPasskey, b64url, fromB64url, passkeyConfirm } from '../runtime/passkey.js';
|
|
16
16
|
export { MAX_RECOVERY_NONCE_BYTES, RECOVERY_DOMAIN, newRecoverySeed, parseRecoverySeed, recoveryMessage, recoveryPublicKey, recoverySeedText, signRecovery, } from './recovery-key.js';
|
|
17
|
-
export { CONSENT_STORAGE_KEY, MAX_REPORT_PAGE, RELEASE_VERIFIER, acceptInviteConsent, compareVersions, confirmationCode, consentReturn, createInviteConsent, createOrgConsent, deleteOrgConsent, leaveOrgConsent, removeMemberConsent, removeMemberTeamsConsent, renameOrgConsent, revokeInviteConsent, setAllAppsConsent, setCapabilitiesConsent, setMemberRoleConsent, setMemberTeamsConsent, pageQuery, pendingApprovalsFrom, publisherBindingBytes, publisherBindingMessage, releaseConsent, releaseNotesUrl, stalledBy, upgradeConsent, verifyReleaseUrl, withdrawConsent, withoutConsentReturn, } from './approvals.js';
|
|
17
|
+
export { CONSENT_STORAGE_KEY, MAX_REPORT_PAGE, RELEASE_VERIFIER, acceptInviteConsent, compareVersions, confirmationCode, consentReturn, createInviteConsent, createOrgConsent, deleteOrgConsent, leaveOrgConsent, removeMemberConsent, removeMemberTeamsConsent, renameOrgConsent, revokeInviteConsent, setAllAppsConsent, setCapabilitiesConsent, setMemberRoleConsent, setMemberTeamsConsent, pageQuery, pendingApprovalsFrom, publisherBindingBytes, publisherBindingMessage, releaseConsent, releaseNotesUrl, stalledBy, upgradeConsent, verifyNodeUrl, verifyReleaseUrl, withdrawConsent, withoutConsentReturn, } from './approvals.js';
|
|
18
18
|
export { DEFAULT_ORG_CAPABILITIES, ORG_CAPABILITIES, orgCapabilities } from './capabilities.js';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** What `GET /packages/{package}/{version}/capabilities` answers: a package version's manifest facts and its app's ABI. */
|
|
2
|
+
export type AppMethodKind = 'init' | 'call' | 'view' | 'timer' | 'action' | 'compute';
|
|
3
|
+
export interface AppAbiMethod {
|
|
4
|
+
kind: AppMethodKind;
|
|
5
|
+
/** `[name, type]` per parameter. */
|
|
6
|
+
params: [string, string][];
|
|
7
|
+
returns: string | null;
|
|
8
|
+
confirm: boolean;
|
|
9
|
+
public: boolean;
|
|
10
|
+
allowSystem: boolean;
|
|
11
|
+
every?: string;
|
|
12
|
+
rate?: string;
|
|
13
|
+
allowApps?: string[];
|
|
14
|
+
allowAction?: boolean;
|
|
15
|
+
compute?: Record<string, unknown>;
|
|
16
|
+
computeResult?: boolean;
|
|
17
|
+
doc?: string;
|
|
18
|
+
}
|
|
19
|
+
/** The app's `calimero:abi` document. */
|
|
20
|
+
export interface AppAbi {
|
|
21
|
+
abiVersion: string;
|
|
22
|
+
world: string;
|
|
23
|
+
state: string;
|
|
24
|
+
methods: Record<string, AppAbiMethod>;
|
|
25
|
+
errors: unknown[];
|
|
26
|
+
events: unknown[];
|
|
27
|
+
types?: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface PackageCapabilities {
|
|
30
|
+
package: string;
|
|
31
|
+
version: string;
|
|
32
|
+
service: string | null;
|
|
33
|
+
bundle: string;
|
|
34
|
+
mpk: string;
|
|
35
|
+
manifestHash: string;
|
|
36
|
+
signer: string;
|
|
37
|
+
name: string | null;
|
|
38
|
+
author: string | null;
|
|
39
|
+
/** Hosts the app may call out to. */
|
|
40
|
+
outbound: string[];
|
|
41
|
+
abi: AppAbi | null;
|
|
42
|
+
}
|