@calimero-network/mero-react 9.2.0 → 9.4.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/dist/index.d.ts CHANGED
@@ -2,13 +2,117 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { CSSProperties, ReactNode } from 'react';
4
4
  import * as _calimero_network_mero_js from '@calimero-network/mero-js';
5
- import { MeroJs, TokenStore, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, GetBlobInfoResponseData, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, ClassifiedError, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, RedeemOutcome, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, UploadBlobRequest, TokenData } from '@calimero-network/mero-js';
5
+ import { MeroClient, MeroJs, TokenStore, CloudClient, SignedGroupOpenInvitation, GovernanceOp, signGroupInvitation, AdminApiClient, InviteRedeemer, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, GetBlobInfoResponseData, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, ClassifiedError, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, RedeemOutcome, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, UploadBlobRequest, TokenData } from '@calimero-network/mero-js';
6
6
  export * from '@calimero-network/mero-js';
7
7
  export { CAPABILITIES, Codec, DEFAULT_LOCAL_NODE_PORTS, DiscoverLocalNodesOptions, EphemeralClient, EphemeralEntry, MetadataRecord, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
8
8
 
9
9
  /**
10
- * Types for mero-react
10
+ * The delegated half of connecting: an account, a certified device, and a relay
11
+ * that writes on their behalf.
12
+ *
13
+ * Kept deliberately apart from the node-login path in `MeroContext`. That path
14
+ * is a redirect flow with token adoption, single-use refresh tokens and node-URL
15
+ * trust validation — none of which applies here, because there is no session
16
+ * token at all. A delegated client authenticates every request from a warrant it
17
+ * signs itself. Weaving the two together would put a token-rotation decision in
18
+ * front of a flow that has no tokens.
19
+ *
20
+ * Per-tab on purpose. The record lives in `sessionStorage`, so two tabs can hold
21
+ * two different connections — one a node you run, one a relay you do not — with
22
+ * the same application code in both.
23
+ */
24
+
25
+ /**
26
+ * What a delegated connection needs to be rebuilt after a reload.
27
+ *
28
+ * `deviceSecret` is here because the device key is what signs warrants, and a
29
+ * reload that could not sign would be a dead session. It is a per-tab secret for
30
+ * a certificate the account can revoke — not the account root, which never
31
+ * leaves the wallet's origin.
32
+ */
33
+ /**
34
+ * What the wallet certified: an account, a device it trusts, and the key that
35
+ * device signs with. Everything except somewhere to send the result.
36
+ *
37
+ * Split out of {@link DelegatedSession} because it is reachable one step
38
+ * earlier. An account that has just enrolled holds exactly this and no relay —
39
+ * it is a member of nothing, so the cloud has no relay to name — and this is the
40
+ * input that resolves one from an invitation instead.
41
+ */
42
+ interface DelegatedCredential {
43
+ /** The author's account id, hex. */
44
+ account: string;
45
+ /** The author's `AccountProof<DeviceCert>`, hex borsh. */
46
+ credential: string;
47
+ /** The certified device's ed25519 signing secret, hex. */
48
+ deviceSecret: string;
49
+ }
50
+ interface DelegatedSession extends DelegatedCredential {
51
+ /**
52
+ * The relay to write through — a node origin, or `null` for none yet.
53
+ *
54
+ * **`null` is a logged-in state, not a broken one.** A brand-new account is a
55
+ * member of nothing, so the cloud names no relay for it — and that is the
56
+ * normal condition of an account that has just been created, because being
57
+ * signed in is how you come to be invited in the first place. Refusing to
58
+ * connect without a relay locked a new account out of the only path that
59
+ * would earn it one.
60
+ *
61
+ * What it does NOT mean is that writes quietly do nothing. There is no
62
+ * client at all without a URL ({@link buildDelegatedClient} returns `null`),
63
+ * so `mero` stays `null`, the session is authenticated, and anything reaching
64
+ * for `rpc.execute` is told the relay is missing. A placeholder URL would be
65
+ * the one unacceptable answer: it would look connected and refuse every
66
+ * warrant.
67
+ */
68
+ relayUrl: string | null;
69
+ }
70
+ /**
71
+ * The enrolled credential, whether or not a relay was ever found for it.
72
+ *
73
+ * A connected session is authoritative: it carries the same three fields and a
74
+ * relay, so it is read first and the standalone record is the fallback. Without
75
+ * that order a stale record from an earlier enrolment could out-rank the account
76
+ * actually connected.
77
+ */
78
+ declare function readDelegatedCredential(): DelegatedCredential | null;
79
+ declare function saveDelegatedCredential(c: DelegatedCredential): void;
80
+ declare function clearDelegatedCredential(): void;
81
+ /**
82
+ * Pin a relay's device signing key, hex (32 bytes), learned out of band.
83
+ *
84
+ * `login()` binds the session to this key, and it must never be read from the
85
+ * relay being logged in to — the answering party would choose what the device
86
+ * signs about. Until the cloud publishes it (mdma#312), it comes from the
87
+ * relay's operator.
11
88
  */
89
+ declare function pinRelayNodeKey(relayUrl: string, nodeKey: string): void;
90
+ /** The pinned key for a relay, or `null` if none was pinned. */
91
+ declare function readPinnedRelayNodeKey(relayUrl: string): string | null;
92
+ interface RelayMap {
93
+ namespaces: Record<string, string>;
94
+ contexts: Record<string, string>;
95
+ }
96
+ declare function readRelayMap(account: string): RelayMap;
97
+ /** Record the relay that admitted this account to a namespace (and, when known, the context it came for). */
98
+ declare function rememberRelay(account: string, relayUrl: string, at: {
99
+ namespaceId?: string;
100
+ contextId?: string;
101
+ }): void;
102
+ /** The relay that serves a context, if this account has learned it. */
103
+ declare function relayForContext(account: string, contextId: string): string | null;
104
+ type ListedContext = Awaited<ReturnType<MeroClient['admin']['getContexts']>>['contexts'][number];
105
+ /**
106
+ * This account's contexts on every relay it knows, each tagged with the relay
107
+ * that listed it — and that relay recorded as the one serving it.
108
+ *
109
+ * Each relay answers only for itself and only for this caller, so the union is
110
+ * exactly the account's contexts across relays. A relay that cannot be reached
111
+ * or logged in to is skipped (its contexts simply do not appear), not fatal.
112
+ */
113
+ declare function listDelegatedContexts(s: DelegatedSession): Promise<Array<ListedContext & {
114
+ relayUrl: string;
115
+ }>>;
12
116
 
13
117
  /**
14
118
  * Application mode determines the permission scope
@@ -100,8 +204,20 @@ interface ContextDiscoveryState {
100
204
  * Mero context value exposed by useMero hook
101
205
  */
102
206
  interface MeroContextValue {
103
- /** The MeroJs instance (null if not connected) */
104
- mero: MeroJs | null;
207
+ /**
208
+ * The connected client, or null.
209
+ *
210
+ * Two shapes, because there are two ways to connect: a node login yields a
211
+ * `MeroJs`, an account + relay connection yields a relay-transport
212
+ * `MeroClient`. Both expose `rpc` as an `ExecuteTransport`, which is what a
213
+ * generated ABI client depends on — so application logic is identical across
214
+ * the two and needs no branch.
215
+ *
216
+ * The union is deliberately not flattened behind a cast. A relay client has
217
+ * no `admin`, so code reaching for one should not typecheck as though it
218
+ * were there; narrow with {@link MeroContextValue.isDelegated} first.
219
+ */
220
+ mero: MeroJs | MeroClient | null;
105
221
  /** Whether the user is authenticated */
106
222
  isAuthenticated: boolean;
107
223
  /** Whether the connection is online */
@@ -116,6 +232,48 @@ interface MeroContextValue {
116
232
  contextIdentity: string | null;
117
233
  /** Connect to a node URL and start auth flow */
118
234
  connectToNode: (url: string) => void;
235
+ /**
236
+ * Adopt a delegated connection: an account, a device that account certified,
237
+ * and a relay that writes on its behalf.
238
+ *
239
+ * Installs the relay client immediately — there is no redirect and no token to
240
+ * wait for, because every request carries its own warrant.
241
+ */
242
+ connectWithAccount: (session: DelegatedSession) => void;
243
+ /**
244
+ * Whether the connection is delegated (account + relay) rather than a node
245
+ * login. True means `mero` is a relay-transport client, authenticated by the
246
+ * account's device certificate: `rpc` writes under warrants, and `admin` and
247
+ * `events` answer caller-scoped — this account's own contexts and namespaces,
248
+ * and events only for contexts it is a member of.
249
+ */
250
+ isDelegated: boolean;
251
+ /**
252
+ * What this connection may do, so an app asks WHAT IS ALLOWED instead of
253
+ * which transport it runs on. A node login can do everything; an account on
254
+ * a relay can create contexts (delegated creation) but not namespaces or
255
+ * invitations — those are a node's own operations today. A capability that
256
+ * later becomes available to accounts turns true here with no app change.
257
+ */
258
+ can: MeroCapabilities;
259
+ /**
260
+ * The admin API to write against, whatever the session: the node's own admin
261
+ * client on a node, the account admin (`createAccountAdmin`) on an account.
262
+ * `null` until connected.
263
+ */
264
+ admin: _calimero_network_mero_js.AdminApiClient | null;
265
+ /**
266
+ * The app's registry identity, as the provider was given it. An account
267
+ * founding a namespace names this application for it, since a namespace
268
+ * founded through a relay starts with none.
269
+ */
270
+ app: {
271
+ packageName?: string;
272
+ packageVersion?: string;
273
+ registryUrl?: string;
274
+ };
275
+ /** The cloud an account asks for routing; the hosted one when unset. */
276
+ cloudBaseUrl?: string;
119
277
  /** Logout and clear tokens */
120
278
  logout: () => void;
121
279
  /** Loading state */
@@ -133,6 +291,12 @@ interface MeroProviderConfig {
133
291
  packageVersion?: string;
134
292
  /** Registry URL (optional) */
135
293
  registryUrl?: string;
294
+ /**
295
+ * The cloud an account asks which relay serves a namespace or an account.
296
+ * Unset is the hosted cloud, which is right for every deployed app; this is
297
+ * for a local or staging setup whose namespaces the hosted cloud never saw.
298
+ */
299
+ cloudBaseUrl?: string;
136
300
  /** Request timeout in milliseconds */
137
301
  timeoutMs?: number;
138
302
  /**
@@ -155,12 +319,23 @@ interface MeroProviderConfig {
155
319
  */
156
320
  tokenStore?: TokenStore;
157
321
  }
322
+ /** See {@link MeroContextValue.can}. */
323
+ interface MeroCapabilities {
324
+ /** Found a namespace. */
325
+ readonly createNamespace: boolean;
326
+ /** Create a context inside a namespace this connection belongs to. */
327
+ readonly createContext: boolean;
328
+ /** Mint an invitation to a namespace. */
329
+ readonly invite: boolean;
330
+ /** Upgrade a group's application. A node's only: a relay carries just the first choice. */
331
+ readonly upgrade: boolean;
332
+ }
158
333
 
159
334
  declare const MeroContext: React__default.Context<MeroContextValue | null>;
160
335
  interface MeroProviderProps extends MeroProviderConfig {
161
336
  children: React__default.ReactNode;
162
337
  }
163
- declare function MeroProvider({ children, mode, packageName, packageVersion, registryUrl, timeoutMs, allowedNodeUrls, tokenStore: tokenStoreProp, }: MeroProviderProps): react_jsx_runtime.JSX.Element;
338
+ declare function MeroProvider({ children, mode, packageName, packageVersion, registryUrl, cloudBaseUrl, timeoutMs, allowedNodeUrls, tokenStore: tokenStoreProp, }: MeroProviderProps): react_jsx_runtime.JSX.Element;
164
339
  declare function useMero(): MeroContextValue;
165
340
 
166
341
  /**
@@ -273,6 +448,36 @@ interface ConnectButtonProps {
273
448
  */
274
449
  declare function ConnectButton({ connectionType, className, style, theme, logoOnly, label, }: ConnectButtonProps): react_jsx_runtime.JSX.Element;
275
450
 
451
+ interface ConnectButtonAccountProps {
452
+ className?: string;
453
+ style?: React__default.CSSProperties;
454
+ theme?: MeroTheme;
455
+ /**
456
+ * Overrides for local development. An app in production passes none of this,
457
+ * and the pane asks the person for nothing at all.
458
+ *
459
+ * Nothing here is a value an end user could know, which is precisely why none
460
+ * of it is a form field any more:
461
+ *
462
+ * - the **relay** is discovered — the certificate the enrolment returns proves
463
+ * the cloud's account→relay lookup, so there is nothing to type and a prefill
464
+ * would only be a staler second source of truth;
465
+ * - the **context** is chosen after connecting, from the account's own contexts,
466
+ * which `admin.getContexts()` answers caller-scoped through the request proof.
467
+ */
468
+ defaults?: {
469
+ /**
470
+ * Point enrolment at a wallet other than the hosted one.
471
+ *
472
+ * Exists for working ON the wallet: a wallet served from `localhost:8090`
473
+ * cannot be reached through the hosted URL, and without this the only way to
474
+ * test a wallet change would be to deploy it.
475
+ */
476
+ walletUrl?: string;
477
+ };
478
+ }
479
+ declare function ConnectButtonAccount({ className, style, theme, defaults, }: ConnectButtonAccountProps): react_jsx_runtime.JSX.Element;
480
+
276
481
  interface LoginModalProps {
277
482
  /** Callback when user connects */
278
483
  onConnect: (url: string) => void;
@@ -336,6 +541,614 @@ interface MigrationAdminPanelProps {
336
541
  */
337
542
  declare function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }: MigrationAdminPanelProps): react_jsx_runtime.JSX.Element;
338
543
 
544
+ /**
545
+ * Resolving a relay from an INVITATION rather than from an account.
546
+ *
547
+ * # The gap this closes
548
+ *
549
+ * `ConnectButtonAccount` finds a relay by asking the cloud what serves the
550
+ * *account* (`CloudClient.getAccountRelays`). A freshly enrolled account is a
551
+ * member of nothing, so that read correctly answers `[]` and the button
552
+ * correctly refuses to connect: there is nowhere to write, and a typed guess
553
+ * would be a node that refuses every warrant.
554
+ *
555
+ * But a newcomer is not stuck — they are holding an invitation, and an
556
+ * invitation names a namespace. `CloudClient.getNamespaceRouting` answers which
557
+ * nodes serve *that namespace*, and it is deliberately anonymous: a joiner has
558
+ * no cloud session, and needing one is exactly what this path exists to avoid.
559
+ * So the bootstrap order is namespace first, account second — admission is what
560
+ * makes `getAccountRelays` answer at all, not the other way round.
561
+ *
562
+ * # Two sources, one intersection, and why it must not be skipped
563
+ *
564
+ * The invitation's `admitters` list sits INSIDE the body the group admin
565
+ * signed, so it is authorization: merod answers `403` to an `/admit` from a node
566
+ * that list does not name, whatever else is true of it. The cloud's list is
567
+ * every node currently assigned to the namespace — it cannot know which
568
+ * invitation the caller holds, so it cannot filter by the signed list, and a
569
+ * node assigned *after* the invitation was minted looks perfect in every field
570
+ * the cloud reports and still refuses the claim.
571
+ *
572
+ * Intersecting here is therefore not belt-and-braces: it is the check that
573
+ * turns an unexplainable `403` into "your invitation names none of these nodes,
574
+ * ask for a fresh one". It is never relaxed to make a flow work.
575
+ *
576
+ * # `servable` and `canAdmit` are advisory; `writable` is information
577
+ *
578
+ * `servable` and `canAdmit` are derived from assignment heartbeats, and a lapsed
579
+ * heartbeat is not the same fact as a node that will refuse. Measured against
580
+ * prod: the cloud reported `servable: false, canAdmit: false, fresh: false` for a
581
+ * node whose `/admin-api/health` answered `{"status":"alive"}` and which had just
582
+ * minted the invitation being claimed. Gating on them meant refusing to knock on
583
+ * an open door, so a node with an address is tried and the NODE decides —
584
+ * `admit_join` re-verifies the invitation, the signature and the admitters list,
585
+ * so asking loosens nothing and a refusal names its own cause. `stale` on the
586
+ * result says the attempt rests on advisory data.
587
+ *
588
+ * `writable` — and its per-node form, `canExecute` — is about `CAN_AUTHOR_ON_BEHALF`,
589
+ * which admission does **not** require: relaying a join the joiner signed is not
590
+ * authoring on anyone's behalf. So a non-writable namespace is not a refusal
591
+ * here; it is reported on the result, because it is precisely why the writes
592
+ * would fail *after* connecting, and a caller that cannot tell the two apart
593
+ * sends the user to the wrong place.
594
+ */
595
+
596
+ /**
597
+ * Which step could not be completed. Each one needs a different action from the
598
+ * person, which is why this is an enum and not a message.
599
+ *
600
+ * - `admitters-lookup` — the cloud read itself failed (offline, 5xx, a refused
601
+ * routing proof). Nothing has been learned about the namespace.
602
+ * - `no-nodes` — the read succeeded and the cloud lists nothing. The namespace
603
+ * has no fleet assignment, so there is no cloud node to admit through; the
604
+ * invitation's admitters are somebody's self-hosted or desktop node, which the
605
+ * cloud neither knows nor routes to.
606
+ * - `not-invited` — nodes serve the namespace, and the invitation names none of
607
+ * them. Terminal for this invitation: ask for a fresh one.
608
+ * - `invited-unreachable` — a named node exists but cannot take a join now (no
609
+ * fresh heartbeat, or the cloud reports the namespace as not servable). A
610
+ * wait, not a wrong invitation.
611
+ * - `no-relay-url` — a named node can admit but the cloud knows no address for
612
+ * it, so there is nothing to connect through afterwards. Also a wait: it is
613
+ * the shape a node reports before its first heartbeat lands.
614
+ */
615
+ type RelayResolutionStep = 'admitters-lookup' | 'no-nodes' | 'not-invited' | 'invited-unreachable' | 'no-relay-url';
616
+ /** A relay that can take this invitation's join, and connect afterwards. */
617
+ interface ResolvedInvitationRelay {
618
+ readonly ok: true;
619
+ /** The node origin to connect through. */
620
+ readonly relayUrl: string;
621
+ /** Where to POST the signed join — the cloud's own, never rebuilt when given. */
622
+ readonly admitUrl: string;
623
+ /** The admitter's account, as the cloud reported it. */
624
+ readonly admitterAccount: string | null;
625
+ readonly peerId: string;
626
+ /**
627
+ * Whether this node can also run delegated writes (`CAN_AUTHOR_ON_BEHALF`).
628
+ *
629
+ * `false` is not a failure of admission — see the module note. It means the
630
+ * connection that follows will read and receive events but have its intents
631
+ * refused, which an admin grants away, so it is worth saying out loud.
632
+ */
633
+ readonly writable: boolean;
634
+ /** Whether the chosen node's heartbeat for this namespace has lapsed. */
635
+ readonly stale: boolean;
636
+ }
637
+ interface RelayResolutionFailure {
638
+ readonly ok: false;
639
+ readonly step: RelayResolutionStep;
640
+ /** What to go and do about it, in one sentence. */
641
+ readonly reason: string;
642
+ }
643
+ type ResolveRelayResult = ResolvedInvitationRelay | RelayResolutionFailure;
644
+ interface ResolveRelayFromInvitationInput {
645
+ /** The namespace the invitation admits you to, 64 hex. */
646
+ readonly namespaceId: string;
647
+ /**
648
+ * The invitation's signed `admitters` — `invitation.invitation.admitters`.
649
+ *
650
+ * An EMPTY list is the legacy "admission by broadcast" shape, where any ready
651
+ * peer may admit, and is treated as such. Omitting the field and passing an
652
+ * empty array are therefore the same thing on purpose: there is no spelling
653
+ * here that means "nobody may admit", because an invitation cannot say that.
654
+ */
655
+ readonly admitters?: readonly string[];
656
+ /** The delegated credential — an `AccountProof<DeviceCert>`, hex. */
657
+ readonly credential: string;
658
+ /** The certified device's ed25519 signing secret, hex. */
659
+ readonly deviceSecret: string;
660
+ /** Point at a cloud other than the hosted manager. For local rigs. */
661
+ readonly cloudBaseUrl?: string;
662
+ /** Injected in tests. Anything with the one method this needs. */
663
+ readonly cloud?: Pick<CloudClient, 'getNamespaceRouting'>;
664
+ }
665
+ /**
666
+ * Normalise a hex account for comparison: lower-cased, `0x` stripped.
667
+ *
668
+ * Both sides are hex for the same 32 bytes, and a spelling mismatch would
669
+ * present as "your invitation does not name this node" — a refusal that looks
670
+ * like policy and is really formatting.
671
+ */
672
+ declare function normaliseAccount(account: string | null | undefined): string | null;
673
+ /**
674
+ * Resolve a relay to bootstrap through, from an invitation and nothing else.
675
+ *
676
+ * Reads the cloud's routing for the namespace, intersects it with the
677
+ * invitation's signed `admitters`, and returns the node to use — or which step
678
+ * stopped it and what that means. It performs no admission and mints no keys:
679
+ * the credential passed in is the one the wallet already certified.
680
+ */
681
+ declare function resolveRelayFromInvitation(input: ResolveRelayFromInvitationInput): Promise<ResolveRelayResult>;
682
+
683
+ /**
684
+ * Present a signed join to ONE named node.
685
+ *
686
+ * This is the whole of admission for a caller with no node of its own: sign the
687
+ * membership op with the device key the account certified, and POST it to a node
688
+ * the invitation named as an admitter.
689
+ *
690
+ * POST /admin-api/namespaces/{namespaceId}/admit
691
+ * { "invitation": SignedGroupOpenInvitation, "signedOp": "<hex borsh SignedNamespaceOp>" }
692
+ *
693
+ * Verified against core at rc.43 — `crates/server/src/admin/handlers/namespaces/
694
+ * admit_join.rs`, request type `AdmitJoinApiRequest` in
695
+ * `crates/server/primitives/src/admin/mod.rs`. The handler also refuses a
696
+ * mismatch between the invitation's `group_id` and the namespace in the path, so
697
+ * the two are never allowed to disagree here.
698
+ *
699
+ * ## Why it needs no token and no proof
700
+ *
701
+ * The joiner's signature IS the authorization. The op is signed by the device
702
+ * key named in the credential it carries, and every peer checks
703
+ * `signer == credential.statement.sign_pk` before applying a join — so an
704
+ * admitter can carry this and can never author it: it cannot admit a different
705
+ * account, change the group, or grant a role. It can refuse, and that is all.
706
+ * This is also why the fleet ingress leaves the route unauthenticated, and why
707
+ * this posts with `fetch` rather than through `AdminApiClient`, which is built
708
+ * around a node credential this caller does not have.
709
+ *
710
+ * ## Why it lives here and not in mero-js
711
+ *
712
+ * Two reasons. `mero-js` is read-only for this change by instruction, and the
713
+ * shape that is actually useful to a caller is the one that hands back a
714
+ * {@link DelegatedSession} — the node that admitted you is the node to connect
715
+ * through — which is `mero-react`'s concern. The pieces that are pure SDK, the
716
+ * borsh op layout and the request type, are used from `mero-js` unchanged and
717
+ * are not reimplemented here.
718
+ *
719
+ * ## Why the op has no parents
720
+ *
721
+ * A keyholder holds no node, so it has no view of the namespace DAG and cannot
722
+ * name its heads. Empty parents is the only thing it *can* sign, and the direct
723
+ * admission path exists precisely for callers in that position.
724
+ */
725
+
726
+ /** Which step failed, when one did. */
727
+ type JoinWithNodeStep =
728
+ /** The op could not be signed. Local, deterministic, and nothing was sent. */
729
+ 'sign'
730
+ /** The node refused it, or could not be reached. */
731
+ | 'admit';
732
+ interface JoinWithNodeSuccess {
733
+ readonly ok: true;
734
+ /**
735
+ * Whether the admitter said it published the op.
736
+ *
737
+ * NOT "you are a member": membership lands when peers apply the op, which the
738
+ * admitter neither performs nor waits for.
739
+ */
740
+ readonly published: boolean;
741
+ /**
742
+ * The session to connect with — the admitting node, used immediately.
743
+ *
744
+ * Deliberately not waiting for `getAccountRelays` to answer: the fleet writes
745
+ * the account's recovery envelope asynchronously, so the cloud lookup lags the
746
+ * admission by an unpredictable amount. The node that just carried the join is
747
+ * known to serve this namespace right now, which is a better answer than a
748
+ * lookup that will agree later.
749
+ */
750
+ readonly session: DelegatedSession;
751
+ }
752
+ interface JoinWithNodeFailure {
753
+ readonly ok: false;
754
+ readonly step: JoinWithNodeStep;
755
+ readonly reason: string;
756
+ /** The HTTP status, when the node answered with one. */
757
+ readonly status?: number;
758
+ }
759
+ type JoinWithNodeResult = JoinWithNodeSuccess | JoinWithNodeFailure;
760
+ interface JoinWithNodeInput {
761
+ /**
762
+ * The node to present the join to — its admin API origin.
763
+ *
764
+ * The primary parameter, so all three sources of a node URL feed one method:
765
+ * one carried by the invitation (core emits only libp2p multiaddrs today —
766
+ * see `resolve_admitter_addrs`, a node cannot know the URL its admin API is
767
+ * proxied on — so this is the seam for when invitations carry a claim URL),
768
+ * one resolved from the cloud's `/admitters` lookup, and one an operator
769
+ * simply knows.
770
+ */
771
+ readonly nodeUrl: string;
772
+ /**
773
+ * The exact URL to POST to, when something already knows it.
774
+ *
775
+ * The cloud hands back a ready-made `admit_url` which need not be a path on
776
+ * `nodeUrl`'s origin, and rebuilding it from a guess is how a working
777
+ * admission becomes a 404. Omitted, the documented route on `nodeUrl` is used.
778
+ */
779
+ readonly admitUrl?: string;
780
+ /** The namespace being joined, 64 hex. Must match the invitation's group. */
781
+ readonly namespaceId: string;
782
+ /**
783
+ * The invitation, exactly as the inviter's node returned it.
784
+ *
785
+ * Passed through unchanged and never rebuilt field by field: the signature
786
+ * covers the body, and re-modelling it through a local type drops the unsigned
787
+ * bootstrap fields and invalidates the signature with them.
788
+ */
789
+ readonly invitation: SignedGroupOpenInvitation;
790
+ /** The enrolled account, its certificate, and the device secret that signs. */
791
+ readonly credential: DelegatedCredential;
792
+ /** Injected in tests. */
793
+ readonly deps?: {
794
+ readonly fetch?: typeof fetch;
795
+ readonly nonce?: () => Promise<bigint>;
796
+ };
797
+ }
798
+ /**
799
+ * Sign the membership op and present it to `nodeUrl`.
800
+ *
801
+ * Resolves rather than throws for every expected refusal, because they are
802
+ * different things for the person to do: a malformed op is final, an unreachable
803
+ * node is a retry, and a 409 means pick another admitter.
804
+ */
805
+ declare function joinWithNode(input: JoinWithNodeInput): Promise<JoinWithNodeResult>;
806
+
807
+ /**
808
+ * Bootstrapping an account that is a member of nothing, from an invitation.
809
+ *
810
+ * # The one missing step
811
+ *
812
+ * A freshly enrolled account holds a certified device and belongs to no
813
+ * namespace, so `CloudClient.getAccountRelays` answers `[]` — correctly, because
814
+ * nothing serves an account that is a member of nothing. It is still signed in;
815
+ * what it has no way to do is write. An invitation is what changes that, and the
816
+ * chain is:
817
+ *
818
+ * invitation → namespaceId → a node URL
819
+ * → POST the signed join to that node → the account is a member
820
+ * → that same node is the relay, from this moment
821
+ * → a fleet relay writes the recovery envelope asynchronously,
822
+ * and getAccountRelays() agrees from then on
823
+ *
824
+ * The session does not wait for the cloud to catch up. The node that carried the
825
+ * join is known to serve the namespace now; the lookup will agree later.
826
+ *
827
+ * # Where the node URL comes from, in preference order
828
+ *
829
+ * 1. one passed in — an operator's, or one a future invitation carries. Core
830
+ * today emits only libp2p multiaddrs on an invitation (`resolve_admitter_addrs`)
831
+ * because a node cannot know the URL its admin API is proxied on, so there is
832
+ * nothing to read off the invitation yet and this is the seam for when there
833
+ * is;
834
+ * 2. the cloud's `/api/cloud/namespaces/{ns}/admitters`, intersected with the
835
+ * invitation's signed `admitters` — see `resolveRelayFromInvitation`.
836
+ *
837
+ * # Nothing here is minted, weakened or worked around
838
+ *
839
+ * The credential and the device secret come from the enrolment the wallet
840
+ * already performed. The op is signed by that device key, which is what stops an
841
+ * admitter substituting a different member. The admitters intersection is done in
842
+ * `resolveRelayFromInvitation` and is never relaxed.
843
+ */
844
+
845
+ /**
846
+ * Which step failed. One exhaustive list to branch on: the relay-resolution
847
+ * steps, the two `joinWithNode` reports, and the one only a hook can hit.
848
+ *
849
+ * - `no-credential` — this tab holds no enrolled account, so there is nothing to
850
+ * admit. Only {@link useDelegatedBootstrap} can report it;
851
+ * `bootstrapFromInvitation` is handed the credential as an argument.
852
+ */
853
+ type BootstrapStep = RelayResolutionStep | JoinWithNodeStep | 'no-credential';
854
+ interface BootstrapSuccess {
855
+ readonly ok: true;
856
+ /** The session to connect with — hand it straight to `connectWithAccount`. */
857
+ readonly session: DelegatedSession;
858
+ /**
859
+ * How the node was chosen, when the cloud chose it.
860
+ *
861
+ * `null` when the caller named the node itself, because then there was no
862
+ * routing read to report — not because anything was skipped.
863
+ */
864
+ readonly relay: ResolvedInvitationRelay | null;
865
+ /**
866
+ * Whether the admitter said it published the op.
867
+ *
868
+ * NOT "you are a member": membership lands when peers apply the op, which the
869
+ * admitter neither performs nor waits for. `false` with no error means the node
870
+ * took the call and did not publish — worth surfacing rather than treating as
871
+ * success.
872
+ */
873
+ readonly published: boolean;
874
+ }
875
+ interface BootstrapFailure {
876
+ readonly ok: false;
877
+ readonly step: BootstrapStep;
878
+ readonly reason: string;
879
+ /** The HTTP status, when the failing step was an HTTP call. */
880
+ readonly status?: number;
881
+ }
882
+ type BootstrapResult = BootstrapSuccess | BootstrapFailure;
883
+ interface BootstrapFromInvitationInput {
884
+ /** The namespace the invitation admits you to, 64 hex. */
885
+ readonly namespaceId: string;
886
+ /** The invitation, exactly as the inviter's node returned it. */
887
+ readonly invitation: SignedGroupOpenInvitation;
888
+ /** The enrolled account, its certificate, and the device secret. */
889
+ readonly credential: DelegatedCredential;
890
+ /**
891
+ * A node to present the join to, skipping the cloud lookup.
892
+ *
893
+ * Use it when something already knows the node — an operator, a local rig, or
894
+ * an invitation that carries a claim URL once core emits one. Without it the
895
+ * cloud's admitters lookup answers, and the invitation's signed list is what
896
+ * narrows the answer.
897
+ */
898
+ readonly nodeUrl?: string;
899
+ /** Point at a cloud other than the hosted manager. For local rigs. */
900
+ readonly cloudBaseUrl?: string;
901
+ /** Injected in tests. */
902
+ readonly deps?: {
903
+ readonly resolve?: typeof resolveRelayFromInvitation;
904
+ readonly join?: typeof joinWithNode;
905
+ readonly fetch?: typeof fetch;
906
+ readonly nonce?: () => Promise<bigint>;
907
+ };
908
+ }
909
+ /**
910
+ * Resolve a node from the invitation, present the signed join to it, and return
911
+ * the session to connect with.
912
+ *
913
+ * Never throws for an expected failure: every one of them is a different thing
914
+ * for the person to do, so they come back as `{ ok: false, step, reason }`. A
915
+ * generic "could not join" is exactly what this shape exists to prevent.
916
+ */
917
+ declare function bootstrapFromInvitation(input: BootstrapFromInvitationInput): Promise<BootstrapResult>;
918
+
919
+ /**
920
+ * The delegated connect path, entered from an invitation instead of an account.
921
+ *
922
+ * `ConnectButtonAccount` enrols the device and then asks the cloud which relays
923
+ * serve the ACCOUNT. For a first-time account that answer is `[]` and there is
924
+ * nothing to connect to — correctly, since nothing yet serves an account that is
925
+ * a member of nothing. This hook is the other door into the same connection: it
926
+ * takes an invitation, resolves a relay from the NAMESPACE, presents the signed
927
+ * join, and then connects through the node that carried it.
928
+ *
929
+ * It is `MeroContext`'s own `connectWithAccount` at the end, not a second
930
+ * connection mechanism — the only difference is how the relay was found.
931
+ */
932
+
933
+ interface UseDelegatedBootstrapOptions {
934
+ /** Point at a cloud other than the hosted manager. For local rigs. */
935
+ readonly cloudBaseUrl?: string;
936
+ }
937
+ interface UseDelegatedBootstrapResult {
938
+ /** The enrolled account and its certificate, or `null` if none was ever held. */
939
+ readonly credential: DelegatedCredential | null;
940
+ /**
941
+ * Whether this account is signed in with nowhere to write.
942
+ *
943
+ * True means: an enrolled credential is held and no relay is known for it, so
944
+ * the account→relay lookup has nothing and an invitation is what changes that.
945
+ * Being signed in is NOT the missing part — that is the whole point, since you
946
+ * have to be signed in to be invited.
947
+ *
948
+ * False covers "already has a relay" and "never enrolled", which need the two
949
+ * other entry points rather than this one.
950
+ */
951
+ readonly needsBootstrap: boolean;
952
+ readonly running: boolean;
953
+ /** The last attempt's outcome, kept so a UI can name the failing step. */
954
+ readonly result: BootstrapResult | null;
955
+ /**
956
+ * Admit this account to the invitation's namespace and connect through the
957
+ * admitting node.
958
+ *
959
+ * Resolves rather than throws for every expected refusal: the step names are
960
+ * the point, because an empty intersection, an unreachable admitter and a
961
+ * namespace with no fleet assignment need three different actions.
962
+ */
963
+ readonly bootstrap: (input: {
964
+ readonly namespaceId: string;
965
+ readonly invitation: SignedGroupOpenInvitation;
966
+ /**
967
+ * A node to present the join to, skipping the cloud lookup — an operator's,
968
+ * a local rig's, or one a future invitation carries.
969
+ */
970
+ readonly nodeUrl?: string;
971
+ /** The context the invitation is for, so its relay is known before any listing. */
972
+ readonly contextId?: string;
973
+ }) => Promise<BootstrapResult>;
974
+ }
975
+ declare function useDelegatedBootstrap(options?: UseDelegatedBootstrapOptions): UseDelegatedBootstrapResult;
976
+
977
+ /**
978
+ * An account's governance through the relay that serves its namespace: create
979
+ * a context, and the group ops a private context (a DM) needs.
980
+ *
981
+ * A thin layer over mero-js's `RelayClient.createContext` / `govern` (core's
982
+ * `/admin-api/groups/{group}/context-intents` and `.../governance-intents`),
983
+ * adding what only this package knows: which relay serves the namespace (the
984
+ * relay map), and the nonce bookkeeping across page loads.
985
+ *
986
+ * Nodes check the AUTHOR's rights (CAN_CREATE_CONTEXT, CAN_CREATE_SUBGROUP,
987
+ * MANAGE_MEMBERS…), never the relay's; the relay only needs standing to act.
988
+ */
989
+
990
+ interface CreateDelegatedContextRequest {
991
+ readonly namespaceId: string;
992
+ /** The group to create it in; the namespace itself when omitted. */
993
+ readonly groupId?: string;
994
+ readonly applicationId: string;
995
+ readonly initializationParams?: number[];
996
+ readonly name?: string;
997
+ }
998
+ declare function createDelegatedContext(s: DelegatedSession, req: CreateDelegatedContextRequest, deps?: {
999
+ fetch?: typeof fetch;
1000
+ }): Promise<{
1001
+ contextId: string;
1002
+ }>;
1003
+ /**
1004
+ * Found a namespace as the account, through a relay it already uses. The
1005
+ * account becomes founder, owner and admin; the relay is seated in it (and a
1006
+ * TEE relay admits itself as its first TEE), so contexts can be created in it
1007
+ * through the same relay straight away.
1008
+ *
1009
+ * The relay's executor account cannot be asked about a namespace that does
1010
+ * not exist yet, so it is learned from one the account already has on that
1011
+ * relay. A brand-new account, in nothing yet, is told to join one first.
1012
+ */
1013
+ declare function foundDelegatedNamespace(s: DelegatedSession, req?: {
1014
+ readonly defaultCapabilities?: number;
1015
+ /** The application the namespace runs; without one no context can be created in it. */
1016
+ readonly application?: {
1017
+ applicationId: string;
1018
+ package: string;
1019
+ version: string;
1020
+ };
1021
+ }, deps?: {
1022
+ fetch?: typeof fetch;
1023
+ }): Promise<{
1024
+ namespaceId: string;
1025
+ teeEnabled: boolean;
1026
+ }>;
1027
+
1028
+ /**
1029
+ * An account's group management through a relay: one delegated governance op
1030
+ * per call (`RelayClient.govern`), posted to the relay that serves the group's
1031
+ * namespace.
1032
+ *
1033
+ * A group op goes to the group it acts on; a root op (create, delete, move a
1034
+ * subgroup; join an open one) goes to the NAMESPACE. An account cannot read a
1035
+ * group's details, so the namespace of a subgroup is known only if this
1036
+ * account created it or was told it — remembered here per account.
1037
+ */
1038
+
1039
+ /** A group op (member, role, capabilities, metadata, visibility, detach) on `groupId`. */
1040
+ declare function governGroup(s: DelegatedSession, groupId: string, op: GovernanceOp): Promise<{
1041
+ groupId: string;
1042
+ }>;
1043
+ /** A root op, posted to the namespace `groupId` belongs to. */
1044
+ declare function governRoot(s: DelegatedSession, groupId: string, op: GovernanceOp): Promise<{
1045
+ groupId: string;
1046
+ }>;
1047
+
1048
+ /**
1049
+ * An account's admin API: the same method names and types as mero-js's
1050
+ * `AdminApiClient`, so an app written against a node's admin needs no second
1051
+ * code path. Reads go to the relay's caller-scoped admin client; writes go
1052
+ * through the relay as governance ops, delegated context and namespace
1053
+ * creation, or an invitation the account signs itself. A write with no
1054
+ * account form (upgrades, installs) is refused by name.
1055
+ */
1056
+
1057
+ declare class NotForAccountError extends Error {
1058
+ readonly method: string;
1059
+ constructor(method: string);
1060
+ }
1061
+ /**
1062
+ * An account that has enrolled but joined nothing has no relay: nothing serves
1063
+ * it yet. Its listings are empty, which is true; anything else names this.
1064
+ */
1065
+ declare class NoRelayError extends Error {
1066
+ readonly method: string;
1067
+ constructor(method: string);
1068
+ }
1069
+ interface AccountAdminDeps {
1070
+ govern?: {
1071
+ group: typeof governGroup;
1072
+ root: typeof governRoot;
1073
+ };
1074
+ createContext?: typeof createDelegatedContext;
1075
+ found?: typeof foundDelegatedNamespace;
1076
+ latestVersion?: (registryUrl: string, pkg: string) => Promise<string>;
1077
+ signInvitation?: typeof signGroupInvitation;
1078
+ }
1079
+ declare function createAccountAdmin(input: {
1080
+ session: DelegatedSession;
1081
+ read: AdminApiClient | null;
1082
+ app: {
1083
+ packageName?: string;
1084
+ packageVersion?: string;
1085
+ registryUrl?: string;
1086
+ };
1087
+ }, deps?: AccountAdminDeps): AdminApiClient;
1088
+
1089
+ /**
1090
+ * A node's admin API, as an app writes against it: mero-js's `AdminApiClient`
1091
+ * with `createNamespace` made whole. On a node a namespace can only be created
1092
+ * for an application the node already holds, so this installs the provider's
1093
+ * package from the registry first when it is missing — the step an account
1094
+ * never sees, because founding through a relay names the package and the relay
1095
+ * fetches it. Same call, same result, on both.
1096
+ */
1097
+
1098
+ interface NodeAdminDeps {
1099
+ latestVersion?: (registryUrl: string, pkg: string) => Promise<string>;
1100
+ }
1101
+ declare function createNodeAdmin(input: {
1102
+ admin: AdminApiClient;
1103
+ app: {
1104
+ packageName?: string;
1105
+ packageVersion?: string;
1106
+ registryUrl?: string;
1107
+ };
1108
+ }, deps?: NodeAdminDeps): AdminApiClient;
1109
+
1110
+ interface JoinInvitationInput {
1111
+ readonly namespaceId: string;
1112
+ /** The context the invitation was for, when it names one; a workspace invitation names none. */
1113
+ readonly contextId?: string;
1114
+ readonly invitation: SignedGroupOpenInvitation;
1115
+ }
1116
+ type JoinInvitationStep = BootstrapFailure['step'] | 'node-join';
1117
+ type JoinInvitationResult = {
1118
+ readonly ok: true;
1119
+ } | {
1120
+ readonly ok: false;
1121
+ readonly step: JoinInvitationStep;
1122
+ /** What went wrong, in words a person can act on. */
1123
+ readonly reason: string;
1124
+ /** True when no retry can succeed: a fresh invitation is the only cure. */
1125
+ readonly final: boolean;
1126
+ /** The HTTP status of the refusal, when there was one. */
1127
+ readonly status?: number;
1128
+ };
1129
+ /**
1130
+ * Whether a node's join failure means the invitation itself will never work.
1131
+ *
1132
+ * Errs toward false: a dropped invitation is unrecoverable for the user, a
1133
+ * retried one costs a round trip, so a timeout or anything unfamiliar keeps
1134
+ * it. Phrases, not bare words — `"invalid"` alone would also match an
1135
+ * "invalid response" from a proxy, a transient failure.
1136
+ */
1137
+ declare function isFinalInvitationError(message: string | undefined | null): boolean;
1138
+ declare function useJoinInvitation(): {
1139
+ joinInvitation: (input: JoinInvitationInput) => Promise<JoinInvitationResult>;
1140
+ joining: boolean;
1141
+ /** The namespaces this connection is a member of: a node's own, or an account's across its relays. */
1142
+ memberships: () => Promise<string[]>;
1143
+ /**
1144
+ * The `{ join, memberships }` pair mero-js's `redeemInvitation` drives, for
1145
+ * whichever connection this is, so an app redeems an invitation (join once,
1146
+ * then check membership) with no transport of its own. `join` throws on a
1147
+ * refusal, carrying its HTTP status for the outcome's reason.
1148
+ */
1149
+ invitationRedeemer: (input: JoinInvitationInput) => InviteRedeemer;
1150
+ };
1151
+
339
1152
  interface UseEphemeralOptions<T> {
340
1153
  /** Encoding for the presence slice. Defaults to JSON. */
341
1154
  codec?: Codec<T>;
@@ -474,7 +1287,33 @@ declare function useGroupCapabilities(groupId?: string | null, memberId?: string
474
1287
  };
475
1288
  declare function useContextDiscovery(options: ContextDiscoveryOptions): ContextDiscoveryState;
476
1289
  declare function useCreateContext(): {
477
- createContext: (request: CreateContextRequest) => Promise<_calimero_network_mero_js.CreateContextResponseData | null>;
1290
+ createContext: (request: CreateContextRequest) => Promise<{
1291
+ contextId: string;
1292
+ } | null>;
1293
+ loading: boolean;
1294
+ error: Error | null;
1295
+ };
1296
+ interface CreatePrivateContextRequest {
1297
+ readonly namespaceId: string;
1298
+ readonly applicationId: string;
1299
+ /** The accounts that share it with you, and nobody else — e.g. the other person of a DM. */
1300
+ readonly members: readonly string[];
1301
+ readonly initializationParams?: number[];
1302
+ }
1303
+ /**
1304
+ * Create a context only you and `members` are in (a DM, a small room): its own
1305
+ * restricted group in the namespace, members added directly — they are in the
1306
+ * namespace already, so nobody is invited. Same call on either connection:
1307
+ *
1308
+ * - a node login makes the group, adds the members and creates the context
1309
+ * with its own admin calls (as mero-chat's DMs do);
1310
+ * - an account has the relay serving the namespace do the same three steps,
1311
+ * each under its own warrant (delegated/create-context.ts).
1312
+ */
1313
+ declare function useCreatePrivateContext(): {
1314
+ createPrivateContext: (request: CreatePrivateContextRequest) => Promise<{
1315
+ contextId: string;
1316
+ } | null>;
478
1317
  loading: boolean;
479
1318
  error: Error | null;
480
1319
  };
@@ -495,7 +1334,11 @@ declare function useJoinContext(options?: MutationOptions): {
495
1334
  failure: ClassifiedError | null;
496
1335
  };
497
1336
  declare function useJoinSubgroupInheritance(): {
498
- joinSubgroupInheritance: (groupId: string) => Promise<_calimero_network_mero_js.JoinSubgroupInheritanceResponseData | null>;
1337
+ joinSubgroupInheritance: (groupId: string) => Promise<{
1338
+ groupId: string;
1339
+ memberPublicKey: string;
1340
+ wasInherited: boolean;
1341
+ } | null>;
499
1342
  loading: boolean;
500
1343
  error: Error | null;
501
1344
  };
@@ -512,7 +1355,9 @@ declare function useGroupInfo(groupId?: string | null): {
512
1355
  refetch: () => Promise<void>;
513
1356
  };
514
1357
  declare function useDeleteGroup(): {
515
- deleteGroup: (groupId: string) => Promise<_calimero_network_mero_js.DeleteGroupResponseData | null>;
1358
+ deleteGroup: (groupId: string) => Promise<{
1359
+ groupId: string;
1360
+ } | _calimero_network_mero_js.DeleteGroupResponseData | null>;
516
1361
  loading: boolean;
517
1362
  error: Error | null;
518
1363
  };
@@ -585,7 +1430,10 @@ declare function useNamespacesForApplication(applicationId?: string | null): {
585
1430
  refetch: () => Promise<void>;
586
1431
  };
587
1432
  declare function useCreateNamespace(): {
588
- createNamespace: (request: CreateNamespaceRequest) => Promise<_calimero_network_mero_js.CreateNamespaceResponseData | null>;
1433
+ createNamespace: (request: CreateNamespaceRequest) => Promise<{
1434
+ namespaceId: string;
1435
+ teeEnabled: boolean;
1436
+ } | _calimero_network_mero_js.CreateNamespaceResponseData | null>;
589
1437
  loading: boolean;
590
1438
  error: Error | null;
591
1439
  };
@@ -634,7 +1482,9 @@ declare function useRedeemInvitation(): {
634
1482
  loading: boolean;
635
1483
  };
636
1484
  declare function useCreateGroupInNamespace(): {
637
- createGroupInNamespace: (namespaceId: string, request?: CreateGroupInNamespaceRequest) => Promise<_calimero_network_mero_js.CreateGroupInNamespaceResponseData | null>;
1485
+ createGroupInNamespace: (namespaceId: string, request?: CreateGroupInNamespaceRequest) => Promise<{
1486
+ groupId: string;
1487
+ } | null>;
638
1488
  loading: boolean;
639
1489
  error: Error | null;
640
1490
  };
@@ -650,17 +1500,23 @@ declare function useNamespaceGroups(namespaceId?: string | null): {
650
1500
  * Both are 32-byte strings, so passing a key names nobody and raises nothing.
651
1501
  */
652
1502
  declare function useUpdateMemberRole(): {
653
- updateMemberRole: (groupId: string, identity: string, request: UpdateMemberRoleRequest) => Promise<void | null>;
1503
+ updateMemberRole: (groupId: string, identity: string, request: UpdateMemberRoleRequest) => Promise<void | {
1504
+ groupId: string;
1505
+ } | null>;
654
1506
  loading: boolean;
655
1507
  error: Error | null;
656
1508
  };
657
1509
  declare function useSetDefaultCapabilities(): {
658
- setDefaultCapabilities: (groupId: string, request: SetDefaultCapabilitiesRequest) => Promise<void | null>;
1510
+ setDefaultCapabilities: (groupId: string, request: SetDefaultCapabilitiesRequest) => Promise<void | {
1511
+ groupId: string;
1512
+ } | null>;
659
1513
  loading: boolean;
660
1514
  error: Error | null;
661
1515
  };
662
1516
  declare function useSetSubgroupVisibility(): {
663
- setSubgroupVisibility: (groupId: string, request: SetSubgroupVisibilityRequest) => Promise<void | null>;
1517
+ setSubgroupVisibility: (groupId: string, request: SetSubgroupVisibilityRequest) => Promise<void | {
1518
+ groupId: string;
1519
+ } | null>;
664
1520
  loading: boolean;
665
1521
  error: Error | null;
666
1522
  };
@@ -682,7 +1538,9 @@ declare function useSetTeeAdmissionPolicy(): {
682
1538
  error: Error | null;
683
1539
  };
684
1540
  declare function useSetGroupMetadata(): {
685
- setGroupMetadata: (groupId: string, request: SetMetadataInput) => Promise<void | null>;
1541
+ setGroupMetadata: (groupId: string, request: SetMetadataInput) => Promise<void | {
1542
+ groupId: string;
1543
+ } | null>;
686
1544
  loading: boolean;
687
1545
  error: Error | null;
688
1546
  };
@@ -692,12 +1550,16 @@ declare function useSetGroupMetadata(): {
692
1550
  * Both are 32-byte strings, so passing a key names nobody and raises nothing.
693
1551
  */
694
1552
  declare function useSetMemberMetadata(): {
695
- setMemberMetadata: (groupId: string, identity: string, request: SetMetadataInput) => Promise<void | null>;
1553
+ setMemberMetadata: (groupId: string, identity: string, request: SetMetadataInput) => Promise<void | {
1554
+ groupId: string;
1555
+ } | null>;
696
1556
  loading: boolean;
697
1557
  error: Error | null;
698
1558
  };
699
1559
  declare function useSetContextMetadata(): {
700
- setContextMetadata: (groupId: string, contextId: string, request: SetMetadataInput) => Promise<void | null>;
1560
+ setContextMetadata: (groupId: string, contextId: string, request: SetMetadataInput) => Promise<void | {
1561
+ groupId: string;
1562
+ } | null>;
701
1563
  loading: boolean;
702
1564
  error: Error | null;
703
1565
  };
@@ -752,7 +1614,9 @@ declare function useRetryGroupUpgrade(): {
752
1614
  };
753
1615
  /** Move `childGroupId` under a new parent. */
754
1616
  declare function useReparentGroup(): {
755
- reparentGroup: (childGroupId: string, request: ReparentGroupRequest) => Promise<_calimero_network_mero_js.ReparentGroupResponseData | null>;
1617
+ reparentGroup: (childGroupId: string, request: ReparentGroupRequest) => Promise<{
1618
+ reparented: boolean;
1619
+ } | null>;
756
1620
  loading: boolean;
757
1621
  error: Error | null;
758
1622
  };
@@ -763,7 +1627,9 @@ declare function useSubgroups(groupId?: string | null): {
763
1627
  refetch: () => Promise<void>;
764
1628
  };
765
1629
  declare function useDetachContextFromGroup(): {
766
- detachContextFromGroup: (groupId: string, contextId: string) => Promise<void | null>;
1630
+ detachContextFromGroup: (groupId: string, contextId: string) => Promise<void | {
1631
+ groupId: string;
1632
+ } | null>;
767
1633
  loading: boolean;
768
1634
  error: Error | null;
769
1635
  };
@@ -1066,4 +1932,4 @@ declare function clearContextIdentity(): void;
1066
1932
  */
1067
1933
  declare function clearAllStorage(): void;
1068
1934
 
1069
- export { type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type ExecutionResult, LoginModal, type LoginModalProps, MERO_CSS_VARS, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseBlobUrlOptions, type UseEphemeralOptions, type UseEphemeralResult, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, localStorageTokenStorage, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useDefaultCapabilities, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
1935
+ export { type AccountAdminDeps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, type BootstrapFailure, type BootstrapFromInvitationInput, type BootstrapResult, type BootstrapStep, type BootstrapSuccess, CalimeroLogo, type CalimeroLogoProps, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type DelegatedCredential, type DelegatedSession, type ExecutionResult, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, type JoinWithNodeFailure, type JoinWithNodeInput, type JoinWithNodeResult, type JoinWithNodeStep, type JoinWithNodeSuccess, LoginModal, type LoginModalProps, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, NoRelayError, NotForAccountError, type RelayResolutionFailure, type RelayResolutionStep, type ResolveRelayFromInvitationInput, type ResolveRelayResult, type ResolvedInvitationRelay, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createAccountAdmin, createDelegatedContext, createNodeAdmin, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, isFinalInvitationError, joinWithNode, listDelegatedContexts, localStorageTokenStorage, normaliseAccount, pinRelayNodeKey, readDelegatedCredential, readPinnedRelayNodeKey, readRelayMap, relayForContext, rememberRelay, resolveMeroTheme, resolveRelayFromInvitation, saveDelegatedCredential, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };