/*! * Copyright (c) 2026 Interop Alliance. All rights reserved. */ /** * The delegation primitive shared by `was.grant()` and the `space`/`collection` * grant sugar. Maps `GrantOptions` onto `zcapClient.delegate(...)`, normalizing * action verbs to uppercase so a lowercase grant (`'get'`) still validates on * the server (which matches actions case-sensitively against `'GET'`). * * An unparented grant whose target lies in the server's Space tree is delegated * from that **Space's** root capability, with the target carried as an * attenuated `invocationTarget`, rather than from the target's own root * capability. Both forms grant the same access (the server verifies WAS routes * with target attenuation allowed), but only a Space-rooted chain can be revoked * -- revocation is Space-scoped, and the endpoint requires the chain to root * exactly in the Space (see `revoke.ts`). */ import type { ClientContext } from './request.js'; import type { GrantOptions, IDelegatedZcap, IZcap } from '../types.js'; /** * Delegates a capability per `GrantOptions`, returning the signed zcap to hand * off out-of-band. An explicit `capability` (re-delegation of a parent zcap) * always wins; otherwise a Space-tree target is rooted at its Space, so the * resulting capability is revocable via `space.revoke()` / `was.revoke()`. * * @param context {ClientContext} * @param options {GrantOptions} * @returns {Promise} */ export declare function delegateGrant(context: ClientContext, { to, actions, expires, target, capability }: GrantOptions): Promise; /** * The scoped-grant sugar shared by `Space.grant` and `Collection.grant`: * delegates per `GrantOptions` with the grant `target` prefilled from the * handle's `path` (and the handle's bound `capability`, if any, as the parent * for re-delegation). Explicit options win over both prefills. * * @param context {ClientContext} * @param options {object} * @param options.path {string} the handle's path (target fallback) * @param options.options {GrantOptions} the caller's grant options * @param [options.capability] {IZcap} the handle's bound capability * @returns {Promise} */ export declare function delegateGrantAt(context: ClientContext, { path, options, capability }: { path: string; options: GrantOptions; capability?: IZcap; }): Promise; //# sourceMappingURL=grant.d.ts.map