@calimero-network/mero-js 26.8.0 → 26.9.1

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
@@ -2038,6 +2038,53 @@ var AdminApiClient = class {
2038
2038
  )
2039
2039
  );
2040
2040
  }
2041
+ /**
2042
+ * Issue an access grant: a token whose holder may call `request.methods` in
2043
+ * `contextId`, as this node, with no session of its own.
2044
+ *
2045
+ * A grant only narrows: each method must be one this session's own token may
2046
+ * execute in the context (`403` otherwise), and an account session is refused
2047
+ * (`403`), since a granted call runs as the node. The token is in the answer
2048
+ * once and never again; the node keeps only its hash.
2049
+ */
2050
+ async createAccessGrant(contextId, request) {
2051
+ return unwrap(
2052
+ await this.httpClient.post(
2053
+ `/admin-api/contexts/${pathSegment(contextId)}/grants`,
2054
+ { methods: request.methods, label: request.label ?? "", notAfter: request.notAfter ?? null }
2055
+ )
2056
+ );
2057
+ }
2058
+ /** The access grants of `contextId` this session could have issued. */
2059
+ async listAccessGrants(contextId) {
2060
+ return unwrap(
2061
+ await this.httpClient.get(
2062
+ `/admin-api/contexts/${pathSegment(contextId)}/grants`
2063
+ )
2064
+ );
2065
+ }
2066
+ /** Revoke an access grant. A grant this session cannot see is a `404`. */
2067
+ async revokeAccessGrant(contextId, grantId) {
2068
+ return unwrap(
2069
+ await this.httpClient.delete(
2070
+ `/admin-api/contexts/${pathSegment(contextId)}/grants/${pathSegment(grantId)}`
2071
+ )
2072
+ );
2073
+ }
2074
+ /**
2075
+ * Call one method under an access grant. The token is the whole credential:
2076
+ * the route is public on every node, so this works from a client holding no
2077
+ * session at all. A method the grant does not name, an unknown or revoked
2078
+ * token, and an expired grant are each a `403`.
2079
+ */
2080
+ async callWithAccessGrant(contextId, request) {
2081
+ return unwrap(
2082
+ await this.httpClient.post(
2083
+ `/admin-api/contexts/${pathSegment(contextId)}/grant-calls`,
2084
+ request
2085
+ )
2086
+ );
2087
+ }
2041
2088
  /**
2042
2089
  * Ask what this node can do for a member in `contextId`, before they sign
2043
2090
  * anything.
@@ -10577,7 +10624,7 @@ function bytes32(value, label2) {
10577
10624
  }
10578
10625
 
10579
10626
  // src/namespace-op/namespace-op.ts
10580
- var SIGNED_NAMESPACE_OP_SCHEMA_VERSION = 26;
10627
+ var SIGNED_NAMESPACE_OP_SCHEMA_VERSION = 27;
10581
10628
  var NAMESPACE_SIGN_DOMAIN = new TextEncoder().encode("calimero.namespace.v1");
10582
10629
  var NAMESPACE_OP_ROOT = 0;
10583
10630
  var ROOT_OP2 = {