@calimero-network/mero-js 13.2.5 → 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/admin-api/admin-client.d.ts +27 -1
- package/dist/admin-api/admin-client.js +28 -0
- package/dist/admin-api/admin-types.d.ts +50 -0
- package/dist/index.browser.mjs +1 -1
- package/dist/index.browser.mjs.map +2 -2
- package/dist/index.cjs +33 -0
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +33 -0
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1096,6 +1096,39 @@ var AdminApiClient = class {
|
|
|
1096
1096
|
const node = await this.getNodeIdentity();
|
|
1097
1097
|
return { namespaceId, publicKey: node.publicKey, account: node.accountId };
|
|
1098
1098
|
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Ask this node to run one method on a member's behalf, under a warrant that
|
|
1101
|
+
* member signed.
|
|
1102
|
+
*
|
|
1103
|
+
* The node executes and signs the envelope with its own key; the change is
|
|
1104
|
+
* attributed to the **author**. Both halves travel together, so every peer
|
|
1105
|
+
* re-checks that the member consented instead of trusting the relay.
|
|
1106
|
+
*
|
|
1107
|
+
* Three things have to be true first, and none is implied by the others:
|
|
1108
|
+
*
|
|
1109
|
+
* - the author's **account** is a member of the group owning the context —
|
|
1110
|
+
* their device joins nothing and is in no group's binding rows, which is
|
|
1111
|
+
* exactly the case a device certificate covers;
|
|
1112
|
+
* - this node holds `CAN_AUTHOR_ON_BEHALF` on that group, which is implied by
|
|
1113
|
+
* neither membership nor admin;
|
|
1114
|
+
* - the warrant has not been spent. It is single-use: presenting a valid one
|
|
1115
|
+
* twice is refused, because the signature stays valid forever and replay is
|
|
1116
|
+
* not forgery.
|
|
1117
|
+
*
|
|
1118
|
+
* A refusal comes back as a `403` carrying the reason — "an admin must grant
|
|
1119
|
+
* CAN_AUTHOR_ON_BEHALF to …", or that the nonce is already spent — so a caller
|
|
1120
|
+
* can tell which precondition failed rather than only that one did.
|
|
1121
|
+
*
|
|
1122
|
+
* This SDK does not mint warrants; see {@link PerformIntentRequest.warrant}.
|
|
1123
|
+
*/
|
|
1124
|
+
async performIntent(contextId, request) {
|
|
1125
|
+
return unwrap(
|
|
1126
|
+
await this.httpClient.post(
|
|
1127
|
+
`/admin-api/contexts/${contextId}/intents`,
|
|
1128
|
+
request
|
|
1129
|
+
)
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1099
1132
|
async listNamespacesForApplication(applicationId) {
|
|
1100
1133
|
return unwrap(await this.httpClient.get(`/admin-api/namespaces/for-application/${applicationId}`));
|
|
1101
1134
|
}
|