@calimero-network/mero-js 19.18.0 → 19.20.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/admin-api/admin-client.d.ts +8 -1
- package/dist/admin-api/admin-client.js +9 -0
- package/dist/admin-api/admin-types.d.ts +11 -0
- package/dist/cloud/cloud-client.d.ts +26 -3
- package/dist/cloud/cloud-client.js +51 -4
- package/dist/cloud/index.d.ts +1 -1
- package/dist/cloud/index.js +1 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +41 -4
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +41 -4
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
accountForRoot: () => accountForRoot,
|
|
42
42
|
accountRootFromPhrase: () => accountRootFromPhrase,
|
|
43
43
|
accountRootFromSecret: () => accountRootFromSecret,
|
|
44
|
+
admitterAddrsFromNetworkStatus: () => admitterAddrsFromNetworkStatus,
|
|
44
45
|
buildAuthLoginUrl: () => buildAuthLoginUrl,
|
|
45
46
|
callerProof: () => callerProof,
|
|
46
47
|
combineSignals: () => combineSignals,
|
|
@@ -1765,6 +1766,15 @@ var AdminApiClient = class {
|
|
|
1765
1766
|
const response = await this.httpClient.get(`/admin-api/groups/${groupId}/settings/tee-admission-policy`);
|
|
1766
1767
|
return response.data ?? response;
|
|
1767
1768
|
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Sets which admitted TEEs may author as the TEE authority. Pass
|
|
1771
|
+
* `{ allowedMrtd: [] }` to turn TEE authorship off. `groupId` must be a
|
|
1772
|
+
* namespace root; the node refuses a subgroup. The node exposes no read-back
|
|
1773
|
+
* route for this policy.
|
|
1774
|
+
*/
|
|
1775
|
+
async setTeeAuthoringPolicy(groupId, request) {
|
|
1776
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/settings/tee-authoring-policy`, request);
|
|
1777
|
+
}
|
|
1768
1778
|
// ---- Group / member / context metadata ----
|
|
1769
1779
|
async setGroupMetadata(groupId, request) {
|
|
1770
1780
|
await this.httpClient.put(`/admin-api/groups/${groupId}/metadata`, request);
|
|
@@ -5501,17 +5511,27 @@ var CloudClient = class {
|
|
|
5501
5511
|
* Ask the fleet to host a claimed namespace — the step that gets a relay
|
|
5502
5512
|
* assigned.
|
|
5503
5513
|
*
|
|
5504
|
-
*
|
|
5505
|
-
* this is the separate "now host it" half. Idempotent.
|
|
5514
|
+
* Carries no proof: {@link claimNamespace} already established ownership,
|
|
5515
|
+
* and this is the separate "now host it" half. Idempotent.
|
|
5516
|
+
*
|
|
5517
|
+
* `admitterAddrs` is where the owner's own node can be dialed — take it from
|
|
5518
|
+
* that node's network status with {@link admitterAddrsFromNetworkStatus}.
|
|
5519
|
+
* The first fleet node placed on a namespace has nobody but the owner to ask
|
|
5520
|
+
* for admission, and without these it can only broadcast and hope the
|
|
5521
|
+
* owner's node — often a laptop behind a relay — hears it. They are a dial
|
|
5522
|
+
* hint, not a grant: the owner's node admits by its own policy. Omit them to
|
|
5523
|
+
* leave whatever the cloud already holds; pass them again when the node's
|
|
5524
|
+
* relay address changes, and they replace the stored ones.
|
|
5506
5525
|
*
|
|
5507
5526
|
* Not to be confused with {@link enableHA}, which opens the cloud's web flow
|
|
5508
5527
|
* in a browser tab for a user to complete by hand. This is the API call.
|
|
5509
5528
|
*/
|
|
5510
|
-
async enableNamespaceHa(namespaceId) {
|
|
5529
|
+
async enableNamespaceHa(namespaceId, options = {}) {
|
|
5530
|
+
const body = options.admitterAddrs === void 0 ? {} : { admitter_addrs: [...options.admitterAddrs] };
|
|
5511
5531
|
return this.request(
|
|
5512
5532
|
"POST",
|
|
5513
5533
|
`/api/cloud/namespaces/${encodeURIComponent(namespaceId)}/enable-ha`,
|
|
5514
|
-
{ body
|
|
5534
|
+
{ body }
|
|
5515
5535
|
);
|
|
5516
5536
|
}
|
|
5517
5537
|
/**
|
|
@@ -5835,6 +5855,23 @@ var CloudClient = class {
|
|
|
5835
5855
|
void this.notifySession(this.session);
|
|
5836
5856
|
}
|
|
5837
5857
|
};
|
|
5858
|
+
function admitterAddrsFromNetworkStatus(status) {
|
|
5859
|
+
const record = status && typeof status === "object" ? status.data ?? status : void 0;
|
|
5860
|
+
if (!record || typeof record !== "object") return [];
|
|
5861
|
+
const peerId = record.localPeerId;
|
|
5862
|
+
const external = record.externalAddrs;
|
|
5863
|
+
if (typeof peerId !== "string" || !peerId || !Array.isArray(external)) return [];
|
|
5864
|
+
const suffix = `/p2p/${peerId}`;
|
|
5865
|
+
const out = [];
|
|
5866
|
+
for (const entry of external) {
|
|
5867
|
+
if (typeof entry !== "string") continue;
|
|
5868
|
+
const addr = entry.trim();
|
|
5869
|
+
if (!addr.startsWith("/")) continue;
|
|
5870
|
+
const dialable = addr.endsWith(suffix) ? addr : `${addr}${suffix}`;
|
|
5871
|
+
if (!out.includes(dialable)) out.push(dialable);
|
|
5872
|
+
}
|
|
5873
|
+
return out;
|
|
5874
|
+
}
|
|
5838
5875
|
|
|
5839
5876
|
// src/mero-js.ts
|
|
5840
5877
|
function resolveProofSigner(config) {
|