@calimero-network/mero-react 9.11.3 → 9.11.5
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.cjs +135 -1222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -750
- package/dist/index.d.ts +5 -750
- package/dist/index.js +8 -1167
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.d.cts
CHANGED
|
@@ -2,128 +2,9 @@ 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 { MeroClient,
|
|
5
|
+
import { MeroJs, MeroClient, DelegatedAccountSession, TokenStore, DelegatedCredential, BootstrapResult, SignedGroupOpenInvitation, BootstrapFailure, 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
|
-
export { CAPABILITIES, Codec, DEFAULT_LOCAL_NODE_PORTS, DiscoverLocalNodesOptions, EphemeralClient, EphemeralEntry, MetadataRecord, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
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
|
-
* The relay's executor account, hex, when the app knows it — the cloud's
|
|
71
|
-
* machine page names it beside the relay's address.
|
|
72
|
-
*
|
|
73
|
-
* Founding a namespace through a relay names the relay's account in the
|
|
74
|
-
* warrant, and a namespace that does not exist yet cannot be asked for it.
|
|
75
|
-
* Without this the account learns it from a namespace it is already in, so a
|
|
76
|
-
* brand-new account would have to join one first; with it, the account founds
|
|
77
|
-
* on `relayUrl` directly.
|
|
78
|
-
*/
|
|
79
|
-
executorAccount?: string | null;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* The enrolled credential, whether or not a relay was ever found for it.
|
|
83
|
-
*
|
|
84
|
-
* A connected session is authoritative: it carries the same three fields and a
|
|
85
|
-
* relay, so it is read first and the standalone record is the fallback. Without
|
|
86
|
-
* that order a stale record from an earlier enrolment could out-rank the account
|
|
87
|
-
* actually connected.
|
|
88
|
-
*/
|
|
89
|
-
declare function readDelegatedCredential(): DelegatedCredential | null;
|
|
90
|
-
declare function saveDelegatedCredential(c: DelegatedCredential): void;
|
|
91
|
-
declare function clearDelegatedCredential(): void;
|
|
92
|
-
/**
|
|
93
|
-
* Pin a relay's device signing key, hex (32 bytes), learned out of band.
|
|
94
|
-
*
|
|
95
|
-
* `login()` binds the session to this key, and it must never be read from the
|
|
96
|
-
* relay being logged in to — the answering party would choose what the device
|
|
97
|
-
* signs about. Until the cloud publishes it (mdma#312), it comes from the
|
|
98
|
-
* relay's operator.
|
|
99
|
-
*/
|
|
100
|
-
declare function pinRelayNodeKey(relayUrl: string, nodeKey: string): void;
|
|
101
|
-
/** The pinned key for a relay, or `null` if none was pinned. */
|
|
102
|
-
declare function readPinnedRelayNodeKey(relayUrl: string): string | null;
|
|
103
|
-
interface RelayMap {
|
|
104
|
-
namespaces: Record<string, string>;
|
|
105
|
-
contexts: Record<string, string>;
|
|
106
|
-
}
|
|
107
|
-
declare function readRelayMap(account: string): RelayMap;
|
|
108
|
-
/** Record the relay that admitted this account to a namespace (and, when known, the context it came for). */
|
|
109
|
-
declare function rememberRelay(account: string, relayUrl: string, at: {
|
|
110
|
-
namespaceId?: string;
|
|
111
|
-
contextId?: string;
|
|
112
|
-
}): void;
|
|
113
|
-
/** The relay that serves a context, if this account has learned it. */
|
|
114
|
-
declare function relayForContext(account: string, contextId: string): string | null;
|
|
115
|
-
type ListedContext = Awaited<ReturnType<MeroClient['admin']['getContexts']>>['contexts'][number];
|
|
116
|
-
/**
|
|
117
|
-
* This account's contexts on every relay it knows, each tagged with the relay
|
|
118
|
-
* that listed it — and that relay recorded as the one serving it.
|
|
119
|
-
*
|
|
120
|
-
* Each relay answers only for itself and only for this caller, so the union is
|
|
121
|
-
* exactly the account's contexts across relays. A relay that cannot be reached
|
|
122
|
-
* or logged in to is skipped (its contexts simply do not appear), not fatal.
|
|
123
|
-
*/
|
|
124
|
-
declare function listDelegatedContexts(s: DelegatedSession): Promise<Array<ListedContext & {
|
|
125
|
-
relayUrl: string;
|
|
126
|
-
}>>;
|
|
7
|
+
export { AccountAdminDeps, BootstrapFailure, BootstrapFromInvitationInput, BootstrapResult, BootstrapStep, BootstrapSuccess, CAPABILITIES, Codec, DEFAULT_LOCAL_NODE_PORTS, DelegatedCredential, DelegatedAccountSession as DelegatedSession, DiscoverLocalNodesOptions, EphemeralClient, EphemeralEntry, FoundedDelegatedNamespace, HA_ACCOUNT_NOT_LINKED_MESSAGE, HA_REFUSAL_MESSAGES, InvitationNotClaimableError, JoinWithNodeFailure, JoinWithNodeInput, JoinWithNodeResult, JoinWithNodeStep, JoinWithNodeSuccess, MetadataRecord, NoRelayError, NotForAccountError, RegistryBundle, RelayResolutionFailure, RelayResolutionStep, ResolveRelayFromInvitationInput, ResolveRelayResult, ResolvedApplication, ResolvedInvitationRelay, applicationIdForBundle, bootstrapFromInvitation, clearDelegatedCredential, createAccountAdmin, createDelegatedContext, createNodeAdmin, discoverLocalNodes, hasCap, joinWithNode, listDelegatedContexts, localNodeUrl, nodeEndpoint, normaliseAccount, pinRelayNodeKey, probeNodeHealth, readDelegatedCredential, readPinnedRelayNodeKey, readRelayMap, relayForContext, rememberRelay, resolveApplicationIdFromRegistry, resolveRelayFromInvitation, saveDelegatedCredential, selectLatestBundle, withCap, withoutCap } from '@calimero-network/mero-js';
|
|
127
8
|
|
|
128
9
|
/**
|
|
129
10
|
* Application mode determines the permission scope
|
|
@@ -250,7 +131,7 @@ interface MeroContextValue {
|
|
|
250
131
|
* Installs the relay client immediately — there is no redirect and no token to
|
|
251
132
|
* wait for, because every request carries its own warrant.
|
|
252
133
|
*/
|
|
253
|
-
connectWithAccount: (session:
|
|
134
|
+
connectWithAccount: (session: DelegatedAccountSession) => void;
|
|
254
135
|
/**
|
|
255
136
|
* Whether the connection is delegated (account + relay) rather than a node
|
|
256
137
|
* login. True means `mero` is a relay-transport client, authenticated by the
|
|
@@ -619,381 +500,6 @@ interface MigrationAdminPanelProps {
|
|
|
619
500
|
*/
|
|
620
501
|
declare function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }: MigrationAdminPanelProps): react_jsx_runtime.JSX.Element;
|
|
621
502
|
|
|
622
|
-
/**
|
|
623
|
-
* Resolving a relay from an INVITATION rather than from an account.
|
|
624
|
-
*
|
|
625
|
-
* # The gap this closes
|
|
626
|
-
*
|
|
627
|
-
* `ConnectButtonAccount` finds a relay by asking the cloud what serves the
|
|
628
|
-
* *account* (`CloudClient.getAccountRelays`). A freshly enrolled account is a
|
|
629
|
-
* member of nothing, so that read correctly answers `[]` and the button
|
|
630
|
-
* correctly refuses to connect: there is nowhere to write, and a typed guess
|
|
631
|
-
* would be a node that refuses every warrant.
|
|
632
|
-
*
|
|
633
|
-
* But a newcomer is not stuck — they are holding an invitation, and an
|
|
634
|
-
* invitation names a namespace. `CloudClient.getNamespaceRouting` answers which
|
|
635
|
-
* nodes serve *that namespace*, and it is deliberately anonymous: a joiner has
|
|
636
|
-
* no cloud session, and needing one is exactly what this path exists to avoid.
|
|
637
|
-
* So the bootstrap order is namespace first, account second — admission is what
|
|
638
|
-
* makes `getAccountRelays` answer at all, not the other way round.
|
|
639
|
-
*
|
|
640
|
-
* # Two sources, one intersection, and why it must not be skipped
|
|
641
|
-
*
|
|
642
|
-
* The invitation's `admitters` list sits INSIDE the body the group admin
|
|
643
|
-
* signed, so it is authorization: merod answers `403` to an `/admit` from a node
|
|
644
|
-
* that list does not name, whatever else is true of it. The cloud's list is
|
|
645
|
-
* every node currently assigned to the namespace — it cannot know which
|
|
646
|
-
* invitation the caller holds, so it cannot filter by the signed list, and a
|
|
647
|
-
* node assigned *after* the invitation was minted looks perfect in every field
|
|
648
|
-
* the cloud reports and still refuses the claim.
|
|
649
|
-
*
|
|
650
|
-
* Intersecting here is therefore not belt-and-braces: it is the check that
|
|
651
|
-
* turns an unexplainable `403` into "your invitation names none of these nodes,
|
|
652
|
-
* ask for a fresh one". It is never relaxed to make a flow work.
|
|
653
|
-
*
|
|
654
|
-
* # `servable` and `canAdmit` are advisory; `writable` is information
|
|
655
|
-
*
|
|
656
|
-
* `servable` and `canAdmit` are derived from assignment heartbeats, and a lapsed
|
|
657
|
-
* heartbeat is not the same fact as a node that will refuse. Measured against
|
|
658
|
-
* prod: the cloud reported `servable: false, canAdmit: false, fresh: false` for a
|
|
659
|
-
* node whose `/admin-api/health` answered `{"status":"alive"}` and which had just
|
|
660
|
-
* minted the invitation being claimed. Gating on them meant refusing to knock on
|
|
661
|
-
* an open door, so a node with an address is tried and the NODE decides —
|
|
662
|
-
* `admit_join` re-verifies the invitation, the signature and the admitters list,
|
|
663
|
-
* so asking loosens nothing and a refusal names its own cause. `stale` on the
|
|
664
|
-
* result says the attempt rests on advisory data.
|
|
665
|
-
*
|
|
666
|
-
* `writable` — and its per-node form, `canExecute` — is about `CAN_AUTHOR_ON_BEHALF`,
|
|
667
|
-
* which admission does **not** require: relaying a join the joiner signed is not
|
|
668
|
-
* authoring on anyone's behalf. So a non-writable namespace is not a refusal
|
|
669
|
-
* here; it is reported on the result, because it is precisely why the writes
|
|
670
|
-
* would fail *after* connecting, and a caller that cannot tell the two apart
|
|
671
|
-
* sends the user to the wrong place.
|
|
672
|
-
*/
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* Which step could not be completed. Each one needs a different action from the
|
|
676
|
-
* person, which is why this is an enum and not a message.
|
|
677
|
-
*
|
|
678
|
-
* - `admitters-lookup` — the cloud read itself failed (offline, 5xx, a refused
|
|
679
|
-
* routing proof). Nothing has been learned about the namespace.
|
|
680
|
-
* - `no-nodes` — the read succeeded and the cloud lists nothing. The namespace
|
|
681
|
-
* has no fleet assignment, so there is no cloud node to admit through; the
|
|
682
|
-
* invitation's admitters are somebody's self-hosted or desktop node, which the
|
|
683
|
-
* cloud neither knows nor routes to.
|
|
684
|
-
* - `not-invited` — nodes serve the namespace, and the invitation names none of
|
|
685
|
-
* them. Terminal for this invitation: ask for a fresh one.
|
|
686
|
-
* - `invited-unreachable` — a named node exists but cannot take a join now (no
|
|
687
|
-
* fresh heartbeat, or the cloud reports the namespace as not servable). A
|
|
688
|
-
* wait, not a wrong invitation.
|
|
689
|
-
* - `no-relay-url` — a named node can admit but the cloud knows no address for
|
|
690
|
-
* it, so there is nothing to connect through afterwards. Also a wait: it is
|
|
691
|
-
* the shape a node reports before its first heartbeat lands.
|
|
692
|
-
*/
|
|
693
|
-
type RelayResolutionStep = 'admitters-lookup' | 'no-nodes' | 'not-invited' | 'invited-unreachable' | 'no-relay-url';
|
|
694
|
-
/** A relay that can take this invitation's join, and connect afterwards. */
|
|
695
|
-
interface ResolvedInvitationRelay {
|
|
696
|
-
readonly ok: true;
|
|
697
|
-
/** The node origin to connect through. */
|
|
698
|
-
readonly relayUrl: string;
|
|
699
|
-
/** Where to POST the signed join — the cloud's own, never rebuilt when given. */
|
|
700
|
-
readonly admitUrl: string;
|
|
701
|
-
/** The admitter's account, as the cloud reported it. */
|
|
702
|
-
readonly admitterAccount: string | null;
|
|
703
|
-
readonly peerId: string;
|
|
704
|
-
/**
|
|
705
|
-
* Whether this node can also run delegated writes (`CAN_AUTHOR_ON_BEHALF`).
|
|
706
|
-
*
|
|
707
|
-
* `false` is not a failure of admission — see the module note. It means the
|
|
708
|
-
* connection that follows will read and receive events but have its intents
|
|
709
|
-
* refused, which an admin grants away, so it is worth saying out loud.
|
|
710
|
-
*/
|
|
711
|
-
readonly writable: boolean;
|
|
712
|
-
/** Whether the chosen node's heartbeat for this namespace has lapsed. */
|
|
713
|
-
readonly stale: boolean;
|
|
714
|
-
}
|
|
715
|
-
interface RelayResolutionFailure {
|
|
716
|
-
readonly ok: false;
|
|
717
|
-
readonly step: RelayResolutionStep;
|
|
718
|
-
/** What to go and do about it, in one sentence. */
|
|
719
|
-
readonly reason: string;
|
|
720
|
-
}
|
|
721
|
-
type ResolveRelayResult = ResolvedInvitationRelay | RelayResolutionFailure;
|
|
722
|
-
interface ResolveRelayFromInvitationInput {
|
|
723
|
-
/** The namespace the invitation admits you to, 64 hex. */
|
|
724
|
-
readonly namespaceId: string;
|
|
725
|
-
/**
|
|
726
|
-
* The invitation's signed `admitters` — `invitation.invitation.admitters`.
|
|
727
|
-
*
|
|
728
|
-
* An EMPTY list is the legacy "admission by broadcast" shape, where any ready
|
|
729
|
-
* peer may admit, and is treated as such. Omitting the field and passing an
|
|
730
|
-
* empty array are therefore the same thing on purpose: there is no spelling
|
|
731
|
-
* here that means "nobody may admit", because an invitation cannot say that.
|
|
732
|
-
*/
|
|
733
|
-
readonly admitters?: readonly string[];
|
|
734
|
-
/** The delegated credential — an `AccountProof<DeviceCert>`, hex. */
|
|
735
|
-
readonly credential: string;
|
|
736
|
-
/** The certified device's ed25519 signing secret, hex. */
|
|
737
|
-
readonly deviceSecret: string;
|
|
738
|
-
/** Point at a cloud other than the hosted manager. For local rigs. */
|
|
739
|
-
readonly cloudBaseUrl?: string;
|
|
740
|
-
/** Injected in tests. Anything with the one method this needs. */
|
|
741
|
-
readonly cloud?: Pick<CloudClient, 'getNamespaceRouting'>;
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* Normalise a hex account for comparison: lower-cased, `0x` stripped.
|
|
745
|
-
*
|
|
746
|
-
* Both sides are hex for the same 32 bytes, and a spelling mismatch would
|
|
747
|
-
* present as "your invitation does not name this node" — a refusal that looks
|
|
748
|
-
* like policy and is really formatting.
|
|
749
|
-
*/
|
|
750
|
-
declare function normaliseAccount(account: string | null | undefined): string | null;
|
|
751
|
-
/**
|
|
752
|
-
* Resolve a relay to bootstrap through, from an invitation and nothing else.
|
|
753
|
-
*
|
|
754
|
-
* Reads the cloud's routing for the namespace, intersects it with the
|
|
755
|
-
* invitation's signed `admitters`, and returns the node to use — or which step
|
|
756
|
-
* stopped it and what that means. It performs no admission and mints no keys:
|
|
757
|
-
* the credential passed in is the one the wallet already certified.
|
|
758
|
-
*/
|
|
759
|
-
declare function resolveRelayFromInvitation(input: ResolveRelayFromInvitationInput): Promise<ResolveRelayResult>;
|
|
760
|
-
|
|
761
|
-
/**
|
|
762
|
-
* Present a signed join to ONE named node.
|
|
763
|
-
*
|
|
764
|
-
* This is the whole of admission for a caller with no node of its own: sign the
|
|
765
|
-
* membership op with the device key the account certified, and POST it to a node
|
|
766
|
-
* the invitation named as an admitter.
|
|
767
|
-
*
|
|
768
|
-
* POST /admin-api/namespaces/{namespaceId}/admit
|
|
769
|
-
* { "invitation": SignedGroupOpenInvitation, "signedOp": "<hex borsh SignedNamespaceOp>" }
|
|
770
|
-
*
|
|
771
|
-
* Verified against core at rc.43 — `crates/server/src/admin/handlers/namespaces/
|
|
772
|
-
* admit_join.rs`, request type `AdmitJoinApiRequest` in
|
|
773
|
-
* `crates/server/primitives/src/admin/mod.rs`. The handler also refuses a
|
|
774
|
-
* mismatch between the invitation's `group_id` and the namespace in the path, so
|
|
775
|
-
* the two are never allowed to disagree here.
|
|
776
|
-
*
|
|
777
|
-
* ## Why it needs no token and no proof
|
|
778
|
-
*
|
|
779
|
-
* The joiner's signature IS the authorization. The op is signed by the device
|
|
780
|
-
* key named in the credential it carries, and every peer checks
|
|
781
|
-
* `signer == credential.statement.sign_pk` before applying a join — so an
|
|
782
|
-
* admitter can carry this and can never author it: it cannot admit a different
|
|
783
|
-
* account, change the group, or grant a role. It can refuse, and that is all.
|
|
784
|
-
* This is also why the fleet ingress leaves the route unauthenticated, and why
|
|
785
|
-
* this posts with `fetch` rather than through `AdminApiClient`, which is built
|
|
786
|
-
* around a node credential this caller does not have.
|
|
787
|
-
*
|
|
788
|
-
* ## Why it lives here and not in mero-js
|
|
789
|
-
*
|
|
790
|
-
* Two reasons. `mero-js` is read-only for this change by instruction, and the
|
|
791
|
-
* shape that is actually useful to a caller is the one that hands back a
|
|
792
|
-
* {@link DelegatedSession} — the node that admitted you is the node to connect
|
|
793
|
-
* through — which is `mero-react`'s concern. The pieces that are pure SDK, the
|
|
794
|
-
* borsh op layout and the request type, are used from `mero-js` unchanged and
|
|
795
|
-
* are not reimplemented here.
|
|
796
|
-
*
|
|
797
|
-
* ## Why the op has no parents
|
|
798
|
-
*
|
|
799
|
-
* A keyholder holds no node, so it has no view of the namespace DAG and cannot
|
|
800
|
-
* name its heads. Empty parents is the only thing it *can* sign, and the direct
|
|
801
|
-
* admission path exists precisely for callers in that position.
|
|
802
|
-
*/
|
|
803
|
-
|
|
804
|
-
/** Which step failed, when one did. */
|
|
805
|
-
type JoinWithNodeStep =
|
|
806
|
-
/** The op could not be signed. Local, deterministic, and nothing was sent. */
|
|
807
|
-
'sign'
|
|
808
|
-
/** The node refused it, or could not be reached. */
|
|
809
|
-
| 'admit';
|
|
810
|
-
interface JoinWithNodeSuccess {
|
|
811
|
-
readonly ok: true;
|
|
812
|
-
/**
|
|
813
|
-
* Whether the admitter said it published the op.
|
|
814
|
-
*
|
|
815
|
-
* NOT "you are a member": membership lands when peers apply the op, which the
|
|
816
|
-
* admitter neither performs nor waits for.
|
|
817
|
-
*/
|
|
818
|
-
readonly published: boolean;
|
|
819
|
-
/**
|
|
820
|
-
* The session to connect with — the admitting node, used immediately.
|
|
821
|
-
*
|
|
822
|
-
* Deliberately not waiting for `getAccountRelays` to answer: the fleet writes
|
|
823
|
-
* the account's recovery envelope asynchronously, so the cloud lookup lags the
|
|
824
|
-
* admission by an unpredictable amount. The node that just carried the join is
|
|
825
|
-
* known to serve this namespace right now, which is a better answer than a
|
|
826
|
-
* lookup that will agree later.
|
|
827
|
-
*/
|
|
828
|
-
readonly session: DelegatedSession;
|
|
829
|
-
}
|
|
830
|
-
interface JoinWithNodeFailure {
|
|
831
|
-
readonly ok: false;
|
|
832
|
-
readonly step: JoinWithNodeStep;
|
|
833
|
-
readonly reason: string;
|
|
834
|
-
/** The HTTP status, when the node answered with one. */
|
|
835
|
-
readonly status?: number;
|
|
836
|
-
}
|
|
837
|
-
type JoinWithNodeResult = JoinWithNodeSuccess | JoinWithNodeFailure;
|
|
838
|
-
interface JoinWithNodeInput {
|
|
839
|
-
/**
|
|
840
|
-
* The node to present the join to — its admin API origin.
|
|
841
|
-
*
|
|
842
|
-
* The primary parameter, so all three sources of a node URL feed one method:
|
|
843
|
-
* one carried by the invitation (core emits only libp2p multiaddrs today —
|
|
844
|
-
* see `resolve_admitter_addrs`, a node cannot know the URL its admin API is
|
|
845
|
-
* proxied on — so this is the seam for when invitations carry a claim URL),
|
|
846
|
-
* one resolved from the cloud's `/admitters` lookup, and one an operator
|
|
847
|
-
* simply knows.
|
|
848
|
-
*/
|
|
849
|
-
readonly nodeUrl: string;
|
|
850
|
-
/**
|
|
851
|
-
* The exact URL to POST to, when something already knows it.
|
|
852
|
-
*
|
|
853
|
-
* The cloud hands back a ready-made `admit_url` which need not be a path on
|
|
854
|
-
* `nodeUrl`'s origin, and rebuilding it from a guess is how a working
|
|
855
|
-
* admission becomes a 404. Omitted, the documented route on `nodeUrl` is used.
|
|
856
|
-
*/
|
|
857
|
-
readonly admitUrl?: string;
|
|
858
|
-
/** The namespace being joined, 64 hex. Must match the invitation's group. */
|
|
859
|
-
readonly namespaceId: string;
|
|
860
|
-
/**
|
|
861
|
-
* The invitation, exactly as the inviter's node returned it.
|
|
862
|
-
*
|
|
863
|
-
* Passed through unchanged and never rebuilt field by field: the signature
|
|
864
|
-
* covers the body, and re-modelling it through a local type drops the unsigned
|
|
865
|
-
* bootstrap fields and invalidates the signature with them.
|
|
866
|
-
*/
|
|
867
|
-
readonly invitation: SignedGroupOpenInvitation;
|
|
868
|
-
/** The enrolled account, its certificate, and the device secret that signs. */
|
|
869
|
-
readonly credential: DelegatedCredential;
|
|
870
|
-
/** Injected in tests. */
|
|
871
|
-
readonly deps?: {
|
|
872
|
-
readonly fetch?: typeof fetch;
|
|
873
|
-
readonly nonce?: () => Promise<bigint>;
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Sign the membership op and present it to `nodeUrl`.
|
|
878
|
-
*
|
|
879
|
-
* Resolves rather than throws for every expected refusal, because they are
|
|
880
|
-
* different things for the person to do: a malformed op is final, an unreachable
|
|
881
|
-
* node is a retry, and a 409 means pick another admitter.
|
|
882
|
-
*/
|
|
883
|
-
declare function joinWithNode(input: JoinWithNodeInput): Promise<JoinWithNodeResult>;
|
|
884
|
-
|
|
885
|
-
/**
|
|
886
|
-
* Bootstrapping an account that is a member of nothing, from an invitation.
|
|
887
|
-
*
|
|
888
|
-
* # The one missing step
|
|
889
|
-
*
|
|
890
|
-
* A freshly enrolled account holds a certified device and belongs to no
|
|
891
|
-
* namespace, so `CloudClient.getAccountRelays` answers `[]` — correctly, because
|
|
892
|
-
* nothing serves an account that is a member of nothing. It is still signed in;
|
|
893
|
-
* what it has no way to do is write. An invitation is what changes that, and the
|
|
894
|
-
* chain is:
|
|
895
|
-
*
|
|
896
|
-
* invitation → namespaceId → a node URL
|
|
897
|
-
* → POST the signed join to that node → the account is a member
|
|
898
|
-
* → that same node is the relay, from this moment
|
|
899
|
-
* → a fleet relay writes the recovery envelope asynchronously,
|
|
900
|
-
* and getAccountRelays() agrees from then on
|
|
901
|
-
*
|
|
902
|
-
* The session does not wait for the cloud to catch up. The node that carried the
|
|
903
|
-
* join is known to serve the namespace now; the lookup will agree later.
|
|
904
|
-
*
|
|
905
|
-
* # Where the node URL comes from, in preference order
|
|
906
|
-
*
|
|
907
|
-
* 1. one passed in — an operator's, or one a future invitation carries. Core
|
|
908
|
-
* today emits only libp2p multiaddrs on an invitation (`resolve_admitter_addrs`)
|
|
909
|
-
* because a node cannot know the URL its admin API is proxied on, so there is
|
|
910
|
-
* nothing to read off the invitation yet and this is the seam for when there
|
|
911
|
-
* is;
|
|
912
|
-
* 2. the cloud's `/api/cloud/namespaces/{ns}/admitters`, intersected with the
|
|
913
|
-
* invitation's signed `admitters` — see `resolveRelayFromInvitation`.
|
|
914
|
-
*
|
|
915
|
-
* # Nothing here is minted, weakened or worked around
|
|
916
|
-
*
|
|
917
|
-
* The credential and the device secret come from the enrolment the wallet
|
|
918
|
-
* already performed. The op is signed by that device key, which is what stops an
|
|
919
|
-
* admitter substituting a different member. The admitters intersection is done in
|
|
920
|
-
* `resolveRelayFromInvitation` and is never relaxed.
|
|
921
|
-
*/
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* Which step failed. One exhaustive list to branch on: the relay-resolution
|
|
925
|
-
* steps, the two `joinWithNode` reports, and the one only a hook can hit.
|
|
926
|
-
*
|
|
927
|
-
* - `no-credential` — this tab holds no enrolled account, so there is nothing to
|
|
928
|
-
* admit. Only {@link useDelegatedBootstrap} can report it;
|
|
929
|
-
* `bootstrapFromInvitation` is handed the credential as an argument.
|
|
930
|
-
*/
|
|
931
|
-
type BootstrapStep = RelayResolutionStep | JoinWithNodeStep | 'no-credential';
|
|
932
|
-
interface BootstrapSuccess {
|
|
933
|
-
readonly ok: true;
|
|
934
|
-
/** The session to connect with — hand it straight to `connectWithAccount`. */
|
|
935
|
-
readonly session: DelegatedSession;
|
|
936
|
-
/**
|
|
937
|
-
* How the node was chosen, when the cloud chose it.
|
|
938
|
-
*
|
|
939
|
-
* `null` when the caller named the node itself, because then there was no
|
|
940
|
-
* routing read to report — not because anything was skipped.
|
|
941
|
-
*/
|
|
942
|
-
readonly relay: ResolvedInvitationRelay | null;
|
|
943
|
-
/**
|
|
944
|
-
* Whether the admitter said it published the op.
|
|
945
|
-
*
|
|
946
|
-
* NOT "you are a member": membership lands when peers apply the op, which the
|
|
947
|
-
* admitter neither performs nor waits for. `false` with no error means the node
|
|
948
|
-
* took the call and did not publish — worth surfacing rather than treating as
|
|
949
|
-
* success.
|
|
950
|
-
*/
|
|
951
|
-
readonly published: boolean;
|
|
952
|
-
}
|
|
953
|
-
interface BootstrapFailure {
|
|
954
|
-
readonly ok: false;
|
|
955
|
-
readonly step: BootstrapStep;
|
|
956
|
-
readonly reason: string;
|
|
957
|
-
/** The HTTP status, when the failing step was an HTTP call. */
|
|
958
|
-
readonly status?: number;
|
|
959
|
-
}
|
|
960
|
-
type BootstrapResult = BootstrapSuccess | BootstrapFailure;
|
|
961
|
-
interface BootstrapFromInvitationInput {
|
|
962
|
-
/** The namespace the invitation admits you to, 64 hex. */
|
|
963
|
-
readonly namespaceId: string;
|
|
964
|
-
/** The invitation, exactly as the inviter's node returned it. */
|
|
965
|
-
readonly invitation: SignedGroupOpenInvitation;
|
|
966
|
-
/** The enrolled account, its certificate, and the device secret. */
|
|
967
|
-
readonly credential: DelegatedCredential;
|
|
968
|
-
/**
|
|
969
|
-
* A node to present the join to, skipping the cloud lookup.
|
|
970
|
-
*
|
|
971
|
-
* Use it when something already knows the node — an operator, a local rig, or
|
|
972
|
-
* an invitation that carries a claim URL once core emits one. Without it the
|
|
973
|
-
* cloud's admitters lookup answers, and the invitation's signed list is what
|
|
974
|
-
* narrows the answer.
|
|
975
|
-
*/
|
|
976
|
-
readonly nodeUrl?: string;
|
|
977
|
-
/** Point at a cloud other than the hosted manager. For local rigs. */
|
|
978
|
-
readonly cloudBaseUrl?: string;
|
|
979
|
-
/** Injected in tests. */
|
|
980
|
-
readonly deps?: {
|
|
981
|
-
readonly resolve?: typeof resolveRelayFromInvitation;
|
|
982
|
-
readonly join?: typeof joinWithNode;
|
|
983
|
-
readonly fetch?: typeof fetch;
|
|
984
|
-
readonly nonce?: () => Promise<bigint>;
|
|
985
|
-
};
|
|
986
|
-
}
|
|
987
|
-
/**
|
|
988
|
-
* Resolve a node from the invitation, present the signed join to it, and return
|
|
989
|
-
* the session to connect with.
|
|
990
|
-
*
|
|
991
|
-
* Never throws for an expected failure: every one of them is a different thing
|
|
992
|
-
* for the person to do, so they come back as `{ ok: false, step, reason }`. A
|
|
993
|
-
* generic "could not join" is exactly what this shape exists to prevent.
|
|
994
|
-
*/
|
|
995
|
-
declare function bootstrapFromInvitation(input: BootstrapFromInvitationInput): Promise<BootstrapResult>;
|
|
996
|
-
|
|
997
503
|
/**
|
|
998
504
|
* The delegated connect path, entered from an invitation instead of an account.
|
|
999
505
|
*
|
|
@@ -1052,257 +558,6 @@ interface UseDelegatedBootstrapResult {
|
|
|
1052
558
|
}
|
|
1053
559
|
declare function useDelegatedBootstrap(options?: UseDelegatedBootstrapOptions): UseDelegatedBootstrapResult;
|
|
1054
560
|
|
|
1055
|
-
/**
|
|
1056
|
-
* An account's governance through the relay that serves its namespace: create
|
|
1057
|
-
* a context, and the group ops a private context (a DM) needs.
|
|
1058
|
-
*
|
|
1059
|
-
* A thin layer over mero-js's `RelayClient.createContext` / `govern` (core's
|
|
1060
|
-
* `/admin-api/groups/{group}/context-intents` and `.../governance-intents`),
|
|
1061
|
-
* adding what only this package knows: which relay serves the namespace (the
|
|
1062
|
-
* relay map), and the nonce bookkeeping across page loads.
|
|
1063
|
-
*
|
|
1064
|
-
* Nodes check the AUTHOR's rights (CAN_CREATE_CONTEXT, CAN_CREATE_SUBGROUP,
|
|
1065
|
-
* MANAGE_MEMBERS…), never the relay's; the relay only needs standing to act.
|
|
1066
|
-
*/
|
|
1067
|
-
|
|
1068
|
-
/**
|
|
1069
|
-
* What an account asks for when it creates a context: the fields of a node's
|
|
1070
|
-
* `CreateContextRequest` that have a place in the creation warrant
|
|
1071
|
-
* (mero-js `CreationWarrantInput`), plus which namespace to find the relay by.
|
|
1072
|
-
*
|
|
1073
|
-
* Intentionally NOT here, because the warrant has no field for it:
|
|
1074
|
-
* `identitySecret` — a node's key for its new member identity; the account IS
|
|
1075
|
-
* the member identity here (`init` runs as the author's account), so there is
|
|
1076
|
-
* nothing to derive one from.
|
|
1077
|
-
*/
|
|
1078
|
-
interface CreateDelegatedContextRequest {
|
|
1079
|
-
readonly namespaceId: string;
|
|
1080
|
-
/** The group to create it in; the namespace itself when omitted. */
|
|
1081
|
-
readonly groupId?: string;
|
|
1082
|
-
readonly applicationId: string;
|
|
1083
|
-
/**
|
|
1084
|
-
* Which service of a multi-service bundle the context is for; absent for
|
|
1085
|
-
* the bundle's default service. Signed into the warrant: the relay runs THAT
|
|
1086
|
-
* service's `init`, so a bundle like mero-docs (`registry`, `docs`) creates
|
|
1087
|
-
* the right contract.
|
|
1088
|
-
*/
|
|
1089
|
-
readonly serviceName?: string;
|
|
1090
|
-
/** The seed the context id is derived from, hex (32 bytes); random when absent. */
|
|
1091
|
-
readonly contextSeed?: string;
|
|
1092
|
-
readonly initializationParams?: number[];
|
|
1093
|
-
readonly name?: string;
|
|
1094
|
-
}
|
|
1095
|
-
declare function createDelegatedContext(s: DelegatedSession, req: CreateDelegatedContextRequest, deps?: {
|
|
1096
|
-
fetch?: typeof fetch;
|
|
1097
|
-
}): Promise<{
|
|
1098
|
-
contextId: string;
|
|
1099
|
-
}>;
|
|
1100
|
-
/**
|
|
1101
|
-
* Found a namespace as the account, through a relay it already uses. The
|
|
1102
|
-
* account becomes founder, owner and admin; the relay is seated in it (and a
|
|
1103
|
-
* TEE relay admits itself as its first TEE), so contexts can be created in it
|
|
1104
|
-
* through the same relay straight away.
|
|
1105
|
-
*
|
|
1106
|
-
* The relay's executor account cannot be asked about a namespace that does
|
|
1107
|
-
* not exist yet, so it is the session's `executorAccount` when the app named
|
|
1108
|
-
* one, else learned from a namespace the account already has on that relay. A
|
|
1109
|
-
* brand-new account with neither is told how to get one.
|
|
1110
|
-
*/
|
|
1111
|
-
declare function foundDelegatedNamespace(s: DelegatedSession, req?: {
|
|
1112
|
-
readonly defaultCapabilities?: number;
|
|
1113
|
-
/** The application the namespace runs; without one no context can be created in it. */
|
|
1114
|
-
readonly application?: {
|
|
1115
|
-
applicationId: string;
|
|
1116
|
-
package: string;
|
|
1117
|
-
version: string;
|
|
1118
|
-
};
|
|
1119
|
-
}, deps?: {
|
|
1120
|
-
fetch?: typeof fetch;
|
|
1121
|
-
/** The cloud to enable HA on; mero-js's default when unset. */
|
|
1122
|
-
cloudBaseUrl?: string;
|
|
1123
|
-
}): Promise<FoundedDelegatedNamespace>;
|
|
1124
|
-
/** What {@link foundDelegatedNamespace} returns. */
|
|
1125
|
-
interface FoundedDelegatedNamespace {
|
|
1126
|
-
namespaceId: string;
|
|
1127
|
-
teeEnabled: boolean;
|
|
1128
|
-
/** Whether the cloud agreed to host the namespace (HA) right after founding. */
|
|
1129
|
-
haEnabled: boolean;
|
|
1130
|
-
/** Why `haEnabled` is `false`, in words a person can act on. */
|
|
1131
|
-
haError?: string;
|
|
1132
|
-
}
|
|
1133
|
-
/** What an app can tell a person whose account the cloud cannot place. */
|
|
1134
|
-
declare const HA_ACCOUNT_NOT_LINKED_MESSAGE = "link this account to your cloud user in the wallet so invitees can find this namespace";
|
|
1135
|
-
/**
|
|
1136
|
-
* What to tell a person for each refusal the cloud names, keyed by its code.
|
|
1137
|
-
* Every one leaves the namespace founded; only hosting was refused.
|
|
1138
|
-
*/
|
|
1139
|
-
declare const HA_REFUSAL_MESSAGES: Record<string, string>;
|
|
1140
|
-
|
|
1141
|
-
/**
|
|
1142
|
-
* An application's id, computed the way merod computes it.
|
|
1143
|
-
*
|
|
1144
|
-
* core's `ApplicationId::for_bundle(package, signer_id)` is
|
|
1145
|
-
* `sha256(borsh((package, signer_id)))`: the package name and the publisher's
|
|
1146
|
-
* signing key together decide which app a bundle IS, and the version is not an
|
|
1147
|
-
* input, so every version a publisher ships under one package installs as the
|
|
1148
|
-
* same application. A node learns the id when it installs the bundle; an
|
|
1149
|
-
* account installs nothing, so it has to derive the id from the same two
|
|
1150
|
-
* inputs — both of which the registry's bundle listing carries.
|
|
1151
|
-
*/
|
|
1152
|
-
/** A bundle entry as `GET {registry}/api/v2/bundles?package=…` lists it. */
|
|
1153
|
-
interface RegistryBundle {
|
|
1154
|
-
package?: string;
|
|
1155
|
-
signerId?: string;
|
|
1156
|
-
appVersion?: string;
|
|
1157
|
-
yanked?: boolean;
|
|
1158
|
-
publishedAt?: string;
|
|
1159
|
-
}
|
|
1160
|
-
/**
|
|
1161
|
-
* `sha256(borsh((pkg, signerId)))` as lowercase hex: core's
|
|
1162
|
-
* `ApplicationId::for_bundle`. A borsh tuple is its fields concatenated.
|
|
1163
|
-
*/
|
|
1164
|
-
declare function applicationIdForBundle(pkg: string, signerId: string): Promise<string>;
|
|
1165
|
-
/**
|
|
1166
|
-
* The entry a package resolves to: its newest version that is not yanked. The
|
|
1167
|
-
* one rule for "latest", shared by the version lookup and the id derivation so
|
|
1168
|
-
* the two cannot disagree about which bundle an account is founding on.
|
|
1169
|
-
*/
|
|
1170
|
-
declare function selectLatestBundle<B extends RegistryBundle>(bundles: readonly B[]): B | undefined;
|
|
1171
|
-
interface ResolvedApplication {
|
|
1172
|
-
applicationId: string;
|
|
1173
|
-
signerId: string;
|
|
1174
|
-
version: string;
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
* The application id an account founds `pkg` on, learned from the registry.
|
|
1178
|
-
*
|
|
1179
|
-
* Refused when the non-yanked versions of `pkg` name more than one publisher:
|
|
1180
|
-
* that is two different applications under one package name (the id binds the
|
|
1181
|
-
* signer), and picking either silently would commit the founder — who signs
|
|
1182
|
-
* `TargetApplicationSet` naming the id — to an app it did not choose.
|
|
1183
|
-
*/
|
|
1184
|
-
declare function resolveApplicationIdFromRegistry(registryUrl: string, pkg: string, deps?: {
|
|
1185
|
-
fetch?: typeof fetch;
|
|
1186
|
-
}): Promise<ResolvedApplication>;
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* An account's group management through a relay: one delegated governance op
|
|
1190
|
-
* per call (`RelayClient.govern`), posted to the relay that serves the group's
|
|
1191
|
-
* namespace.
|
|
1192
|
-
*
|
|
1193
|
-
* A group op goes to the group it acts on; a root op (create, delete, move a
|
|
1194
|
-
* subgroup; join an open one) goes to the NAMESPACE. The namespace of a
|
|
1195
|
-
* subgroup is remembered here per account: when this account created it, and
|
|
1196
|
-
* when the account admin asked the relay for it (`getGroupInfo`).
|
|
1197
|
-
*/
|
|
1198
|
-
|
|
1199
|
-
/** A group op (member, role, capabilities, metadata, visibility, detach) on `groupId`. */
|
|
1200
|
-
declare function governGroup(s: DelegatedSession, groupId: string, op: GovernanceOp): Promise<{
|
|
1201
|
-
groupId: string;
|
|
1202
|
-
}>;
|
|
1203
|
-
/** A root op, posted to the namespace `groupId` belongs to. */
|
|
1204
|
-
declare function governRoot(s: DelegatedSession, groupId: string, op: GovernanceOp): Promise<{
|
|
1205
|
-
groupId: string;
|
|
1206
|
-
}>;
|
|
1207
|
-
|
|
1208
|
-
/**
|
|
1209
|
-
* An account's admin API: the same method names and types as mero-js's
|
|
1210
|
-
* `AdminApiClient`, so an app written against a node's admin needs no second
|
|
1211
|
-
* code path. Reads go to the relay's caller-scoped admin client; writes go
|
|
1212
|
-
* through the relay as governance ops, delegated context and namespace
|
|
1213
|
-
* creation, or an invitation the account signs itself. A write with no
|
|
1214
|
-
* account form (upgrades, installs) is refused by name.
|
|
1215
|
-
*/
|
|
1216
|
-
|
|
1217
|
-
declare class NotForAccountError extends Error {
|
|
1218
|
-
readonly method: string;
|
|
1219
|
-
constructor(method: string);
|
|
1220
|
-
}
|
|
1221
|
-
/**
|
|
1222
|
-
* An account that has enrolled but joined nothing has no relay: nothing serves
|
|
1223
|
-
* it yet. Its listings are empty, which is true; anything else names this.
|
|
1224
|
-
*/
|
|
1225
|
-
declare class NoRelayError extends Error {
|
|
1226
|
-
readonly method: string;
|
|
1227
|
-
constructor(method: string);
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
* Why an account's invitation was not minted: nobody its claimant could reach
|
|
1231
|
-
* would admit them. A claimant with no node finds its admitter through the
|
|
1232
|
-
* cloud's routing, intersected with the invitation's signed admitters, so an
|
|
1233
|
-
* invitation the cloud routes to none of them can only fail in their hands.
|
|
1234
|
-
*
|
|
1235
|
-
* - `not-hosted` — the cloud serves the namespace on no node: HA was never
|
|
1236
|
-
* enabled for it (not linked in the wallet, quota, or founding not attested).
|
|
1237
|
-
* - `no-named-node` — the cloud's nodes are not among the admitters this
|
|
1238
|
-
* invitation would name.
|
|
1239
|
-
*/
|
|
1240
|
-
declare class InvitationNotClaimableError extends Error {
|
|
1241
|
-
readonly namespaceId: string;
|
|
1242
|
-
readonly reason: 'not-hosted' | 'no-named-node';
|
|
1243
|
-
constructor(namespaceId: string, reason: 'not-hosted' | 'no-named-node');
|
|
1244
|
-
}
|
|
1245
|
-
interface AccountAdminDeps {
|
|
1246
|
-
govern?: {
|
|
1247
|
-
group: typeof governGroup;
|
|
1248
|
-
root: typeof governRoot;
|
|
1249
|
-
};
|
|
1250
|
-
createContext?: typeof createDelegatedContext;
|
|
1251
|
-
found?: typeof foundDelegatedNamespace;
|
|
1252
|
-
latestVersion?: (registryUrl: string, pkg: string) => Promise<string>;
|
|
1253
|
-
signInvitation?: typeof signGroupInvitation;
|
|
1254
|
-
/**
|
|
1255
|
-
* Redeem an invitation for this account: resolve the relay the invitation
|
|
1256
|
-
* names, have it admit the account, and switch the session onto that relay.
|
|
1257
|
-
* The provider supplies it (it owns the session); without it a join is
|
|
1258
|
-
* refused by name. Rejects with the refusal's reason and HTTP `status`.
|
|
1259
|
-
*/
|
|
1260
|
-
join?: (namespaceId: string, invitation: SignedGroupOpenInvitation) => Promise<{
|
|
1261
|
-
namespaceId: string;
|
|
1262
|
-
}>;
|
|
1263
|
-
/**
|
|
1264
|
-
* The cloud's routing for a namespace (`CloudClient.getNamespaceRouting`):
|
|
1265
|
-
* the nodes a node-less invitee can be admitted through. Given, an
|
|
1266
|
-
* invitation is minted only if one of them is an admitter it names; a lookup
|
|
1267
|
-
* that fails does not block minting. The provider supplies it.
|
|
1268
|
-
*/
|
|
1269
|
-
routing?: (namespaceId: string) => Promise<{
|
|
1270
|
-
nodes: ReadonlyArray<{
|
|
1271
|
-
account: string | null;
|
|
1272
|
-
}>;
|
|
1273
|
-
}>;
|
|
1274
|
-
}
|
|
1275
|
-
declare function createAccountAdmin(input: {
|
|
1276
|
-
session: DelegatedSession;
|
|
1277
|
-
read: AdminApiClient | null;
|
|
1278
|
-
app: {
|
|
1279
|
-
packageName?: string;
|
|
1280
|
-
packageVersion?: string;
|
|
1281
|
-
registryUrl?: string;
|
|
1282
|
-
};
|
|
1283
|
-
}, deps?: AccountAdminDeps): AdminApiClient;
|
|
1284
|
-
|
|
1285
|
-
/**
|
|
1286
|
-
* A node's admin API, as an app writes against it: mero-js's `AdminApiClient`
|
|
1287
|
-
* with `createNamespace` made whole. On a node a namespace can only be created
|
|
1288
|
-
* for an application the node already holds, so this installs the provider's
|
|
1289
|
-
* package from the registry first when it is missing — the step an account
|
|
1290
|
-
* never sees, because founding through a relay names the package and the relay
|
|
1291
|
-
* fetches it. Same call, same result, on both.
|
|
1292
|
-
*/
|
|
1293
|
-
|
|
1294
|
-
interface NodeAdminDeps {
|
|
1295
|
-
latestVersion?: (registryUrl: string, pkg: string) => Promise<string>;
|
|
1296
|
-
}
|
|
1297
|
-
declare function createNodeAdmin(input: {
|
|
1298
|
-
admin: AdminApiClient;
|
|
1299
|
-
app: {
|
|
1300
|
-
packageName?: string;
|
|
1301
|
-
packageVersion?: string;
|
|
1302
|
-
registryUrl?: string;
|
|
1303
|
-
};
|
|
1304
|
-
}, deps?: NodeAdminDeps): AdminApiClient;
|
|
1305
|
-
|
|
1306
561
|
interface JoinInvitationInput {
|
|
1307
562
|
readonly namespaceId: string;
|
|
1308
563
|
/** The context the invitation was for, when it names one; a workspace invitation names none. */
|
|
@@ -1572,7 +827,7 @@ interface CreatePrivateContextRequest {
|
|
|
1572
827
|
* - a node login makes the group, adds the members and creates the context
|
|
1573
828
|
* with its own admin calls (as mero-chat's DMs do);
|
|
1574
829
|
* - an account has the relay serving the namespace do the same three steps,
|
|
1575
|
-
* each under its own warrant (
|
|
830
|
+
* each under its own warrant (mero-js createDelegatedContext).
|
|
1576
831
|
*/
|
|
1577
832
|
declare function useCreatePrivateContext(): {
|
|
1578
833
|
createPrivateContext: (request: CreatePrivateContextRequest) => Promise<{
|
|
@@ -2173,4 +1428,4 @@ declare function clearContextIdentity(): void;
|
|
|
2173
1428
|
*/
|
|
2174
1429
|
declare function clearAllStorage(): void;
|
|
2175
1430
|
|
|
2176
|
-
export { type
|
|
1431
|
+
export { type AccountEnrolment, AccountSignInPanel, type AccountSignInPanelProps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, CalimeroLogo, type CalimeroLogoProps, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type ExecutionResult, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, LoginModal, type LoginModalProps, type LoginModalTab, MERO_CSS_VARS, type MeroCapabilities, 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 UseAccountEnrolmentOptions, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, isFinalInvitationError, isReturningFromWallet, localStorageTokenStorage, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAccountEnrolment, 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 };
|