@calimero-network/mero-js 10.0.0 → 11.1.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.mjs CHANGED
@@ -1055,38 +1055,6 @@ var AdminApiClient = class {
1055
1055
  async listApplicationAliases() {
1056
1056
  return unwrap(await this.httpClient.get("/admin-api/alias/list/application"));
1057
1057
  }
1058
- // ---- Context Identity Aliases ----
1059
- async listContextIdentityAliases(contextId) {
1060
- return unwrap(
1061
- await this.httpClient.get(
1062
- `/admin-api/alias/list/identity/${contextId}`
1063
- )
1064
- );
1065
- }
1066
- async createContextIdentityAlias(contextId, request) {
1067
- return unwrap(
1068
- await this.httpClient.post(
1069
- `/admin-api/alias/create/identity/${contextId}`,
1070
- { alias: request.alias, identity: request.identity }
1071
- )
1072
- );
1073
- }
1074
- async lookupContextIdentityAlias(contextId, name) {
1075
- return unwrap(
1076
- await this.httpClient.post(
1077
- `/admin-api/alias/lookup/identity/${contextId}/${encodeURIComponent(name)}`,
1078
- {}
1079
- )
1080
- );
1081
- }
1082
- async deleteContextIdentityAlias(contextId, name) {
1083
- return unwrap(
1084
- await this.httpClient.post(
1085
- `/admin-api/alias/delete/identity/${contextId}/${encodeURIComponent(name)}`,
1086
- {}
1087
- )
1088
- );
1089
- }
1090
1058
  // ---- Namespace Management ----
1091
1059
  async listNamespaces() {
1092
1060
  return unwrap(await this.httpClient.get("/admin-api/namespaces"));
@@ -1094,11 +1062,39 @@ var AdminApiClient = class {
1094
1062
  async getNamespace(namespaceId) {
1095
1063
  return unwrap(await this.httpClient.get(`/admin-api/namespaces/${namespaceId}`));
1096
1064
  }
1065
+ /**
1066
+ * Who this node is — the account it writes as, the device it is, the key it
1067
+ * signs with, and the account root a second device pairs against.
1068
+ *
1069
+ * Takes no namespace, and that is the point: one root key is one account
1070
+ * everywhere, and a node signs with one key, so none of it varies by
1071
+ * namespace.
1072
+ */
1073
+ async getNodeIdentity() {
1074
+ return unwrap(await this.httpClient.get("/admin-api/identity"));
1075
+ }
1076
+ /**
1077
+ * @deprecated Use {@link getNodeIdentity} instead. Every field this returns is
1078
+ * node-level, so the namespace was only ever decoration — it now delegates to
1079
+ * the node-level route and reshapes the answer.
1080
+ *
1081
+ * Three consequences of that delegation, all visible to a caller who relied on
1082
+ * the old route's behaviour:
1083
+ *
1084
+ * - **No participation gate.** The namespace route answered 404 when this node
1085
+ * had never joined the namespace; this answers whatever the node's identity
1086
+ * is, regardless. If you were using it to ask "am I in this namespace?", ask
1087
+ * {@link listNamespaces} instead — that is the question you were really
1088
+ * asking.
1089
+ * - **`namespaceId` is echoed verbatim.** The old route resolved a subgroup id
1090
+ * to its root namespace and returned that; passing a subgroup id here gives
1091
+ * the subgroup id back.
1092
+ * - **404 means something else.** Previously "not my namespace", now "this node
1093
+ * holds no account root yet".
1094
+ */
1097
1095
  async getNamespaceIdentity(namespaceId) {
1098
- const r = await this.httpClient.get(
1099
- `/admin-api/namespaces/${namespaceId}/identity`
1100
- );
1101
- return r?.data ?? r;
1096
+ const node = await this.getNodeIdentity();
1097
+ return { namespaceId, publicKey: node.publicKey, account: node.accountId };
1102
1098
  }
1103
1099
  async listNamespacesForApplication(applicationId) {
1104
1100
  return unwrap(await this.httpClient.get(`/admin-api/namespaces/for-application/${applicationId}`));