@calimero-network/mero-js 13.2.4 → 13.3.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.cjs CHANGED
@@ -1167,6 +1167,39 @@ var AdminApiClient = class {
1167
1167
  const node = await this.getNodeIdentity();
1168
1168
  return { namespaceId, publicKey: node.publicKey, account: node.accountId };
1169
1169
  }
1170
+ /**
1171
+ * Ask this node to run one method on a member's behalf, under a warrant that
1172
+ * member signed.
1173
+ *
1174
+ * The node executes and signs the envelope with its own key; the change is
1175
+ * attributed to the **author**. Both halves travel together, so every peer
1176
+ * re-checks that the member consented instead of trusting the relay.
1177
+ *
1178
+ * Three things have to be true first, and none is implied by the others:
1179
+ *
1180
+ * - the author's **account** is a member of the group owning the context —
1181
+ * their device joins nothing and is in no group's binding rows, which is
1182
+ * exactly the case a device certificate covers;
1183
+ * - this node holds `CAN_AUTHOR_ON_BEHALF` on that group, which is implied by
1184
+ * neither membership nor admin;
1185
+ * - the warrant has not been spent. It is single-use: presenting a valid one
1186
+ * twice is refused, because the signature stays valid forever and replay is
1187
+ * not forgery.
1188
+ *
1189
+ * A refusal comes back as a `403` carrying the reason — "an admin must grant
1190
+ * CAN_AUTHOR_ON_BEHALF to …", or that the nonce is already spent — so a caller
1191
+ * can tell which precondition failed rather than only that one did.
1192
+ *
1193
+ * This SDK does not mint warrants; see {@link PerformIntentRequest.warrant}.
1194
+ */
1195
+ async performIntent(contextId, request) {
1196
+ return unwrap(
1197
+ await this.httpClient.post(
1198
+ `/admin-api/contexts/${contextId}/intents`,
1199
+ request
1200
+ )
1201
+ );
1202
+ }
1170
1203
  async listNamespacesForApplication(applicationId) {
1171
1204
  return unwrap(await this.httpClient.get(`/admin-api/namespaces/for-application/${applicationId}`));
1172
1205
  }