@atlasauth/pca-gnap 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Atlas Authorization
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,69 @@
1
- # Temporary Holding Version
1
+ # @atlasauth/pca-gnap
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A [GNAP (RFC 9635)](https://www.rfc-editor.org/rfc/rfc9635) bridge for Proof-Carrying Authority (PCA), defining an "agent-GNAP" profile. A GNAP grant request is turned into an attenuated, key-bound PCA capability; a GNAP `access` rights array becomes the capability's policy predicates; multi-hop delegation can only narrow authority; GNAP continuation maps to a PCA step-up; and key-bound requests use detached-JWS (`jwsd`) proofs.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm i @atlasauth/pca-gnap
9
+ ```
10
+
11
+ Depends on `@atlasauth/pca` and `jose`.
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { generateKeyPair, b64u } from '@atlasauth/pca';
17
+ import {
18
+ grantRequestToCapability, authorizeGnapAction, gnapActionResource,
19
+ capabilityToGrantResponse, verifyGnapToken, signGnapRequest, verifyGnapRequest,
20
+ } from '@atlasauth/pca-gnap';
21
+
22
+ const principal = generateKeyPair();
23
+ const agent = generateKeyPair();
24
+
25
+ // A GNAP grant request, bound to the agent's Ed25519 client key.
26
+ const req = {
27
+ access_token: { access: [{ type: 'repo', actions: ['read', 'write'], locations: ['main'] }] },
28
+ client: { key: { proof: 'jwsd', jwk: { kty: 'OKP', crv: 'Ed25519', x: b64u(agent.publicKey) } } },
29
+ };
30
+
31
+ // Authorization server: mint a root capability (pass `parent` to delegate a narrower hop instead).
32
+ const { chain } = grantRequestToCapability(req, {
33
+ issuerSecret: principal.secretKey,
34
+ issuerPublic: b64u(principal.publicKey),
35
+ });
36
+
37
+ // Effective authority = root envelope AND every hop's recorded rights. Fails closed.
38
+ const res = gnapActionResource('repo', 'main');
39
+ authorizeGnapAction(chain, { verb: 'read', resource: res }); // { allowed: true }
40
+ authorizeGnapAction(chain, { verb: 'delete', resource: res }); // { allowed: false, reason }
41
+
42
+ // Hand the chain back as a GNAP access token, and verify it on the way in.
43
+ const response = capabilityToGrantResponse(chain, { expiresIn: 3600 });
44
+ verifyGnapToken(response.access_token!.value, { expectedRootIssuer: b64u(principal.publicKey) }).ok; // true
45
+
46
+ // Key-bound request: detached-JWS proof over the body, verified against the holder key.
47
+ const { detachedJws, holder } = await signGnapRequest({
48
+ body: req, key: agent, htm: 'POST', uri: 'https://as.example/gnap',
49
+ });
50
+ await verifyGnapRequest({ detachedJws, body: req, holder, htm: 'POST', uri: 'https://as.example/gnap' }); // { ok: true, ... }
51
+ ```
52
+
53
+ ## API
54
+
55
+ - Grants: `grantRequestToCapability`, `capabilityToGrantResponse`, `encodeBoundToken`, `verifyGnapToken`, `grantedAccessOf`.
56
+ - Access model: `accessToPredicates`, `accessContains`, `accessWithin`, `clampAccess`, `gnapActionResource`, `authorizeGnapAction`.
57
+ - Key-bound requests: `signGnapRequest`, `verifyGnapRequest` (GNAP `jwsd`, EdDSA; optional `ath` token binding).
58
+ - Step-up: `gnapRequestRequiresStepUp`, `beginGnapContinuation`, `gnapStepUpShare`, `completeGnapContinuation`.
59
+ - `AGENT_GNAP_PROFILE`: the machine-readable profile description.
60
+
61
+ Delegated hops are clamped to the issuer's own authority at issue time (`clampToIssuer`, default on) and are denied at action time if they exceed it.
62
+
63
+ ## Status
64
+
65
+ Experimental. The profile is defined by this package, not by an IETF document, and it implements only the GNAP subset it needs: a single access token per request, `jwsd` as the verified proof method, and no `httpsig` or `mtls` verification. The cryptography is unaudited.
66
+
67
+ ## License
68
+
69
+ MIT - see LICENSE
@@ -0,0 +1,454 @@
1
+ /**
2
+ * @atlasauth/pca-gnap — a GNAP (RFC 9635) bridge for Proof-Carrying Authority, defining the
3
+ * ================= AGENT-GNAP PROFILE =================
4
+ *
5
+ * GNAP (Grant Negotiation and Authorization Protocol, RFC 9635) negotiates an access grant between a
6
+ * client instance and an authorization server (AS) using a rich, structured `access` rights model,
7
+ * key-bound requests, and a stateful *continuation* handle. No agent-delegation profile of GNAP exists
8
+ * publicly yet. This package DEFINES one, because GNAP's primitives map almost 1:1 onto PCA's:
9
+ *
10
+ * GNAP concept PCA concept
11
+ * ------------------------------------ ---------------------------------------------------------
12
+ * `access` rights array (§8) Policy-envelope `Predicate[]` (verb/resource/where)
13
+ * - type → resource namespace `gnap:<type>:<location>`
14
+ * - actions → predicate `verb` (list, or `*`)
15
+ * - locations → predicate `resource` (exact / prefix)
16
+ * - datatypes / identifier → predicate `where` conditions on `action.params.*`
17
+ * client instance key (§7.1) Capability `holder` (the bound key, `cnf`)
18
+ * grant request (§2) `mintGrant` (root) / `delegate` (a delegated hop)
19
+ * grant response access_token (§3.2) A verifiable PCA capability chain (bound, attenuated)
20
+ * `continue` handle (§3.1, §5) A PCA step-up: a FROST/CIBA co-signature folded into a PCActn
21
+ * `interact` (§3.3, §4) The tier-2/3 human/guardian step-up prompt
22
+ * key-bound proof `jwsd` (§7.3.4) Detached-JWS proof that the request was signed by `holder`
23
+ *
24
+ * THE AGENT-GNAP PROFILE (multi-hop delegation). An agent-to-agent (A2A) task is a chain of grants:
25
+ * each hop is a GNAP grant request from one agent to the next, and the AS issues a PCA capability that
26
+ * is ATTENUATED — never wider than the issuing agent's own authority. Attenuation is structural: PCA
27
+ * capability caveats are append-only and conjunctive (see `@atlasauth/pca` capability.ts), so a child
28
+ * can only ever NARROW. Each hop records its granted `access` as a signed `gnap_access` caveat, and the
29
+ * EFFECTIVE authority of the chain is the INTERSECTION of the root policy envelope and every hop's
30
+ * recorded rights. A hop that requests more than its issuer held is clamped at issue time
31
+ * (`clampToIssuer`) AND denied at action time (the issuer's narrower rights still gate every action),
32
+ * so "never wider than the issuer" holds by construction across any number of hops.
33
+ *
34
+ * All verification FAILS CLOSED: a malformed token, a broken chain, a bad jwsd proof, a stale request,
35
+ * or an action outside the granted rights denies. The machine-readable profile spec is exported as
36
+ * {@link AGENT_GNAP_PROFILE}.
37
+ */
38
+ import { type AgentBinding, type Capability, type CapabilityChain, type Caveat, type PCActn, type PCActnBody, type PlanNode, type Predicate, type RiskPolicy, type Signer, type SignerRole, type ThresholdShare, type ThresholdSignature, type ThresholdVerdict } from '@atlasauth/pca';
39
+ /** A JWK (RFC 7517). This profile binds grants to an OKP/Ed25519 client key. */
40
+ export interface GnapJwk {
41
+ kty: string;
42
+ crv?: string;
43
+ x?: string;
44
+ kid?: string;
45
+ alg?: string;
46
+ use?: string;
47
+ }
48
+ /** A client's key-proof binding (§7.1). This profile implements the `jwsd` detached-JWS method. */
49
+ export interface GnapKeyProof {
50
+ /** The proof method. This profile verifies `jwsd`. */
51
+ proof: 'jwsd' | 'httpsig' | 'mtls' | 'jwsd-vc' | string;
52
+ /** The client instance's public key, as a JWK. */
53
+ jwk?: GnapJwk;
54
+ }
55
+ /** A GNAP client instance (§2.3). */
56
+ export interface GnapClient {
57
+ key: GnapKeyProof | string;
58
+ class_id?: string;
59
+ display?: {
60
+ name?: string;
61
+ uri?: string;
62
+ };
63
+ }
64
+ /** A single resource-access right (§8). A string is a reference to a named/pre-registered access. */
65
+ export type GnapAccessItem = GnapResourceAccess | string;
66
+ /** The object form of a resource-access right (§8.1). */
67
+ export interface GnapResourceAccess {
68
+ type: string;
69
+ actions?: string[];
70
+ locations?: string[];
71
+ datatypes?: string[];
72
+ identifier?: string;
73
+ privileges?: string[];
74
+ }
75
+ /** A single-access-token request (§2.1). Multi-token requests are out of this profile's scope. */
76
+ export interface GnapTokenRequest {
77
+ access: GnapAccessItem[];
78
+ label?: string;
79
+ flags?: string[];
80
+ }
81
+ /** A GNAP interaction request (§2.5). */
82
+ export interface GnapInteractRequest {
83
+ start: string[];
84
+ finish?: {
85
+ method: string;
86
+ uri: string;
87
+ nonce: string;
88
+ };
89
+ }
90
+ /** A GNAP subject request (§2.4). */
91
+ export interface GnapSubjectRequest {
92
+ sub_id_formats?: string[];
93
+ assertion_formats?: string[];
94
+ }
95
+ /** A GNAP grant request (§2). */
96
+ export interface GnapGrantRequest {
97
+ access_token: GnapTokenRequest;
98
+ client: GnapClient | string;
99
+ subject?: GnapSubjectRequest;
100
+ interact?: GnapInteractRequest;
101
+ }
102
+ /** An issued GNAP access token (§3.2). In this profile `value` carries a PCA capability chain. */
103
+ export interface GnapAccessToken {
104
+ value: string;
105
+ label?: string;
106
+ access: GnapResourceAccess[];
107
+ expires_in?: number;
108
+ /** The bound key: the holder JWK, or `false` for a bearer token. */
109
+ key?: GnapJwk | false;
110
+ manage?: {
111
+ uri: string;
112
+ };
113
+ }
114
+ /** A GNAP continuation handle (§3.1). The client returns here to complete a step-up. */
115
+ export interface GnapContinue {
116
+ uri: string;
117
+ wait?: number;
118
+ access_token: {
119
+ value: string;
120
+ bound?: boolean;
121
+ };
122
+ }
123
+ /** A GNAP grant response (§3). */
124
+ export interface GnapGrantResponse {
125
+ access_token?: GnapAccessToken;
126
+ continue?: GnapContinue;
127
+ instance_id?: string;
128
+ }
129
+ /** Thrown by the issuance paths on a malformed request (the verify paths fail closed instead). */
130
+ export declare class GnapError extends Error {
131
+ constructor(message: string);
132
+ }
133
+ /** The PCA `resource` string for a GNAP (type, location) pair — the namespace actions are matched in. */
134
+ export declare function gnapActionResource(type: string, location: string): string;
135
+ /** Normalize an access array for issuance (throws on any malformed entry). */
136
+ export declare function normalizeAccess(items: readonly unknown[]): GnapResourceAccess[];
137
+ /**
138
+ * Map a GNAP access right onto PCA predicates (one per location). `type` namespaces the resource,
139
+ * `actions` become verbs, `locations` become resources, and `datatypes`/`identifier` become `where`
140
+ * conditions on the action's params. An absent `actions`/`locations` means "any" (verb `*` / a
141
+ * prefix-matching `*` resource).
142
+ */
143
+ export declare function accessToPredicates(access: GnapResourceAccess): Predicate[];
144
+ /** Does the issuer's granted right `g` fully contain the requested right `r`? */
145
+ export declare function accessContains(g: GnapResourceAccess, r: GnapResourceAccess): boolean;
146
+ /** Is `r` within the issuer's granted set `G` (covered by at least one of its rights)? */
147
+ export declare function accessWithin(G: GnapResourceAccess[], r: GnapResourceAccess): boolean;
148
+ /** Split a requested access array into the subset within the issuer's authority and the rest. */
149
+ export declare function clampAccess(issuerGranted: GnapResourceAccess[], requested: GnapResourceAccess[]): {
150
+ granted: GnapResourceAccess[];
151
+ dropped: GnapResourceAccess[];
152
+ };
153
+ /** The caveat recorded inside a ROOT GNAP grant's policy envelope (grant provenance). */
154
+ export declare const GNAP_GRANT_CAVEAT = "gnap_grant";
155
+ /** The caveat appended on each DELEGATED GNAP hop (the rights that hop was granted). */
156
+ export declare const GNAP_ACCESS_CAVEAT = "gnap_access";
157
+ export interface GnapGrantCaveat extends Caveat {
158
+ type: typeof GNAP_GRANT_CAVEAT;
159
+ /** The client key this grant was issued to (the bound holder, b64u). */
160
+ client_id: string;
161
+ granted_access: GnapResourceAccess[];
162
+ /** `hashCanonical` of the normalized request (tamper-evident provenance). */
163
+ request_digest: string;
164
+ /** Whether the grant followed a GNAP interaction. */
165
+ interacted: boolean;
166
+ ts: number;
167
+ }
168
+ export interface GnapAccessCaveat extends Caveat {
169
+ type: typeof GNAP_ACCESS_CAVEAT;
170
+ access: GnapResourceAccess[];
171
+ predicates: Predicate[];
172
+ request_digest: string;
173
+ client_id: string;
174
+ ts: number;
175
+ }
176
+ /**
177
+ * The EFFECTIVE granted access of a chain: the most-recent delegated hop's recorded rights, or (for a
178
+ * root-only grant) the root's recorded rights. Because every hop is clamped to its issuer at issue
179
+ * time, the leaf's recorded rights are the narrowest in the chain.
180
+ */
181
+ export declare function grantedAccessOf(chain: CapabilityChain): GnapResourceAccess[];
182
+ /** Resolve the b64u Ed25519 holder key from a request's client key (or an explicit override). */
183
+ export declare function resolveHolder(req: GnapGrantRequest, holderOverride?: string): string;
184
+ /** The holder key, rendered as a GNAP JWK (for a bound access-token response). */
185
+ export declare function holderJwk(holder: string): GnapJwk;
186
+ export interface GrantToCapabilityOptions {
187
+ /** The key that signs this hop: the principal secret for a root grant, or the parent holder's secret. */
188
+ issuerSecret: Uint8Array;
189
+ /** The issuer's b64u public key (principal public for root; = `parent.holder` for a delegation). */
190
+ issuerPublic: string;
191
+ /** Present → DELEGATE from this capability; absent → MINT a new root grant. */
192
+ parent?: Capability;
193
+ /** The full issuer chain, used to compute the issuer's effective authority for clamping. */
194
+ issuerChain?: CapabilityChain;
195
+ /** Drop requested rights that exceed the issuer's authority (default true). */
196
+ clampToIssuer?: boolean;
197
+ /** Explicit holder override (else derived from the request's client key). */
198
+ holder?: string;
199
+ /** Whether this grant followed a GNAP interaction (recorded in provenance). */
200
+ interacted?: boolean;
201
+ now?: number;
202
+ goal?: string;
203
+ riskPolicy?: RiskPolicy;
204
+ agentBinding?: AgentBinding;
205
+ salt?: string;
206
+ }
207
+ export interface GrantToCapabilityResult {
208
+ /** The newly issued hop (a root grant, or a delegated child). */
209
+ grant: Capability;
210
+ /** The full capability chain (issuer chain + the new hop). */
211
+ chain: CapabilityChain;
212
+ /** The bound holder key (b64u). */
213
+ holder: string;
214
+ /** The rights actually granted (after clamping). */
215
+ grantedAccess: GnapResourceAccess[];
216
+ /** Requested rights that exceeded the issuer's authority and were dropped. */
217
+ droppedAccess: GnapResourceAccess[];
218
+ /** The GNAP provenance caveat written into the capability. */
219
+ provenance: GnapGrantCaveat | GnapAccessCaveat;
220
+ }
221
+ /**
222
+ * Convert a GNAP grant request into a PCA capability bound to the client key, ATTENUATED to never
223
+ * exceed the issuer. With no `parent` this MINTS a root grant whose policy-envelope predicates ARE the
224
+ * requested access rights. With a `parent` it DELEGATES a narrower hop, recording the (clamped) rights
225
+ * as an append-only `gnap_access` caveat — so the effective authority is the intersection of the whole
226
+ * chain, and no hop can widen.
227
+ */
228
+ export declare function grantRequestToCapability(req: GnapGrantRequest, opts: GrantToCapabilityOptions): GrantToCapabilityResult;
229
+ export interface GnapAction {
230
+ verb: string;
231
+ resource: string;
232
+ params?: Record<string, unknown>;
233
+ reversibility_class?: string;
234
+ }
235
+ export interface GnapAuthorizeResult {
236
+ allowed: boolean;
237
+ reason?: string;
238
+ }
239
+ /**
240
+ * Decide whether `action` is authorized by a GNAP-issued capability chain. FAILS CLOSED. The chain must
241
+ * verify structurally, the root policy envelope must permit the action, AND every delegated hop's
242
+ * recorded `gnap_access` rights must permit it too (the per-hop intersection that enforces "never wider
243
+ * than the issuer" across the whole chain).
244
+ */
245
+ export declare function authorizeGnapAction(chain: CapabilityChain, action: GnapAction, opts?: {
246
+ expectedRootIssuer?: string;
247
+ }): GnapAuthorizeResult;
248
+ /** Encode a capability chain as a GNAP access-token `value` (self-contained, re-verified on use). */
249
+ export declare function encodeBoundToken(chain: CapabilityChain): string;
250
+ export interface CapabilityToResponseOptions {
251
+ expiresIn?: number;
252
+ /** Emit the token as bearer (`key:false`) instead of key-bound to the holder. */
253
+ bearer?: boolean;
254
+ instanceId?: string;
255
+ manageUri?: string;
256
+ /** Attach a continuation handle to the response. */
257
+ continue?: GnapContinue;
258
+ }
259
+ /** Render a (verified) PCA capability chain as a GNAP grant response with a bound access token. */
260
+ export declare function capabilityToGrantResponse(chain: CapabilityChain, opts?: CapabilityToResponseOptions): GnapGrantResponse;
261
+ export type GnapTokenVerifyResult = {
262
+ ok: true;
263
+ principal: string;
264
+ capability: Capability;
265
+ chain: CapabilityChain;
266
+ access: GnapResourceAccess[];
267
+ } | {
268
+ ok: false;
269
+ reason: string;
270
+ };
271
+ /**
272
+ * Verify an incoming GNAP bound token, mapping it back to a PCA principal + capability. FAILS CLOSED:
273
+ * a token that is not a decodable chain, or whose chain does not verify (optionally against
274
+ * `expectedRootIssuer`), returns `{ ok:false }`. The `principal` is the chain's root issuer key.
275
+ */
276
+ export declare function verifyGnapToken(value: string, opts?: {
277
+ expectedRootIssuer?: string;
278
+ }): GnapTokenVerifyResult;
279
+ /** The protected header of a GNAP `jwsd` detached JWS (§7.3.4). `created` is epoch SECONDS. */
280
+ export interface GnapJwsdHeader {
281
+ alg: 'EdDSA';
282
+ typ: 'gnap-binding-jwsd';
283
+ kid?: string;
284
+ htm: string;
285
+ uri: string;
286
+ created: number;
287
+ /** base64url(SHA-256(access-token value)) — binds the proof to a token when one is in play. */
288
+ ath?: string;
289
+ }
290
+ /** A raw Ed25519 key pair (the PCA key format: 32-byte seed secret, 32-byte public). */
291
+ export interface RawEd25519KeyPair {
292
+ secretKey: Uint8Array;
293
+ publicKey: Uint8Array;
294
+ }
295
+ export interface SignGnapRequestArgs {
296
+ /** The request body the proof covers (typically the GNAP grant request). */
297
+ body: unknown;
298
+ key: RawEd25519KeyPair;
299
+ htm: string;
300
+ uri: string;
301
+ /** Epoch SECONDS (default: now). */
302
+ created?: number;
303
+ kid?: string;
304
+ /** When an access token is in play, bind the proof to it via the `ath` claim. */
305
+ accessTokenValue?: string;
306
+ }
307
+ export interface SignGnapRequestResult {
308
+ /** The compact detached JWS: `BASE64URL(header)..BASE64URL(signature)`. */
309
+ detachedJws: string;
310
+ header: GnapJwsdHeader;
311
+ /** The b64u holder key this proof binds the request to. */
312
+ holder: string;
313
+ }
314
+ /**
315
+ * Produce a GNAP `jwsd` detached-JWS proof over `body`, signed by the client key (via `jose`). The JWS
316
+ * payload is the canonical body; the compact detached form (payload omitted) is what travels in the
317
+ * `Detached-JWS` header. The signing key's public half IS the PCA holder the grant binds to.
318
+ */
319
+ export declare function signGnapRequest(args: SignGnapRequestArgs): Promise<SignGnapRequestResult>;
320
+ export interface VerifyGnapRequestArgs {
321
+ detachedJws: string;
322
+ body: unknown;
323
+ /** The b64u Ed25519 holder key the proof must verify under. */
324
+ holder: string;
325
+ htm: string;
326
+ uri: string;
327
+ /** Max accepted age of `created` in seconds (default 300). */
328
+ maxAgeSec?: number;
329
+ /** Epoch ms clock (default now). */
330
+ now?: number;
331
+ /** When set, the proof's `ath` must bind exactly this access-token value. */
332
+ accessTokenValue?: string;
333
+ }
334
+ export type VerifyGnapRequestResult = {
335
+ ok: true;
336
+ holder: string;
337
+ header: GnapJwsdHeader;
338
+ } | {
339
+ ok: false;
340
+ reason: string;
341
+ };
342
+ /**
343
+ * Verify a GNAP `jwsd` detached-JWS proof (via `jose`) and bind the request to the holder key. FAILS
344
+ * CLOSED on any deviation: a bad signature, a tampered body, a wrong holder, a mismatched `htm`/`uri`,
345
+ * a stale/future `created`, or an `ath` that does not bind the named access token.
346
+ */
347
+ export declare function verifyGnapRequest(args: VerifyGnapRequestArgs): Promise<VerifyGnapRequestResult>;
348
+ /** A GNAP continuation mapped onto a PCA step-up (the tier-2/3 co-signature required to proceed). */
349
+ export interface GnapStepUpDescriptor {
350
+ /** The PCA step-up tier: 2 = + guardian co-sign, 3 = + principal co-sign. */
351
+ tier: 2 | 3;
352
+ /** The threshold `t` the folded PCActn must reach. */
353
+ t: 1 | 2 | 3;
354
+ /** The signer set the co-signatures are verified against. */
355
+ signerSet: Signer[];
356
+ reason: string;
357
+ /** The continuation access-token value the client returns with. */
358
+ continueToken: string;
359
+ }
360
+ export interface GnapContinuationResult {
361
+ /** A GNAP grant response carrying ONLY a `continue` handle (no token yet). */
362
+ response: GnapGrantResponse;
363
+ stepUp: GnapStepUpDescriptor;
364
+ }
365
+ export interface StepUpAssessment {
366
+ required: boolean;
367
+ reason: string;
368
+ /** Requested rights that exceed the issuer's authority (each needs escalated authority). */
369
+ beyond: GnapResourceAccess[];
370
+ tier: 2 | 3;
371
+ }
372
+ /**
373
+ * Decide whether a grant request needs a continuation/step-up: it does when GNAP interaction is
374
+ * requested, when an explicit higher tier is asked for, or when (given the issuer's chain) the request
375
+ * asks for rights BEYOND the issuer's own authority — which can only be unlocked by a human/guardian
376
+ * co-signature, not minted by the agent alone.
377
+ */
378
+ export declare function gnapRequestRequiresStepUp(req: GnapGrantRequest, opts?: {
379
+ issuerChain?: CapabilityChain;
380
+ tier?: 2 | 3;
381
+ }): StepUpAssessment;
382
+ export interface BeginContinuationArgs {
383
+ signerSet: Signer[];
384
+ t: 1 | 2 | 3;
385
+ tier: 2 | 3;
386
+ continueUri: string;
387
+ continueToken: string;
388
+ wait?: number;
389
+ reason?: string;
390
+ }
391
+ /** Begin a GNAP continuation: emit the `continue` handle + the PCA step-up it resolves through. */
392
+ export declare function beginGnapContinuation(args: BeginContinuationArgs): GnapContinuationResult;
393
+ /**
394
+ * Produce one role's step-up co-signature share over the action's PCActn — the co-signature a
395
+ * guardian/principal device returns through the GNAP continuation. For 'guardian'/'principal' it binds
396
+ * the signer set + `t` (replay-safe); the 'agent' share is the PCActn's own leaf signature.
397
+ */
398
+ export declare function gnapStepUpShare(body: PCActnBody, role: SignerRole, secret: Uint8Array, signerSet: Signer[], t: 1 | 2 | 3): ThresholdShare;
399
+ export interface CompleteContinuationArgs {
400
+ grant: Capability;
401
+ chain: CapabilityChain;
402
+ plan: PlanNode[];
403
+ nodeId: string;
404
+ params?: Record<string, unknown>;
405
+ counter: number;
406
+ aud: string;
407
+ now?: number;
408
+ ttlMs?: number;
409
+ /** The agent-leaf holder secret (produces the PCActn leaf signature = the 'agent' share). */
410
+ agentLeafSecret: Uint8Array;
411
+ signerSet: Signer[];
412
+ t: 1 | 2 | 3;
413
+ /** The guardian/principal secrets reached via the continuation, each folded in as a threshold share. */
414
+ cosignSecrets: {
415
+ role: SignerRole;
416
+ secret: Uint8Array;
417
+ }[];
418
+ }
419
+ export interface CompleteContinuationResult {
420
+ pcactn: PCActn;
421
+ threshold: ThresholdSignature;
422
+ verdict: ThresholdVerdict;
423
+ }
424
+ /**
425
+ * Resolve a continuation: build the action's PCActn (agent leaf signature) and FOLD the step-up
426
+ * co-signatures into its `threshold`, then verify the threshold `t` is reached. This is the concrete
427
+ * realization of "a grant that needs more authority continues via a step-up co-signature folded into
428
+ * the PCActn" — the multi-signature carrier; a FROST aggregate share slots in the same `agent`/group
429
+ * position without changing the property.
430
+ */
431
+ export declare function completeGnapContinuation(args: CompleteContinuationArgs): CompleteContinuationResult;
432
+ export interface AgentGnapMapping {
433
+ gnap: string;
434
+ pca: string;
435
+ note: string;
436
+ }
437
+ export interface AgentGnapProfile {
438
+ name: string;
439
+ version: string;
440
+ rfc: string;
441
+ summary: string;
442
+ /** How each GNAP primitive maps onto a PCA concept. */
443
+ mapping: AgentGnapMapping[];
444
+ /** Supported key-proof methods (§7.3). */
445
+ proofMethods: string[];
446
+ /** The multi-hop agent-delegation model. */
447
+ multiHop: string;
448
+ /** How a continuation resolves. */
449
+ stepUp: string;
450
+ /** The security properties this profile guarantees. */
451
+ security: string[];
452
+ }
453
+ /** The machine-readable Agent-GNAP profile spec (see the module header for the full narrative). */
454
+ export declare const AGENT_GNAP_PROFILE: AgentGnapProfile;