@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/admin-api/admin-client.d.ts +29 -5
- package/dist/admin-api/admin-client.js +32 -17
- package/dist/admin-api/admin-types.d.ts +52 -11
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +32 -36
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +32 -36
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1121,38 +1121,6 @@ var AdminApiClient = class {
|
|
|
1121
1121
|
async listApplicationAliases() {
|
|
1122
1122
|
return unwrap(await this.httpClient.get("/admin-api/alias/list/application"));
|
|
1123
1123
|
}
|
|
1124
|
-
// ---- Context Identity Aliases ----
|
|
1125
|
-
async listContextIdentityAliases(contextId) {
|
|
1126
|
-
return unwrap(
|
|
1127
|
-
await this.httpClient.get(
|
|
1128
|
-
`/admin-api/alias/list/identity/${contextId}`
|
|
1129
|
-
)
|
|
1130
|
-
);
|
|
1131
|
-
}
|
|
1132
|
-
async createContextIdentityAlias(contextId, request) {
|
|
1133
|
-
return unwrap(
|
|
1134
|
-
await this.httpClient.post(
|
|
1135
|
-
`/admin-api/alias/create/identity/${contextId}`,
|
|
1136
|
-
{ alias: request.alias, identity: request.identity }
|
|
1137
|
-
)
|
|
1138
|
-
);
|
|
1139
|
-
}
|
|
1140
|
-
async lookupContextIdentityAlias(contextId, name) {
|
|
1141
|
-
return unwrap(
|
|
1142
|
-
await this.httpClient.post(
|
|
1143
|
-
`/admin-api/alias/lookup/identity/${contextId}/${encodeURIComponent(name)}`,
|
|
1144
|
-
{}
|
|
1145
|
-
)
|
|
1146
|
-
);
|
|
1147
|
-
}
|
|
1148
|
-
async deleteContextIdentityAlias(contextId, name) {
|
|
1149
|
-
return unwrap(
|
|
1150
|
-
await this.httpClient.post(
|
|
1151
|
-
`/admin-api/alias/delete/identity/${contextId}/${encodeURIComponent(name)}`,
|
|
1152
|
-
{}
|
|
1153
|
-
)
|
|
1154
|
-
);
|
|
1155
|
-
}
|
|
1156
1124
|
// ---- Namespace Management ----
|
|
1157
1125
|
async listNamespaces() {
|
|
1158
1126
|
return unwrap(await this.httpClient.get("/admin-api/namespaces"));
|
|
@@ -1160,11 +1128,39 @@ var AdminApiClient = class {
|
|
|
1160
1128
|
async getNamespace(namespaceId) {
|
|
1161
1129
|
return unwrap(await this.httpClient.get(`/admin-api/namespaces/${namespaceId}`));
|
|
1162
1130
|
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Who this node is — the account it writes as, the device it is, the key it
|
|
1133
|
+
* signs with, and the account root a second device pairs against.
|
|
1134
|
+
*
|
|
1135
|
+
* Takes no namespace, and that is the point: one root key is one account
|
|
1136
|
+
* everywhere, and a node signs with one key, so none of it varies by
|
|
1137
|
+
* namespace.
|
|
1138
|
+
*/
|
|
1139
|
+
async getNodeIdentity() {
|
|
1140
|
+
return unwrap(await this.httpClient.get("/admin-api/identity"));
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* @deprecated Use {@link getNodeIdentity} instead. Every field this returns is
|
|
1144
|
+
* node-level, so the namespace was only ever decoration — it now delegates to
|
|
1145
|
+
* the node-level route and reshapes the answer.
|
|
1146
|
+
*
|
|
1147
|
+
* Three consequences of that delegation, all visible to a caller who relied on
|
|
1148
|
+
* the old route's behaviour:
|
|
1149
|
+
*
|
|
1150
|
+
* - **No participation gate.** The namespace route answered 404 when this node
|
|
1151
|
+
* had never joined the namespace; this answers whatever the node's identity
|
|
1152
|
+
* is, regardless. If you were using it to ask "am I in this namespace?", ask
|
|
1153
|
+
* {@link listNamespaces} instead — that is the question you were really
|
|
1154
|
+
* asking.
|
|
1155
|
+
* - **`namespaceId` is echoed verbatim.** The old route resolved a subgroup id
|
|
1156
|
+
* to its root namespace and returned that; passing a subgroup id here gives
|
|
1157
|
+
* the subgroup id back.
|
|
1158
|
+
* - **404 means something else.** Previously "not my namespace", now "this node
|
|
1159
|
+
* holds no account root yet".
|
|
1160
|
+
*/
|
|
1163
1161
|
async getNamespaceIdentity(namespaceId) {
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
);
|
|
1167
|
-
return r?.data ?? r;
|
|
1162
|
+
const node = await this.getNodeIdentity();
|
|
1163
|
+
return { namespaceId, publicKey: node.publicKey, account: node.accountId };
|
|
1168
1164
|
}
|
|
1169
1165
|
async listNamespacesForApplication(applicationId) {
|
|
1170
1166
|
return unwrap(await this.httpClient.get(`/admin-api/namespaces/for-application/${applicationId}`));
|