@calimero-network/mero-js 19.24.1 → 19.26.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.
@@ -1,5 +1,5 @@
1
1
  import { HttpClient } from '../http-client/index.js';
2
- import type { HealthStatus, AdminAuthStatus, InstallApplicationRequest, InstallApplicationResponseData, InstallDevApplicationRequest, UninstallApplicationResponseData, ListApplicationsResponseData, GetApplicationResponseData, ApplicationVersionEntry, GetApplicationAbiResponseData, GetLatestVersionResponseData, ListPackagesResponseData, ListVersionsResponseData, CreateContextRequest, CreateContextResponseData, DeleteContextResponseData, GetContextsResponseData, Context, GenerateContextIdentityResponseData, GetContextIdentitiesResponseData, JoinContextResponseData, JoinSubgroupInheritanceResponseData, ContextGroupResponseData, ContextStorageResponseData, InviteSpecializedNodeRequest, InviteSpecializedNodeResponseData, UpdateContextApplicationRequest, ResyncContextRequest, ResyncContextResponseData, ContextsWithExecutorsResponseData, UploadBlobRequest, UploadBlobResponseData, DeleteBlobResponseData, ListBlobsResponseData, GetBlobInfoResponseData, BlobReadOptions, CreateContextAliasRequest, CreateApplicationAliasRequest, CreateDeviceAliasRequest, CreateAliasResponseData, LookupAliasResponseData, DeleteAliasResponseData, ListAliasesResponseData, ListNamespacesResponseData, CreateNamespaceRequest, CreateNamespaceResponseData, DeleteNamespaceResponseData, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, JoinNamespaceRequest, JoinNamespaceResponseData, CreateGroupInNamespaceRequest, CreateGroupInNamespaceResponseData, SubgroupEntry, Namespace, NamespaceIdentity, NodeIdentity, AccountPairInitRequest, AccountPairInitResponseData, AccountPairCompleteRequest, AccountPairCompleteResponseData, AccountSignWithRootRequest, AccountSignWithRootResponseData, RelinkDeviceRequest, RelinkDeviceResponseData, RescopeDeviceRequest, RescopeDeviceResponseData, LabelDeviceRequest, LabelDeviceResponseData, AccountDeviceEntry, AccountApplicationEntry, RevokeAccountDeviceRequest, RevokeAccountDeviceResponseData, GroupInfoResponseData, CreateGroupRequest, CreateGroupResponseData, DeleteGroupResponseData, ListGroupMembersResponseData, ListGroupContextsResponseData, AddGroupMembersRequest, RemoveGroupMembersRequest, UpdateMemberRoleRequest, MemberCapabilities, SetMemberCapabilitiesRequest, SetDefaultCapabilitiesRequest, SetMemberAutoFollowRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, GetTeeAdmissionPolicyResponseData, SetTeeAuthoringPolicyRequest, SetGroupMetadataRequest, SetMemberMetadataRequest, SetContextMetadataRequest, MetadataRecord, SyncGroupResponseData, UpgradeGroupRequest, UpgradeGroupResponseData, GroupUpgradeStatusResponseData, MigrationStatus, CascadeStatusEntry, RetryGroupUpgradeResponseData, ReparentGroupRequest, ReparentGroupResponseData, IssueOwnershipProofRequest, IssueNamespaceOwnershipProofRequest, IssueOwnershipProofResponseData, CreateGroupInvitationRequest, CreateGroupInvitationResponseData, CreateRecursiveGroupInvitationResponseData, JoinGroupRequest, JoinGroupResponseData, TeeInfoResponseData, TeeAttestRequest, TeeAttestResponseData, TeeVerifyQuoteRequest, TeeVerifyQuoteResponseData, PerformIntentRequest, PerformIntentResponseData, IntentRelayInfo, AdmitJoinRequest, AdmitJoinResponseData } from './admin-types.js';
2
+ import type { HealthStatus, ReadinessStatus, AdminAuthStatus, InstallApplicationRequest, InstallApplicationResponseData, InstallDevApplicationRequest, UninstallApplicationResponseData, ListApplicationsResponseData, GetApplicationResponseData, ApplicationVersionEntry, GetApplicationAbiResponseData, GetLatestVersionResponseData, ListPackagesResponseData, ListVersionsResponseData, CreateContextRequest, CreateContextResponseData, DeleteContextResponseData, GetContextsResponseData, Context, GenerateContextIdentityResponseData, GetContextIdentitiesResponseData, JoinContextResponseData, JoinSubgroupInheritanceResponseData, ContextGroupResponseData, ContextStorageResponseData, InviteSpecializedNodeRequest, InviteSpecializedNodeResponseData, UpdateContextApplicationRequest, ResyncContextRequest, ResyncContextResponseData, ContextsWithExecutorsResponseData, UploadBlobRequest, UploadBlobResponseData, DeleteBlobResponseData, ListBlobsResponseData, GetBlobInfoResponseData, BlobReadOptions, CreateContextAliasRequest, CreateApplicationAliasRequest, CreateDeviceAliasRequest, CreateAliasResponseData, LookupAliasResponseData, DeleteAliasResponseData, ListAliasesResponseData, ListNamespacesResponseData, CreateNamespaceRequest, CreateNamespaceResponseData, DeleteNamespaceResponseData, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, JoinNamespaceRequest, JoinNamespaceResponseData, CreateGroupInNamespaceRequest, CreateGroupInNamespaceResponseData, SubgroupEntry, Namespace, NamespaceIdentity, NodeIdentity, AccountPairInitRequest, AccountPairInitResponseData, AccountPairCompleteRequest, AccountPairCompleteResponseData, AccountSignWithRootRequest, AccountSignWithRootResponseData, RelinkDeviceRequest, RelinkDeviceResponseData, RescopeDeviceRequest, RescopeDeviceResponseData, LabelDeviceRequest, LabelDeviceResponseData, AccountDeviceEntry, AccountApplicationEntry, RevokeAccountDeviceRequest, RevokeAccountDeviceResponseData, GroupInfoResponseData, CreateGroupRequest, CreateGroupResponseData, DeleteGroupResponseData, ListGroupMembersResponseData, ListGroupContextsResponseData, AddGroupMembersRequest, RemoveGroupMembersRequest, UpdateMemberRoleRequest, MemberCapabilities, SetMemberCapabilitiesRequest, SetDefaultCapabilitiesRequest, SetMemberAutoFollowRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, GetTeeAdmissionPolicyResponseData, SetTeeAuthoringPolicyRequest, SetGroupMetadataRequest, SetMemberMetadataRequest, SetContextMetadataRequest, MetadataRecord, SyncGroupResponseData, UpgradeGroupRequest, UpgradeGroupResponseData, GroupUpgradeStatusResponseData, MigrationStatus, CascadeStatusEntry, RetryGroupUpgradeResponseData, ReparentGroupRequest, ReparentGroupResponseData, IssueOwnershipProofRequest, IssueNamespaceOwnershipProofRequest, IssueOwnershipProofResponseData, CreateGroupInvitationRequest, CreateGroupInvitationResponseData, CreateRecursiveGroupInvitationResponseData, JoinGroupRequest, JoinGroupResponseData, TeeInfoResponseData, TeeAttestRequest, TeeAttestResponseData, TeeVerifyQuoteRequest, TeeVerifyQuoteResponseData, PerformIntentRequest, PerformIntentResponseData, IntentRelayInfo, QueryContextRequest, QueryContextResponseData, ListMemberDevicesOptions, ListMemberDevicesResponseData, SealToAccountRequest, SealedEnvelope, AdmitJoinRequest, AdmitJoinResponseData } from './admin-types.js';
3
3
  /**
4
4
  * Compare two version strings by SemVer 2.0 precedence, ascending: negative if
5
5
  * `a < b`, positive if `a > b`, `0` if equal. Build metadata (`+...`) is stripped
@@ -15,6 +15,12 @@ export declare class AdminApiClient {
15
15
  private httpClient;
16
16
  constructor(httpClient: HttpClient);
17
17
  healthCheck(): Promise<HealthStatus>;
18
+ /**
19
+ * Whether the node has finished starting and its store answers. Public, like
20
+ * {@link healthCheck}; unlike it, a node that is up but not ready answers
21
+ * `503`, which this surfaces as an `HTTPError` whose body names the stage.
22
+ */
23
+ readinessCheck(): Promise<ReadinessStatus>;
18
24
  isAuthed(): Promise<AdminAuthStatus>;
19
25
  /**
20
26
  * Install a published application by its `package@version` coordinates. The
@@ -178,6 +184,16 @@ export declare class AdminApiClient {
178
184
  * {@link PerformIntentRequest.warrant}.
179
185
  */
180
186
  performIntent(contextId: string, request: PerformIntentRequest): Promise<PerformIntentResponseData>;
187
+ /**
188
+ * Read a context as the session's ACCOUNT, without minting a warrant.
189
+ *
190
+ * Needs an account-authenticated session — one from {@link login}, not the
191
+ * admin password login — and refuses otherwise with a `401`. The account must
192
+ * be a member of the group owning the context (`403` if not), and the method
193
+ * must be declared read-only in the app's ABI (`409` if not; a write needs
194
+ * {@link performIntent}).
195
+ */
196
+ queryContext(contextId: string, request: QueryContextRequest): Promise<QueryContextResponseData>;
181
197
  /**
182
198
  * Ask what this node can do for a member in `contextId`, before they sign
183
199
  * anything.
@@ -366,6 +382,18 @@ export declare class AdminApiClient {
366
382
  getSubgroupVisibility(groupId: string): Promise<string>;
367
383
  deleteGroup(groupId: string): Promise<DeleteGroupResponseData>;
368
384
  listGroupMembers(groupId: string): Promise<ListGroupMembersResponseData>;
385
+ /**
386
+ * Member accounts in the group and the devices bound to each. An admin node
387
+ * sees every account; a plain member only its own. `403` if this node is not a
388
+ * member of the group.
389
+ */
390
+ listMemberDevices(groupId: string, options?: ListMemberDevicesOptions): Promise<ListMemberDevicesResponseData>;
391
+ /**
392
+ * Seal a small payload to a member account's root key. This node must be a
393
+ * member of the group, and `account` must be an account the group knows, so
394
+ * the route reaches no further than the caller already does.
395
+ */
396
+ sealToAccount(groupId: string, account: string, request: SealToAccountRequest): Promise<SealedEnvelope>;
369
397
  listGroupContexts(groupId: string): Promise<ListGroupContextsResponseData>;
370
398
  addGroupMembers(groupId: string, request: AddGroupMembersRequest): Promise<void>;
371
399
  removeGroupMembers(groupId: string, request: RemoveGroupMembersRequest): Promise<void>;
@@ -506,6 +534,10 @@ export declare class AdminApiClient {
506
534
  joinSubgroupInheritance(groupId: string): Promise<JoinSubgroupInheritanceResponseData>;
507
535
  getTeeInfo(): Promise<TeeInfoResponseData>;
508
536
  teeAttest(request: TeeAttestRequest): Promise<TeeAttestResponseData>;
537
+ /**
538
+ * @deprecated Nodes no longer serve `/admin-api/tee/verify-quote` (removed in
539
+ * core#3262), so this fails. Verify quotes with `createQuoteVerifier`.
540
+ */
509
541
  teeVerifyQuote(request: TeeVerifyQuoteRequest): Promise<TeeVerifyQuoteResponseData>;
510
542
  getPeersCount(): Promise<{
511
543
  count: number;
@@ -104,6 +104,14 @@ export class AdminApiClient {
104
104
  async healthCheck() {
105
105
  return unwrap(await this.httpClient.get('/admin-api/health'));
106
106
  }
107
+ /**
108
+ * Whether the node has finished starting and its store answers. Public, like
109
+ * {@link healthCheck}; unlike it, a node that is up but not ready answers
110
+ * `503`, which this surfaces as an `HTTPError` whose body names the stage.
111
+ */
112
+ async readinessCheck() {
113
+ return unwrap(await this.httpClient.get('/admin-api/ready'));
114
+ }
107
115
  async isAuthed() {
108
116
  return this.httpClient.get('/admin-api/is-authed');
109
117
  }
@@ -452,6 +460,18 @@ export class AdminApiClient {
452
460
  async performIntent(contextId, request) {
453
461
  return unwrap(await this.httpClient.post(`/admin-api/contexts/${contextId}/intents`, request));
454
462
  }
463
+ /**
464
+ * Read a context as the session's ACCOUNT, without minting a warrant.
465
+ *
466
+ * Needs an account-authenticated session — one from {@link login}, not the
467
+ * admin password login — and refuses otherwise with a `401`. The account must
468
+ * be a member of the group owning the context (`403` if not), and the method
469
+ * must be declared read-only in the app's ABI (`409` if not; a write needs
470
+ * {@link performIntent}).
471
+ */
472
+ async queryContext(contextId, request) {
473
+ return unwrap(await this.httpClient.post(`/admin-api/contexts/${contextId}/query`, request));
474
+ }
455
475
  /**
456
476
  * Ask what this node can do for a member in `contextId`, before they sign
457
477
  * anything.
@@ -725,6 +745,29 @@ export class AdminApiClient {
725
745
  }
726
746
  return response;
727
747
  }
748
+ /**
749
+ * Member accounts in the group and the devices bound to each. An admin node
750
+ * sees every account; a plain member only its own. `403` if this node is not a
751
+ * member of the group.
752
+ */
753
+ async listMemberDevices(groupId, options = {}) {
754
+ const params = new URLSearchParams();
755
+ if (options.offset !== undefined)
756
+ params.set('offset', String(options.offset));
757
+ if (options.limit !== undefined)
758
+ params.set('limit', String(options.limit));
759
+ const query = params.toString();
760
+ const path = `/admin-api/groups/${groupId}/member-devices${query ? `?${query}` : ''}`;
761
+ return this.httpClient.get(path);
762
+ }
763
+ /**
764
+ * Seal a small payload to a member account's root key. This node must be a
765
+ * member of the group, and `account` must be an account the group knows, so
766
+ * the route reaches no further than the caller already does.
767
+ */
768
+ async sealToAccount(groupId, account, request) {
769
+ return unwrap(await this.httpClient.post(`/admin-api/groups/${groupId}/accounts/${account}/seal`, request));
770
+ }
728
771
  async listGroupContexts(groupId) {
729
772
  return unwrap(await this.httpClient.get(`/admin-api/groups/${groupId}/contexts`));
730
773
  }
@@ -959,6 +1002,10 @@ export class AdminApiClient {
959
1002
  async teeAttest(request) {
960
1003
  return unwrap(await this.httpClient.post('/admin-api/tee/attest', request));
961
1004
  }
1005
+ /**
1006
+ * @deprecated Nodes no longer serve `/admin-api/tee/verify-quote` (removed in
1007
+ * core#3262), so this fails. Verify quotes with `createQuoteVerifier`.
1008
+ */
962
1009
  async teeVerifyQuote(request) {
963
1010
  return unwrap(await this.httpClient.post('/admin-api/tee/verify-quote', request));
964
1011
  }
@@ -1,7 +1,17 @@
1
+ import type { DcapCollateral } from '../sealed/verify.js';
1
2
  export { ApiResponse } from '../http-client/index.js';
2
3
  export interface HealthStatus {
3
4
  status: string;
4
5
  }
6
+ /**
7
+ * What `GET /admin-api/ready` reports: `ready` once the node has finished
8
+ * starting up and its store answers. A node that is not ready answers `503`
9
+ * with its lifecycle stage (or `store_unavailable`) as the status, which the
10
+ * client surfaces as an `HTTPError`.
11
+ */
12
+ export interface ReadinessStatus {
13
+ status: string;
14
+ }
5
15
  export interface AdminAuthStatus {
6
16
  data: {
7
17
  status: string;
@@ -412,6 +422,24 @@ export interface PerformIntentRequest {
412
422
  authorProof: string;
413
423
  }
414
424
  /** What a performed intent reports back. */
425
+ /**
426
+ * A read of a context, run as the caller's account. Needs no warrant: a read
427
+ * publishes nothing, so there is no peer to convince.
428
+ */
429
+ export interface QueryContextRequest {
430
+ /**
431
+ * The method to call. It must be declared read-only in the application's ABI
432
+ * (a `&self` method in a Rust app); anything else is refused with a `409`,
433
+ * because a write needs a warrant ({@link PerformIntentRequest}).
434
+ */
435
+ method: string;
436
+ /** Its arguments, as the JSON the guest will receive. */
437
+ argsJson: unknown;
438
+ }
439
+ export interface QueryContextResponseData {
440
+ /** The method's own return value. */
441
+ returns: unknown | null;
442
+ }
415
443
  export interface PerformIntentResponseData {
416
444
  /**
417
445
  * The context's scope root after the run — how a caller sees that it wrote.
@@ -1225,6 +1253,57 @@ export interface ListGroupMembersResponseData {
1225
1253
  */
1226
1254
  data?: GroupMember[];
1227
1255
  }
1256
+ /** One device bound to a member account. */
1257
+ export interface MemberDevice {
1258
+ /** 64 hex; the form `revokeAccountDevice` takes. */
1259
+ deviceId: string;
1260
+ /**
1261
+ * The key this device's signatures carry, 64 hex. Joins against the
1262
+ * identities a context lists.
1263
+ */
1264
+ signingKey: string;
1265
+ }
1266
+ /** A member account and the devices bound to it in the namespace. */
1267
+ export interface MemberDevicesEntry {
1268
+ /** The member's ACCOUNT, 64 hex. */
1269
+ account: string;
1270
+ devices: MemberDevice[];
1271
+ }
1272
+ export interface ListMemberDevicesOptions {
1273
+ offset?: number;
1274
+ limit?: number;
1275
+ }
1276
+ export interface ListMemberDevicesResponseData {
1277
+ /**
1278
+ * Every account in the group if the calling node is an admin; only its own
1279
+ * entry if it is a plain member.
1280
+ */
1281
+ members: MemberDevicesEntry[];
1282
+ }
1283
+ export interface SealToAccountRequest {
1284
+ /**
1285
+ * Hex-encoded plaintext. Small by design: the route exists to hand an account
1286
+ * something like a list of namespace ids, and the node caps the size.
1287
+ */
1288
+ plaintext: string;
1289
+ }
1290
+ /**
1291
+ * A payload sealed to an account's root key. Only that account's root can open
1292
+ * it; the node that sealed it cannot.
1293
+ */
1294
+ export interface SealedEnvelope {
1295
+ /**
1296
+ * The root-key epoch it was sealed under. A rotated root still opens envelopes
1297
+ * from its own epoch, so a recipient holding several needs to know which.
1298
+ */
1299
+ accountRootEpoch: number;
1300
+ /** Hex, 32 bytes: the one-shot sender key. */
1301
+ ephemeralPublicKey: string;
1302
+ /** Hex, 12 bytes: the AES-256-GCM nonce. */
1303
+ nonce: string;
1304
+ /** Hex: the ciphertext with its 16-byte tag appended. */
1305
+ ciphertext: string;
1306
+ }
1228
1307
  export interface GroupContextEntry {
1229
1308
  contextId: string;
1230
1309
  name?: string;
@@ -1499,6 +1578,12 @@ export interface TeeAttestRequest {
1499
1578
  * as `transportPublicKey`. See `fetchAttestedTransportKey`.
1500
1579
  */
1501
1580
  bindTransportKey?: boolean;
1581
+ /**
1582
+ * Also return the Intel-signed collateral the quote is verified against, as
1583
+ * `collateral`, so the quote can be verified with nothing but the node. See
1584
+ * `createQuoteVerifier`. A node that predates it refuses the field.
1585
+ */
1586
+ includeCollateral?: boolean;
1502
1587
  }
1503
1588
  export interface QuoteHeader {
1504
1589
  version: number;
@@ -1539,12 +1624,23 @@ export interface TeeAttestResponseData {
1539
1624
  quote: Quote;
1540
1625
  /** Hex X25519 transport key, present only when the request set `bindTransportKey`. */
1541
1626
  transportPublicKey?: string;
1627
+ /**
1628
+ * The Intel-signed collateral the quote verifies against, present only when
1629
+ * the request set `includeCollateral` and the quote is not a mock.
1630
+ */
1631
+ collateral?: DcapCollateral;
1542
1632
  }
1633
+ /**
1634
+ * @deprecated Nodes no longer serve `/admin-api/tee/verify-quote` (removed in
1635
+ * core#3262), so a request for it fails. Verify quotes with
1636
+ * `createQuoteVerifier`.
1637
+ */
1543
1638
  export interface TeeVerifyQuoteRequest {
1544
1639
  quoteB64: string;
1545
1640
  nonce: string;
1546
1641
  expectedApplicationHash?: string;
1547
1642
  }
1643
+ /** @deprecated See {@link TeeVerifyQuoteRequest}. */
1548
1644
  export interface TeeVerifyQuoteResponseData {
1549
1645
  quoteVerified: boolean;
1550
1646
  nonceVerified: boolean;
@@ -1,5 +1,3 @@
1
- // Admin API Types — aligned with core server routes
2
- // All types use camelCase to match core's #[serde(rename_all = "camelCase")]
3
1
  /**
4
2
  * Hex-encode a string's UTF-8 bytes, for {@link AccountSignWithRootRequest.payload}.
5
3
  *