@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.mjs
CHANGED
|
@@ -1668,6 +1668,15 @@ var AdminApiClient = class {
|
|
|
1668
1668
|
const response = await this.httpClient.get(`/admin-api/groups/${groupId}/settings/tee-admission-policy`);
|
|
1669
1669
|
return response.data ?? response;
|
|
1670
1670
|
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Sets which admitted TEEs may author as the TEE authority. Pass
|
|
1673
|
+
* `{ allowedMrtd: [] }` to turn TEE authorship off. `groupId` must be a
|
|
1674
|
+
* namespace root; the node refuses a subgroup. The node exposes no read-back
|
|
1675
|
+
* route for this policy.
|
|
1676
|
+
*/
|
|
1677
|
+
async setTeeAuthoringPolicy(groupId, request) {
|
|
1678
|
+
await this.httpClient.put(`/admin-api/groups/${groupId}/settings/tee-authoring-policy`, request);
|
|
1679
|
+
}
|
|
1671
1680
|
// ---- Group / member / context metadata ----
|
|
1672
1681
|
async setGroupMetadata(groupId, request) {
|
|
1673
1682
|
await this.httpClient.put(`/admin-api/groups/${groupId}/metadata`, request);
|
|
@@ -5404,17 +5413,27 @@ var CloudClient = class {
|
|
|
5404
5413
|
* Ask the fleet to host a claimed namespace — the step that gets a relay
|
|
5405
5414
|
* assigned.
|
|
5406
5415
|
*
|
|
5407
|
-
*
|
|
5408
|
-
* this is the separate "now host it" half. Idempotent.
|
|
5416
|
+
* Carries no proof: {@link claimNamespace} already established ownership,
|
|
5417
|
+
* and this is the separate "now host it" half. Idempotent.
|
|
5418
|
+
*
|
|
5419
|
+
* `admitterAddrs` is where the owner's own node can be dialed — take it from
|
|
5420
|
+
* that node's network status with {@link admitterAddrsFromNetworkStatus}.
|
|
5421
|
+
* The first fleet node placed on a namespace has nobody but the owner to ask
|
|
5422
|
+
* for admission, and without these it can only broadcast and hope the
|
|
5423
|
+
* owner's node — often a laptop behind a relay — hears it. They are a dial
|
|
5424
|
+
* hint, not a grant: the owner's node admits by its own policy. Omit them to
|
|
5425
|
+
* leave whatever the cloud already holds; pass them again when the node's
|
|
5426
|
+
* relay address changes, and they replace the stored ones.
|
|
5409
5427
|
*
|
|
5410
5428
|
* Not to be confused with {@link enableHA}, which opens the cloud's web flow
|
|
5411
5429
|
* in a browser tab for a user to complete by hand. This is the API call.
|
|
5412
5430
|
*/
|
|
5413
|
-
async enableNamespaceHa(namespaceId) {
|
|
5431
|
+
async enableNamespaceHa(namespaceId, options = {}) {
|
|
5432
|
+
const body = options.admitterAddrs === void 0 ? {} : { admitter_addrs: [...options.admitterAddrs] };
|
|
5414
5433
|
return this.request(
|
|
5415
5434
|
"POST",
|
|
5416
5435
|
`/api/cloud/namespaces/${encodeURIComponent(namespaceId)}/enable-ha`,
|
|
5417
|
-
{ body
|
|
5436
|
+
{ body }
|
|
5418
5437
|
);
|
|
5419
5438
|
}
|
|
5420
5439
|
/**
|
|
@@ -5738,6 +5757,23 @@ var CloudClient = class {
|
|
|
5738
5757
|
void this.notifySession(this.session);
|
|
5739
5758
|
}
|
|
5740
5759
|
};
|
|
5760
|
+
function admitterAddrsFromNetworkStatus(status) {
|
|
5761
|
+
const record = status && typeof status === "object" ? status.data ?? status : void 0;
|
|
5762
|
+
if (!record || typeof record !== "object") return [];
|
|
5763
|
+
const peerId = record.localPeerId;
|
|
5764
|
+
const external = record.externalAddrs;
|
|
5765
|
+
if (typeof peerId !== "string" || !peerId || !Array.isArray(external)) return [];
|
|
5766
|
+
const suffix = `/p2p/${peerId}`;
|
|
5767
|
+
const out = [];
|
|
5768
|
+
for (const entry of external) {
|
|
5769
|
+
if (typeof entry !== "string") continue;
|
|
5770
|
+
const addr = entry.trim();
|
|
5771
|
+
if (!addr.startsWith("/")) continue;
|
|
5772
|
+
const dialable = addr.endsWith(suffix) ? addr : `${addr}${suffix}`;
|
|
5773
|
+
if (!out.includes(dialable)) out.push(dialable);
|
|
5774
|
+
}
|
|
5775
|
+
return out;
|
|
5776
|
+
}
|
|
5741
5777
|
|
|
5742
5778
|
// src/mero-js.ts
|
|
5743
5779
|
function resolveProofSigner(config) {
|
|
@@ -6802,6 +6838,7 @@ export {
|
|
|
6802
6838
|
accountForRoot,
|
|
6803
6839
|
accountRootFromPhrase,
|
|
6804
6840
|
accountRootFromSecret,
|
|
6841
|
+
admitterAddrsFromNetworkStatus,
|
|
6805
6842
|
buildAuthLoginUrl,
|
|
6806
6843
|
callerProof,
|
|
6807
6844
|
combineSignals,
|