@agentidentitytrustprotocol/aitp 0.9.0 → 0.11.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.
Files changed (3) hide show
  1. package/index.d.ts +438 -416
  2. package/index.js +659 -269
  3. package/package.json +14 -19
package/index.d.ts CHANGED
@@ -1,165 +1,248 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
-
4
1
  /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ /** An AITP agent: a signing key and (once built) its Manifest. */
4
+ export declare class AitpAgent {
5
+ /**
6
+ * Generate an agent with a fresh random signing key.
7
+ *
8
+ * `opts.suite` selects the algorithm — `"ed25519"` (default) or
9
+ * `"p256"`. Symmetric with the Python SDK's
10
+ * `AitpAgent.generate(suite="ed25519")`.
11
+ *
12
+ * ```ts
13
+ * const ed = AitpAgent.generate(); // Ed25519
14
+ * const p = AitpAgent.generate({ suite: 'p256' }); // P-256
15
+ * ```
16
+ */
17
+ static generate(opts?: GenerateOpts | undefined | null): AitpAgent
18
+ /**
19
+ * Construct an agent from a 32-byte seed (deterministic).
20
+ *
21
+ * `opts.suite` matches `AitpAgent.generate`. For `"p256"`, a tiny
22
+ * fraction of 32-byte seeds are not valid private scalars (zero
23
+ * or ≥ curve order) and raise.
24
+ *
25
+ * Note: the prior `AitpAgent.fromP256Seed` factory and the
26
+ * no-arg `AitpAgent.generate*` variants were removed in favor of
27
+ * this parameterized API so the Node SDK matches the Python SDK
28
+ * surface (CLAUDE.md mandates SDK symmetry).
29
+ */
30
+ static fromSeed(seed: Buffer, opts?: GenerateOpts | undefined | null): AitpAgent
31
+ /** The agent's AID string (`aid:pubkey:...`). */
32
+ get aid(): string
33
+ /**
34
+ * Build and sign the agent's Manifest. Returns `ManifestEnvelope`
35
+ * JSON and caches the Manifest for `newSession` / `newResponder`.
36
+ *
37
+ * See `ManifestOpts.identityType` for the OIDC switch.
38
+ */
39
+ buildManifest(opts: ManifestOpts): string
40
+ /**
41
+ * Create a new outbound (initiator) handshake session.
42
+ *
43
+ * `jwks` is an optional `JwksProvider` used when the peer's
44
+ * manifest advertises an OIDC identity. `opts.trustAnchors`
45
+ * overrides the manifest's `accepted_trust_anchors`.
46
+ */
47
+ newSession(jwks?: JwksProvider | undefined | null, opts?: SessionOpts | undefined | null): JsInitiatorSession
48
+ /**
49
+ * Create a new inbound (responder) handshake session. Mirror of
50
+ * `newSession`.
51
+ */
52
+ newResponder(jwks?: JwksProvider | undefined | null, opts?: SessionOpts | undefined | null): JsResponderSession
53
+ /**
54
+ * Verify a compact-JWS TCT token and require `requiredGrant`.
55
+ * Rejects on an invalid, mis-audienced, expired, revoked, or
56
+ * under-scoped TCT.
57
+ *
58
+ * `expectedAudience` defaults to `null`, which means "verify as the
59
+ * holder" (RFC-AITP-0005 §9 receipt model — `this.aid` is used).
60
+ * Resource servers verifying a TCT presented by a peer should pass
61
+ * the TCT's own `aud` claim as `expectedAudience` (in v0.2 this
62
+ * equals `sub`).
63
+ *
64
+ * `revokedJtis` (F-1) is an optional list of revoked TCT `jti`
65
+ * strings; any TCT whose `jti` is in the list is rejected even if
66
+ * otherwise valid. Omit (or pass `null`) to disable the revocation
67
+ * gate. The caller is responsible for sourcing the revoked set (e.g.
68
+ * from a `RevocationList` it fetched and verified).
69
+ */
70
+ verifyTct(tctToken: string, requiredGrant: string, expectedAudience?: string | undefined | null, revokedJtis?: Array<string> | undefined | null): JsTctIdentity
71
+ /**
72
+ * Like `verifyTct`, but consults a `TctStore` first: a byte-identical,
73
+ * already-verified, still-valid TCT skips the signature check (the
74
+ * verification hot path for an agent that sees the same TCT on many
75
+ * requests). All cheap policy checks (expiry, audience, required grant,
76
+ * and the optional `revokedJtis` gate) still run on every call; only the
77
+ * signature check is elided.
78
+ */
79
+ verifyTctCached(tctToken: string, requiredGrant: string, store: JsTctStore, expectedAudience?: string | undefined | null, revokedJtis?: Array<string> | undefined | null): JsTctIdentity
80
+ /**
81
+ * Build a delegation compact-JWS token from a held **grant voucher**
82
+ * (RFC-AITP-0006). `voucherToken` is the `grantVoucher` surfaced by
83
+ * `complete()` / `processCommit()`. The delegatee's key binding is
84
+ * derived from `delegateeAid` itself, so no separate public-key
85
+ * argument is needed in v0.2.
86
+ */
87
+ buildDelegation(voucherToken: string, delegateeAid: string, scope: Array<string>, ttlSecs?: number | undefined | null): string
88
+ /**
89
+ * Mint a fresh compact-JWS TCT for a delegatee after the verifier has
90
+ * confirmed the delegation. The subject-key binding is derived from
91
+ * the verified delegation's `delegatee` AID.
92
+ */
93
+ issueTctForDelegatee(verified: JsDelegationVerified, ttlSecs?: number | undefined | null): string
94
+ /**
95
+ * Sign a `RevocationList` with this agent's key. `entries` carries
96
+ * the revoked-TCT records; `expiresInSecs` defaults to 3600 s.
97
+ * Returns the on-wire `RevocationListEnvelope` JSON.
98
+ */
99
+ signRevocationList(entries: Array<RevocationEntryInput>, expiresInSecs?: number | undefined | null): string
100
+ /**
101
+ * Holder side: build a `TctRenewalPayload` JSON for an in-band
102
+ * renewal of `currentTctToken` — the holder's current TCT as a
103
+ * compact-JWS string (RFC-AITP-0013).
104
+ *
105
+ * Behind the `renewal` Cargo feature, which is **on by default**; a
106
+ * `--no-default-features` build omits it.
107
+ */
108
+ buildRenewalRequest(currentTctToken: string): string
109
+ /**
110
+ * Issuer side: verify a `TctRenewalPayload` JSON request and mint a
111
+ * fresh TCT, returned as a compact-JWS token string.
112
+ *
113
+ * Behind the `renewal` Cargo feature (on by default).
114
+ */
115
+ processRenewalRequest(requestPayloadJson: string, manifestExpUnixSecs: number, newTtlSecs: number): string
116
+ }
5
117
 
6
- /**
7
- * Input shape for `signRevocationList`. Field names map to spec
8
- * `RevocationEntry` (jti, revoked_at, reason).
9
- */
10
- export interface RevocationEntryInput {
11
- /** JTI of the revoked TCT (UUID string). */
12
- jti: string
118
+ /** Outbound handshake session — drives the initiator side. */
119
+ export declare class JsInitiatorSession {
13
120
  /**
14
- * Unix seconds when the issuing peer revoked the TCT.
15
- * Defaults to the current time when omitted.
121
+ * Step 1 — build the `MUTUAL_HELLO` envelope.
122
+ *
123
+ * `oidcMintJwt`: required for OIDC agents. Receives the handshake-
124
+ * generated `pop_nonce` (string) and must return the JWT (string).
16
125
  */
17
- revokedAt?: number
18
- /** Optional human-readable reason. Not used in trust decisions. */
19
- reason?: string
126
+ buildHello(peerManifestJson: string, requestedGrants: Array<string>, oidcMintJwt?: ((arg: string) => string) | undefined | null): string
127
+ /** Step 2 — process `MUTUAL_HELLO_ACK`, produce `MUTUAL_COMMIT`. */
128
+ processHelloAck(helloAckJson: string, sessionId: string): string
129
+ /**
130
+ * Step 3 — process `MUTUAL_COMMIT_ACK`. Returns the completed
131
+ * handshake: the TCT the peer issued to us (opaque compact-JWS
132
+ * token plus its decoded claims) and the optional grant voucher.
133
+ */
134
+ complete(commitAckJson: string): JsCompletedHandshake
20
135
  }
21
- /** Options for `buildManifest`. */
22
- export interface ManifestOpts {
23
- /** Human-readable agent name; also the pinned-key identity subject. */
24
- displayName: string
25
- /** Absolute URL of this agent's handshake endpoint. */
26
- handshakeEndpoint: string
27
- /** Capabilities this agent offers to peers. */
28
- offeredCaps: Array<string>
29
- /** Capabilities a peer must grant back (optional). */
30
- requiredCaps?: Array<string>
31
- /** Manifest TTL in seconds (optional; defaults to 3600). */
32
- ttlSecs?: number
33
- /** Identity presentation type — `"pinned_key"` (default) or `"oidc"`. */
34
- identityType?: string
35
- /** OIDC issuer URL (required when `identityType="oidc"`). */
36
- oidcIssuer?: string
37
- /** OIDC subject identifier (required when `identityType="oidc"`). */
38
- oidcSubject?: string
136
+
137
+ /** Inbound handshake session — drives the responder side. */
138
+ export declare class JsResponderSession {
39
139
  /**
40
- * Override the manifest's accepted_trust_anchors list. Defaults to
41
- * `[oidc_issuer]` for OIDC mode and `[]` for pinned-key mode.
140
+ * Process an incoming `MUTUAL_HELLO` envelope.
141
+ *
142
+ * `oidcMintJwt`: required for OIDC agents (see `JsInitiatorSession.buildHello`).
42
143
  */
43
- acceptedTrustAnchors?: Array<string>
144
+ processHello(helloJson: string, oidcMintJwt?: ((arg: string) => string) | undefined | null): JsHelloAckResult
145
+ /** Process an incoming `MUTUAL_COMMIT` envelope. */
146
+ processCommit(commitJson: string): JsCommitAckResult
44
147
  }
148
+
45
149
  /**
46
- * Trust-anchor override for `newSession` / `newResponder`.
150
+ * In-memory OIDC JWKS provider — issuer URL → list of JWK objects.
47
151
  *
48
- * JWKS provider is passed as a separate argument (napi-rs can't put a
49
- * class reference inside an `#[napi(object)]` struct).
152
+ * The Node caller fetches the JWKS (the SDK has no HTTP client) and
153
+ * hands the parsed objects to this provider. Implements `JwksResolver`
154
+ * internally so the handshake state machine can dispatch through it.
50
155
  */
51
- export interface SessionOpts {
156
+ export declare class JwksProvider {
52
157
  /**
53
- * Override the agent manifest's accepted_trust_anchors. `null`
54
- * reuses the manifest's list.
158
+ * Construct from an object mapping issuer URLs to arrays of JWK
159
+ * objects. Each JWK must be a standard RFC 7517 representation
160
+ * (`kty`, `crv`, `x`, ...). Pass `{}` for an empty provider and
161
+ * `upsert` later.
55
162
  */
56
- trustAnchors?: Array<string>
163
+ constructor(keys?: unknown | undefined | null)
164
+ /**
165
+ * Add or replace the JWKs for an issuer. `keys` is a JS array of
166
+ * JWK objects.
167
+ */
168
+ upsert(issuer: string, keys: unknown): void
169
+ /** Drop all keys for an issuer. */
170
+ remove(issuer: string): void
171
+ /** Return the issuer URLs currently registered. */
172
+ issuers(): Array<string>
57
173
  }
174
+
58
175
  /**
59
- * Options for `AitpAgent.generate` and `AitpAgent.fromSeed`.
176
+ * Fluent builder for issuing a `SessionBundleEnvelope`. Constructed
177
+ * from the coordinator's `AitpAgent`.
60
178
  *
61
- * Mirrors the Python SDK's `suite="ed25519"|"p256"` keyword argument so
62
- * the two SDKs share one shape per operation. `null`/omitted defaults
63
- * to `"ed25519"`.
179
+ * The Rust struct is suffixed `Js` to avoid a name collision with the
180
+ * `aitp_session_bundle::SessionBundleBuilder` imported above; the
181
+ * `#[napi(js_name)]` attribute exposes it to JavaScript under the
182
+ * plain name `SessionBundleBuilder` for parity with the Python SDK.
64
183
  */
65
- export interface GenerateOpts {
184
+ export declare class SessionBundleBuilder {
185
+ /** Construct a builder backed by `coordinator`'s signing key. */
186
+ constructor(coordinator: AitpAgent)
187
+ /** Set the session ID (UUIDv4 string). Defaults to a fresh one. */
188
+ sessionId(uuidStr: string): this
189
+ /** Override `issued_at` (unix seconds). Defaults to "now" at build. */
190
+ issuedAt(unixSecs: number): this
66
191
  /**
67
- * Signing suite. Accepted values: `"ed25519"` (default) or
68
- * `"p256"` (RFC-AITP-0001 §5.4.3).
192
+ * Add a participant entry. `tctToken` is the participant's TCT as an
193
+ * opaque compact-JWS string (the `tct` field returned by `complete()`
194
+ * / `processCommit()`), carried into the bundle verbatim.
69
195
  */
70
- suite?: string
71
- }
72
- /**
73
- * Outcome shape returned by `verifySessionBundle`. `kind` is `"clear"`
74
- * or `"degraded"`; `droppedAids` is empty in the `"clear"` case.
75
- */
76
- export interface JsBundleOutcome {
77
- kind: string
78
- activeAids: Array<string>
79
- droppedAids: Array<string>
196
+ participant(aid: string, tctToken: string): this
197
+ /** Construct, sign, and return the `SessionBundleEnvelope` JSON. */
198
+ build(): string
80
199
  }
200
+ export type SessionBundleBuilderJs = SessionBundleBuilder
201
+
81
202
  /**
82
- * Verify a `SessionBundleEnvelope` JSON. `nowUnixSecs` defaults to
83
- * the system clock. `revocationCheck` receives a JTI string and
84
- * returns true if revoked.
85
- */
86
- export declare function verifySessionBundle(bundleEnvelopeJson: string, verifierAid: string, nowUnixSecs?: number | undefined | null, revocationCheck?: (...args: any[]) => any | undefined | null): JsBundleOutcome
87
- /**
88
- * The verified delegation's salient fields. Returned from
89
- * `verifyDelegation` and consumed by `AitpAgent.issueTctForDelegatee`.
203
+ * Holds a list of 32-byte SPKI pins. `isPinned(certDer)` returns true
204
+ * iff the cert's SPKI hash is in the list.
90
205
  */
91
- export interface JsDelegationVerified {
206
+ export declare class SpkiPinVerifier {
92
207
  /**
93
- * AID of the ultimate grantor (the original TCT issuer that gave
94
- * grants to `issuedBy`). Equal to the delegation's `aud` and to the
95
- * embedded voucher's `iss`. The responder side checks this matches
96
- * its own AID before redeeming.
208
+ * Construct from an array of 32-byte Buffers. Throws if any pin is
209
+ * not exactly 32 bytes.
97
210
  */
98
- delegator: string
99
- /** AID of the recipient (C) — who will receive a fresh TCT (`sub`). */
100
- delegatee: string
101
- /** AID of the agent that issued this delegation (B in the RFC) (`iss`). */
102
- issuedBy: string
103
- /**
104
- * Capabilities being delegated (`scope`). Always a subset of the
105
- * root voucher's grants.
106
- */
107
- grants: Array<string>
108
- /** Unix-seconds expiry of the delegation token itself (`exp`). */
109
- expiresAt: number
110
- /**
111
- * RFC 7638 JWK thumbprint of the delegatee's key (`cnf.jkt`). In
112
- * v0.2 this is derived from — and must match — the key encoded in
113
- * `delegatee`'s AID; the fresh TCT's key binding is taken from the
114
- * AID, not from this field.
115
- */
116
- cnfJkt: string
211
+ constructor(pins: Array<Buffer>)
212
+ /** Returns true iff the SPKI hash of `certDer` is in the pin list. */
213
+ isPinned(certDer: Buffer): boolean
214
+ /** Number of pins currently held. */
215
+ get len(): number
117
216
  }
217
+
118
218
  /**
119
- * Verify a delegation compact JWS under **strict AITP v0.2**
120
- * (RFC-AITP-0006 single-hop). `verifierAid` is the verifier's own AID
121
- * string — it MUST equal the delegation's `aud` (the root grantor), and
122
- * the embedded voucher MUST verify under the verifier's own key.
123
- *
124
- * Any token carrying a non-empty `chain` (an RFC-AITP-0011 multi-hop
125
- * delegation) is **rejected** with `DELEGATION_MULTIHOP_NOT_SUPPORTED`,
126
- * matching the Rust core default. To allow multi-hop chains, call
127
- * `verifyDelegationMultihop` instead.
128
- *
129
- * `revokedJtis` is an optional list of revoked `jti` strings — the
130
- * verifier's own deny list. When non-empty, a token whose
131
- * `voucher.src_jti` is in it is rejected after every signature check passes
132
- * (RFC-AITP-0006 §4 step 7, ordered per RFC-AITP-0008 §3.3). **Verifiers
133
- * SHOULD supply it.** Omitting it silently redeems a delegation whose
134
- * source TCT has been revoked, which step 7 states as a MUST-reject.
135
- */
136
- export declare function verifyDelegation(token: string, verifierAid: string, revokedJtis?: Array<string> | undefined | null): JsDelegationVerified
137
- /**
138
- * Verify a delegation compact JWS allowing **RFC-AITP-0011 multi-hop**
139
- * chains up to `maxDelegationHops` total hops (`chain.length + 1`).
140
- *
141
- * The strict single-hop `verifyDelegation` is the safe default; this
142
- * function additionally allows multi-hop chains. Present by default (the
143
- * `multihop-delegation` feature); a `--no-default-features` build omits it.
144
- *
145
- * `maxDelegationHops` defaults to `DEFAULT_MAX_DELEGATION_HOPS` (3, the RFC-AITP-0011 §2
146
- * recommended ceiling). Pass a smaller value for a tighter bound;
147
- * `maxDelegationHops = 0` reverts to strict single-hop (rejects any non-empty chain).
219
+ * A bounded, in-memory cache of **successful** TCT verifications, keyed by
220
+ * the SHA-256 of the exact compact-JWS TCT token bytes.
148
221
  *
149
- * `revokedJtis`, when non-empty, is consulted twice — both only after every
150
- * signature check: once for the root `voucher.src_jti` (RFC-AITP-0006 §4
151
- * step 7), and once for every hop's `jti`, meaning each chain entry and the
152
- * outer token (RFC-AITP-0011 §6). Both are MUST-rejects, and a revoked hop
153
- * invalidates every hop downstream of it — there is no partial-validity
154
- * model.
222
+ * Purpose: a high-throughput verifier (e.g. a writer agent checking a
223
+ * capability on every request) that repeatedly sees the *same* TCT can skip
224
+ * the Ed25519/P-256 signature verification after the first time.
155
225
  *
156
- * Note that §6 specifies each hop `jti` be checked against the deny list of
157
- * *that hop's issuer*, which one flat list cannot express, so it is applied
158
- * to every hop regardless of issuer. That can only reject more, never
159
- * accept a revoked hop, but it does mean a list aggregated across several
160
- * issuers lets any contributor revoke any hop.
226
+ * **Safety.** The key is a cryptographic hash of the exact signed bytes, so
227
+ * only a byte-identical token — whose signature was already verified once
228
+ * — can hit. A tampered token hashes differently, misses, and is fully
229
+ * verified. The cheap policy checks (expiry, audience, required grant) are
230
+ * re-run on **every** hit; only the signature check is elided. Eviction is
231
+ * FIFO once `maxEntries` is reached.
161
232
  */
162
- export declare function verifyDelegationMultihop(token: string, verifierAid: string, maxDelegationHops?: number | undefined | null, revokedJtis?: Array<string> | undefined | null): JsDelegationVerified
233
+ export declare class TctStore {
234
+ /**
235
+ * Create a cache holding at most `maxEntries` verified TCTs (FIFO
236
+ * eviction). `maxEntries` must be >= 1.
237
+ */
238
+ constructor(maxEntries: number)
239
+ /** Number of cached verifications currently held. */
240
+ len(): number
241
+ /** Drop all cached entries. */
242
+ clear(): void
243
+ }
244
+ export type JsTctStore = TctStore
245
+
163
246
  /**
164
247
  * Compute the RFC 7638 JWK thumbprint of the public key embedded in
165
248
  * an AID — the value an OIDC IdP MUST place in the JWT's `cnf.jkt`
@@ -172,65 +255,49 @@ export declare function verifyDelegationMultihop(token: string, verifierAid: str
172
255
  * in JavaScript is both error-prone and a divergence risk.
173
256
  */
174
257
  export declare function computeAidJkt(aid: string): string
258
+
175
259
  /**
176
260
  * Compute the SHA-256 SPKI hash for an X.509 DER certificate. Returns
177
261
  * a 32-byte Buffer. Throws if `certDer` is not a parseable certificate.
178
262
  */
179
263
  export declare function computeSpkiHash(certDer: Buffer): Buffer
264
+
180
265
  /**
181
- * Verify a `RevocationListEnvelope` JSON string against a pinned issuer.
182
- *
183
- * Resolves on success; on failure throws an `Error` whose **`code`** property
184
- * is one of `signature_invalid`, `issuer_mismatch`, `version_unknown`,
185
- * `expired`, `malformed`. Branch on `error.code`, never on `error.message`:
186
- * the code is the contract, the message wording is not.
266
+ * Options for `AitpAgent.generate` and `AitpAgent.fromSeed`.
187
267
  *
188
- * Establishes **authenticity and non-expiry only** — that the snapshot was
189
- * signed by the holder of `expectedIssuerAid` and that its `expires_at` has
190
- * not passed. It deliberately does not check `published_at` staleness:
191
- * RFC-AITP-0008 §3 puts freshness policy at the consuming peer, and
192
- * collapsing authenticity and freshness into a single switch is how a
193
- * `soft_fail` mode ends up reporting a *forged* snapshot as not-revoked.
194
- * The caller owns the staleness budget.
268
+ * Mirrors the Python SDK's `suite="ed25519"|"p256"` keyword argument so
269
+ * the two SDKs share one shape per operation. `null`/omitted defaults
270
+ * to `"ed25519"`.
195
271
  */
196
- export declare function verifyRevocationList(envelopeJson: string, expectedIssuerAid: string, nowUnixSecs?: number | undefined | null): void
272
+ export interface GenerateOpts {
273
+ /**
274
+ * Signing suite. Accepted values: `"ed25519"` (default) or
275
+ * `"p256"` (RFC-AITP-0001 §5.4.3).
276
+ */
277
+ suite?: string
278
+ }
279
+
197
280
  /**
198
- * The exact bytes a revocation snapshot's signature is computed over:
199
- * `JCS(revocation_list)` — the **inner** body, not the transport wrapper.
200
- *
201
- * Exposed so a caller needing the signed bytes (an independent verifier, an
202
- * HSM signing path, a debugging tool) obtains them rather than reconstructing
203
- * the shape at the call site. Reconstructing it is how signer, verifier and
204
- * conformance fixture drifted apart before 0.5.0.
281
+ * Outcome shape returned by `verifySessionBundle`. `kind` is `"clear"`
282
+ * or `"degraded"`; `droppedAids` is empty in the `"clear"` case.
205
283
  */
206
- export declare function revocationSigningBytes(envelopeJson: string): Buffer
207
- /** Result of `processHello`: response body plus session id. */
208
- export interface JsHelloAckResult {
209
- /** `MUTUAL_HELLO_ACK` envelope JSON — set as the HTTP response body. */
210
- ackJson: string
211
- /** Correlation id — set as the `X-Aitp-Session-Id` response header. */
212
- sessionId: string
284
+ export interface JsBundleOutcome {
285
+ kind: string
286
+ activeAids: Array<string>
287
+ droppedAids: Array<string>
213
288
  }
289
+
214
290
  /**
215
- * The salient claims of a TCT obtained at handshake completion. Mirrors
216
- * `aitp_tct::TctClaims`; timestamps are Unix seconds as JS `number`s.
291
+ * Result of `processCommit`: response body plus the completed handshake
292
+ * (held TCT token, its claims, and the optional grant voucher).
217
293
  */
218
- export interface JsHandshakeTctClaims {
219
- /** Issuer AID (`iss`) — the peer that minted and is bound by the TCT. */
220
- iss: string
221
- /** Subject AID (`sub`) — the holder the TCT authorizes. */
222
- sub: string
223
- /** Audience AID (`aud`). In v0.2 this equals `sub`. */
224
- aud: string
225
- /** Capability grants the TCT authorizes. */
226
- grants: Array<string>
227
- /** Issued-at, Unix seconds (`iat`). */
228
- iat: number
229
- /** Expiry, Unix seconds (`exp`). */
230
- exp: number
231
- /** TCT unique identifier (`jti`, UUID string). */
232
- jti: string
294
+ export interface JsCommitAckResult {
295
+ /** `MUTUAL_COMMIT_ACK` envelope JSON — set as the HTTP response body. */
296
+ ackJson: string
297
+ /** The TCT (and voucher) the initiator issued to us. */
298
+ completed: JsCompletedHandshake
233
299
  }
300
+
234
301
  /**
235
302
  * A completed handshake: the TCT the peer issued to us (as an opaque
236
303
  * compact-JWS token plus its decoded claims) and the optional companion
@@ -252,16 +319,68 @@ export interface JsCompletedHandshake {
252
319
  */
253
320
  grantVoucher?: string
254
321
  }
322
+
255
323
  /**
256
- * Result of `processCommit`: response body plus the completed handshake
257
- * (held TCT token, its claims, and the optional grant voucher).
324
+ * The verified delegation's salient fields. Returned from
325
+ * `verifyDelegation` and consumed by `AitpAgent.issueTctForDelegatee`.
258
326
  */
259
- export interface JsCommitAckResult {
260
- /** `MUTUAL_COMMIT_ACK` envelope JSON — set as the HTTP response body. */
327
+ export interface JsDelegationVerified {
328
+ /**
329
+ * AID of the ultimate grantor (the original TCT issuer that gave
330
+ * grants to `issuedBy`). Equal to the delegation's `aud` and to the
331
+ * embedded voucher's `iss`. The responder side checks this matches
332
+ * its own AID before redeeming.
333
+ */
334
+ delegator: string
335
+ /** AID of the recipient (C) — who will receive a fresh TCT (`sub`). */
336
+ delegatee: string
337
+ /** AID of the agent that issued this delegation (B in the RFC) (`iss`). */
338
+ issuedBy: string
339
+ /**
340
+ * Capabilities being delegated (`scope`). Always a subset of the
341
+ * root voucher's grants.
342
+ */
343
+ grants: Array<string>
344
+ /** Unix-seconds expiry of the delegation token itself (`exp`). */
345
+ expiresAt: number
346
+ /**
347
+ * RFC 7638 JWK thumbprint of the delegatee's key (`cnf.jkt`). In
348
+ * v0.2 this is derived from — and must match — the key encoded in
349
+ * `delegatee`'s AID; the fresh TCT's key binding is taken from the
350
+ * AID, not from this field.
351
+ */
352
+ cnfJkt: string
353
+ }
354
+
355
+ /**
356
+ * The salient claims of a TCT obtained at handshake completion. Mirrors
357
+ * `aitp_tct::TctClaims`; timestamps are Unix seconds as JS `number`s.
358
+ */
359
+ export interface JsHandshakeTctClaims {
360
+ /** Issuer AID (`iss`) — the peer that minted and is bound by the TCT. */
361
+ iss: string
362
+ /** Subject AID (`sub`) — the holder the TCT authorizes. */
363
+ sub: string
364
+ /** Audience AID (`aud`). In v0.2 this equals `sub`. */
365
+ aud: string
366
+ /** Capability grants the TCT authorizes. */
367
+ grants: Array<string>
368
+ /** Issued-at, Unix seconds (`iat`). */
369
+ iat: number
370
+ /** Expiry, Unix seconds (`exp`). */
371
+ exp: number
372
+ /** TCT unique identifier (`jti`, UUID string). */
373
+ jti: string
374
+ }
375
+
376
+ /** Result of `processHello`: response body plus session id. */
377
+ export interface JsHelloAckResult {
378
+ /** `MUTUAL_HELLO_ACK` envelope JSON — set as the HTTP response body. */
261
379
  ackJson: string
262
- /** The TCT (and voucher) the initiator issued to us. */
263
- completed: JsCompletedHandshake
380
+ /** Correlation id — set as the `X-Aitp-Session-Id` response header. */
381
+ sessionId: string
264
382
  }
383
+
265
384
  /** The verified peer identity carried by a TCT. */
266
385
  export interface JsTctIdentity {
267
386
  /** AID of the agent that issued (and is bound by) the TCT (`iss`). */
@@ -273,255 +392,158 @@ export interface JsTctIdentity {
273
392
  /** TCT unique identifier (`jti`). */
274
393
  jti: string
275
394
  }
395
+
396
+ /** Options for `buildManifest`. */
397
+ export interface ManifestOpts {
398
+ /** Human-readable agent name; also the pinned-key identity subject. */
399
+ displayName: string
400
+ /** Absolute URL of this agent's handshake endpoint. */
401
+ handshakeEndpoint: string
402
+ /** Capabilities this agent offers to peers. */
403
+ offeredCaps: Array<string>
404
+ /** Capabilities a peer must grant back (optional). */
405
+ requiredCaps?: Array<string>
406
+ /** Manifest TTL in seconds (optional; defaults to 3600). */
407
+ ttlSecs?: number
408
+ /** Identity presentation type — `"pinned_key"` (default) or `"oidc"`. */
409
+ identityType?: string
410
+ /** OIDC issuer URL (required when `identityType="oidc"`). */
411
+ oidcIssuer?: string
412
+ /** OIDC subject identifier (required when `identityType="oidc"`). */
413
+ oidcSubject?: string
414
+ /**
415
+ * Override the manifest's accepted_trust_anchors list. Defaults to
416
+ * `[oidc_issuer]` for OIDC mode and `[]` for pinned-key mode.
417
+ */
418
+ acceptedTrustAnchors?: Array<string>
419
+ }
420
+
276
421
  /**
277
- * Verify a `ManifestEnvelope` JSON string. Used by the AITP Control Plane
278
- * during agent enrollment, and by any consumer reading an AID or endpoint
279
- * out of a peer's manifest.
280
- *
281
- * On failure throws an `Error` whose **`code`** property is one of
282
- * `signature_invalid`, `pop_failed`, `aid_mismatch`, `expired`,
283
- * `version_unknown`, `identity_hint_malformed`,
284
- * `incompatible_identity_type`, `malformed`. Branch on `error.code`, never
285
- * on `error.message`: the code is the contract, the wording is not.
286
- *
287
- * `nowUnixSecs` overrides the verification clock — omit it to use the
288
- * system clock, or pass a pinned value in tests. Matches
289
- * `verifyRevocationList`'s `nowUnixSecs` parameter.
422
+ * Input shape for `signRevocationList`. Field names map to spec
423
+ * `RevocationEntry` (jti, revoked_at, reason).
290
424
  */
291
- export declare function verifyManifestJson(manifestEnvelopeJson: string, nowUnixSecs?: number | undefined | null): void
292
- /** An AITP agent: a signing key and (once built) its Manifest. */
293
- export declare class AitpAgent {
294
- /**
295
- * Generate an agent with a fresh random signing key.
296
- *
297
- * `opts.suite` selects the algorithm — `"ed25519"` (default) or
298
- * `"p256"`. Symmetric with the Python SDK's
299
- * `AitpAgent.generate(suite="ed25519")`.
300
- *
301
- * ```ts
302
- * const ed = AitpAgent.generate(); // Ed25519
303
- * const p = AitpAgent.generate({ suite: 'p256' }); // P-256
304
- * ```
305
- */
306
- static generate(opts?: GenerateOpts | undefined | null): AitpAgent
307
- /**
308
- * Construct an agent from a 32-byte seed (deterministic).
309
- *
310
- * `opts.suite` matches `AitpAgent.generate`. For `"p256"`, a tiny
311
- * fraction of 32-byte seeds are not valid private scalars (zero
312
- * or ≥ curve order) and raise.
313
- *
314
- * Note: the prior `AitpAgent.fromP256Seed` factory and the
315
- * no-arg `AitpAgent.generate*` variants were removed in favor of
316
- * this parameterized API so the Node SDK matches the Python SDK
317
- * surface (CLAUDE.md mandates SDK symmetry).
318
- */
319
- static fromSeed(seed: Buffer, opts?: GenerateOpts | undefined | null): AitpAgent
320
- /** The agent's AID string (`aid:pubkey:...`). */
321
- get aid(): string
322
- /**
323
- * Build and sign the agent's Manifest. Returns `ManifestEnvelope`
324
- * JSON and caches the Manifest for `newSession` / `newResponder`.
325
- *
326
- * See `ManifestOpts.identityType` for the OIDC switch.
327
- */
328
- buildManifest(opts: ManifestOpts): string
329
- /**
330
- * Create a new outbound (initiator) handshake session.
331
- *
332
- * `jwks` is an optional `JwksProvider` used when the peer's
333
- * manifest advertises an OIDC identity. `opts.trustAnchors`
334
- * overrides the manifest's `accepted_trust_anchors`.
335
- */
336
- newSession(jwks?: JwksProvider | undefined | null, opts?: SessionOpts | undefined | null): JsInitiatorSession
337
- /**
338
- * Create a new inbound (responder) handshake session. Mirror of
339
- * `newSession`.
340
- */
341
- newResponder(jwks?: JwksProvider | undefined | null, opts?: SessionOpts | undefined | null): JsResponderSession
342
- /**
343
- * Verify a compact-JWS TCT token and require `requiredGrant`.
344
- * Rejects on an invalid, mis-audienced, expired, revoked, or
345
- * under-scoped TCT.
346
- *
347
- * `expectedAudience` defaults to `null`, which means "verify as the
348
- * holder" (RFC-AITP-0005 §9 receipt model — `this.aid` is used).
349
- * Resource servers verifying a TCT presented by a peer should pass
350
- * the TCT's own `aud` claim as `expectedAudience` (in v0.2 this
351
- * equals `sub`).
352
- *
353
- * `revokedJtis` (F-1) is an optional list of revoked TCT `jti`
354
- * strings; any TCT whose `jti` is in the list is rejected even if
355
- * otherwise valid. Omit (or pass `null`) to disable the revocation
356
- * gate. The caller is responsible for sourcing the revoked set (e.g.
357
- * from a `RevocationList` it fetched and verified).
358
- */
359
- verifyTct(tctToken: string, requiredGrant: string, expectedAudience?: string | undefined | null, revokedJtis?: Array<string> | undefined | null): JsTctIdentity
360
- /**
361
- * Like `verifyTct`, but consults a `TctStore` first: a byte-identical,
362
- * already-verified, still-valid TCT skips the signature check (the
363
- * verification hot path for an agent that sees the same TCT on many
364
- * requests). All cheap policy checks (expiry, audience, required grant,
365
- * and the optional `revokedJtis` gate) still run on every call; only the
366
- * signature check is elided.
367
- */
368
- verifyTctCached(tctToken: string, requiredGrant: string, store: JsTctStore, expectedAudience?: string | undefined | null, revokedJtis?: Array<string> | undefined | null): JsTctIdentity
369
- /**
370
- * Build a delegation compact-JWS token from a held **grant voucher**
371
- * (RFC-AITP-0006). `voucherToken` is the `grantVoucher` surfaced by
372
- * `complete()` / `processCommit()`. The delegatee's key binding is
373
- * derived from `delegateeAid` itself, so no separate public-key
374
- * argument is needed in v0.2.
375
- */
376
- buildDelegation(voucherToken: string, delegateeAid: string, scope: Array<string>, ttlSecs?: number | undefined | null): string
377
- /**
378
- * Mint a fresh compact-JWS TCT for a delegatee after the verifier has
379
- * confirmed the delegation. The subject-key binding is derived from
380
- * the verified delegation's `delegatee` AID.
381
- */
382
- issueTctForDelegatee(verified: JsDelegationVerified, ttlSecs?: number | undefined | null): string
383
- /**
384
- * Sign a `RevocationList` with this agent's key. `entries` carries
385
- * the revoked-TCT records; `expiresInSecs` defaults to 3600 s.
386
- * Returns the on-wire `RevocationListEnvelope` JSON.
387
- */
388
- signRevocationList(entries: Array<RevocationEntryInput>, expiresInSecs?: number | undefined | null): string
389
- /**
390
- * Holder side: build a `TctRenewalPayload` JSON for an in-band
391
- * renewal of `currentTctToken` — the holder's current TCT as a
392
- * compact-JWS string (RFC-AITP-0013).
393
- *
394
- * Behind the `renewal` Cargo feature, which is **on by default**; a
395
- * `--no-default-features` build omits it.
396
- */
397
- buildRenewalRequest(currentTctToken: string): string
425
+ export interface RevocationEntryInput {
426
+ /** JTI of the revoked TCT (UUID string). */
427
+ jti: string
398
428
  /**
399
- * Issuer side: verify a `TctRenewalPayload` JSON request and mint a
400
- * fresh TCT, returned as a compact-JWS token string.
401
- *
402
- * Behind the `renewal` Cargo feature (on by default).
429
+ * Unix seconds when the issuing peer revoked the TCT.
430
+ * Defaults to the current time when omitted.
403
431
  */
404
- processRenewalRequest(requestPayloadJson: string, manifestExpUnixSecs: number, newTtlSecs: number): string
432
+ revokedAt?: number
433
+ /** Optional human-readable reason. Not used in trust decisions. */
434
+ reason?: string
405
435
  }
406
- export type SessionBundleBuilderJs = SessionBundleBuilder
436
+
407
437
  /**
408
- * Fluent builder for issuing a `SessionBundleEnvelope`. Constructed
409
- * from the coordinator's `AitpAgent`.
438
+ * The exact bytes a revocation snapshot's signature is computed over:
439
+ * `JCS(revocation_list)` — the **inner** body, not the transport wrapper.
410
440
  *
411
- * The Rust struct is suffixed `Js` to avoid a name collision with the
412
- * `aitp_session_bundle::SessionBundleBuilder` imported above; the
413
- * `#[napi(js_name)]` attribute exposes it to JavaScript under the
414
- * plain name `SessionBundleBuilder` for parity with the Python SDK.
441
+ * Exposed so a caller needing the signed bytes (an independent verifier, an
442
+ * HSM signing path, a debugging tool) obtains them rather than reconstructing
443
+ * the shape at the call site. Reconstructing it is how signer, verifier and
444
+ * conformance fixture drifted apart before 0.5.0.
415
445
  */
416
- export declare class SessionBundleBuilder {
417
- /** Construct a builder backed by `coordinator`'s signing key. */
418
- constructor(coordinator: AitpAgent)
419
- /** Set the session ID (UUIDv4 string). Defaults to a fresh one. */
420
- sessionId(uuidStr: string): this
421
- /** Override `issued_at` (unix seconds). Defaults to "now" at build. */
422
- issuedAt(unixSecs: number): this
423
- /**
424
- * Add a participant entry. `tctToken` is the participant's TCT as an
425
- * opaque compact-JWS string (the `tct` field returned by `complete()`
426
- * / `processCommit()`), carried into the bundle verbatim.
427
- */
428
- participant(aid: string, tctToken: string): this
429
- /** Construct, sign, and return the `SessionBundleEnvelope` JSON. */
430
- build(): string
431
- }
446
+ export declare function revocationSigningBytes(envelopeJson: string): Buffer
447
+
432
448
  /**
433
- * In-memory OIDC JWKS provider — issuer URL → list of JWK objects.
449
+ * Trust-anchor override for `newSession` / `newResponder`.
434
450
  *
435
- * The Node caller fetches the JWKS (the SDK has no HTTP client) and
436
- * hands the parsed objects to this provider. Implements `JwksResolver`
437
- * internally so the handshake state machine can dispatch through it.
451
+ * JWKS provider is passed as a separate argument (napi-rs can't put a
452
+ * class reference inside an `#[napi(object)]` struct).
438
453
  */
439
- export declare class JwksProvider {
440
- /**
441
- * Construct from an object mapping issuer URLs to arrays of JWK
442
- * objects. Each JWK must be a standard RFC 7517 representation
443
- * (`kty`, `crv`, `x`, ...). Pass `{}` for an empty provider and
444
- * `upsert` later.
445
- */
446
- constructor(keys?: unknown | undefined | null)
454
+ export interface SessionOpts {
447
455
  /**
448
- * Add or replace the JWKs for an issuer. `keys` is a JS array of
449
- * JWK objects.
456
+ * Override the agent manifest's accepted_trust_anchors. `null`
457
+ * reuses the manifest's list.
450
458
  */
451
- upsert(issuer: string, keys: unknown): void
452
- /** Drop all keys for an issuer. */
453
- remove(issuer: string): void
454
- /** Return the issuer URLs currently registered. */
455
- issuers(): Array<string>
459
+ trustAnchors?: Array<string>
456
460
  }
461
+
457
462
  /**
458
- * Holds a list of 32-byte SPKI pins. `isPinned(certDer)` returns true
459
- * iff the cert's SPKI hash is in the list.
463
+ * Verify a delegation compact JWS under **strict AITP v0.2**
464
+ * (RFC-AITP-0006 single-hop). `verifierAid` is the verifier's own AID
465
+ * string — it MUST equal the delegation's `aud` (the root grantor), and
466
+ * the embedded voucher MUST verify under the verifier's own key.
467
+ *
468
+ * Any token carrying a non-empty `chain` (an RFC-AITP-0011 multi-hop
469
+ * delegation) is **rejected** with `DELEGATION_MULTIHOP_NOT_SUPPORTED`,
470
+ * matching the Rust core default. To allow multi-hop chains, call
471
+ * `verifyDelegationMultihop` instead.
472
+ *
473
+ * `revokedJtis` is an optional list of revoked `jti` strings — the
474
+ * verifier's own deny list. When non-empty, a token whose
475
+ * `voucher.src_jti` is in it is rejected after every signature check passes
476
+ * (RFC-AITP-0006 §4 step 7, ordered per RFC-AITP-0008 §3.3). **Verifiers
477
+ * SHOULD supply it.** Omitting it silently redeems a delegation whose
478
+ * source TCT has been revoked, which step 7 states as a MUST-reject.
460
479
  */
461
- export declare class SpkiPinVerifier {
462
- /**
463
- * Construct from an array of 32-byte Buffers. Throws if any pin is
464
- * not exactly 32 bytes.
465
- */
466
- constructor(pins: Array<Buffer>)
467
- /** Returns true iff the SPKI hash of `certDer` is in the pin list. */
468
- isPinned(certDer: Buffer): boolean
469
- /** Number of pins currently held. */
470
- get len(): number
471
- }
472
- /** Outbound handshake session — drives the initiator side. */
473
- export declare class JsInitiatorSession {
474
- /**
475
- * Step 1 — build the `MUTUAL_HELLO` envelope.
476
- *
477
- * `oidcMintJwt`: required for OIDC agents. Receives the handshake-
478
- * generated `pop_nonce` (string) and must return the JWT (string).
479
- */
480
- buildHello(peerManifestJson: string, requestedGrants: Array<string>, oidcMintJwt?: (...args: any[]) => any | undefined | null): string
481
- /** Step 2 — process `MUTUAL_HELLO_ACK`, produce `MUTUAL_COMMIT`. */
482
- processHelloAck(helloAckJson: string, sessionId: string): string
483
- /**
484
- * Step 3 — process `MUTUAL_COMMIT_ACK`. Returns the completed
485
- * handshake: the TCT the peer issued to us (opaque compact-JWS
486
- * token plus its decoded claims) and the optional grant voucher.
487
- */
488
- complete(commitAckJson: string): JsCompletedHandshake
489
- }
490
- /** Inbound handshake session — drives the responder side. */
491
- export declare class JsResponderSession {
492
- /**
493
- * Process an incoming `MUTUAL_HELLO` envelope.
494
- *
495
- * `oidcMintJwt`: required for OIDC agents (see `JsInitiatorSession.buildHello`).
496
- */
497
- processHello(helloJson: string, oidcMintJwt?: (...args: any[]) => any | undefined | null): JsHelloAckResult
498
- /** Process an incoming `MUTUAL_COMMIT` envelope. */
499
- processCommit(commitJson: string): JsCommitAckResult
500
- }
501
- export type JsTctStore = TctStore
480
+ export declare function verifyDelegation(token: string, verifierAid: string, revokedJtis?: Array<string> | undefined | null): JsDelegationVerified
481
+
502
482
  /**
503
- * A bounded, in-memory cache of **successful** TCT verifications, keyed by
504
- * the SHA-256 of the exact compact-JWS TCT token bytes.
483
+ * Verify a delegation compact JWS allowing **RFC-AITP-0011 multi-hop**
484
+ * chains up to `maxDelegationHops` total hops (`chain.length + 1`).
505
485
  *
506
- * Purpose: a high-throughput verifier (e.g. a writer agent checking a
507
- * capability on every request) that repeatedly sees the *same* TCT can skip
508
- * the Ed25519/P-256 signature verification after the first time.
486
+ * The strict single-hop `verifyDelegation` is the safe default; this
487
+ * function additionally allows multi-hop chains. Present by default (the
488
+ * `multihop-delegation` feature); a `--no-default-features` build omits it.
509
489
  *
510
- * **Safety.** The key is a cryptographic hash of the exact signed bytes, so
511
- * only a byte-identical token — whose signature was already verified once
512
- * — can hit. A tampered token hashes differently, misses, and is fully
513
- * verified. The cheap policy checks (expiry, audience, required grant) are
514
- * re-run on **every** hit; only the signature check is elided. Eviction is
515
- * FIFO once `maxEntries` is reached.
490
+ * `maxDelegationHops` defaults to `DEFAULT_MAX_DELEGATION_HOPS` (3, the RFC-AITP-0011 §2
491
+ * recommended ceiling). Pass a smaller value for a tighter bound;
492
+ * `maxDelegationHops = 0` reverts to strict single-hop (rejects any non-empty chain).
493
+ *
494
+ * `revokedJtis`, when non-empty, is consulted twice — both only after every
495
+ * signature check: once for the root `voucher.src_jti` (RFC-AITP-0006 §4
496
+ * step 7), and once for every hop's `jti`, meaning each chain entry and the
497
+ * outer token (RFC-AITP-0011 §6). Both are MUST-rejects, and a revoked hop
498
+ * invalidates every hop downstream of it — there is no partial-validity
499
+ * model.
500
+ *
501
+ * Note that §6 specifies each hop `jti` be checked against the deny list of
502
+ * *that hop's issuer*, which one flat list cannot express, so it is applied
503
+ * to every hop regardless of issuer. That can only reject more, never
504
+ * accept a revoked hop, but it does mean a list aggregated across several
505
+ * issuers lets any contributor revoke any hop.
516
506
  */
517
- export declare class TctStore {
518
- /**
519
- * Create a cache holding at most `maxEntries` verified TCTs (FIFO
520
- * eviction). `maxEntries` must be >= 1.
521
- */
522
- constructor(maxEntries: number)
523
- /** Number of cached verifications currently held. */
524
- len(): number
525
- /** Drop all cached entries. */
526
- clear(): void
527
- }
507
+ export declare function verifyDelegationMultihop(token: string, verifierAid: string, maxDelegationHops?: number | undefined | null, revokedJtis?: Array<string> | undefined | null): JsDelegationVerified
508
+
509
+ /**
510
+ * Verify a `ManifestEnvelope` JSON string. Used by the AITP Control Plane
511
+ * during agent enrollment, and by any consumer reading an AID or endpoint
512
+ * out of a peer's manifest.
513
+ *
514
+ * On failure throws an `Error` whose **`code`** property is one of
515
+ * `signature_invalid`, `pop_failed`, `aid_mismatch`, `expired`,
516
+ * `version_unknown`, `identity_hint_malformed`,
517
+ * `incompatible_identity_type`, `malformed`. Branch on `error.code`, never
518
+ * on `error.message`: the code is the contract, the wording is not.
519
+ *
520
+ * `nowUnixSecs` overrides the verification clock — omit it to use the
521
+ * system clock, or pass a pinned value in tests. Matches
522
+ * `verifyRevocationList`'s `nowUnixSecs` parameter.
523
+ */
524
+ export declare function verifyManifestJson(manifestEnvelopeJson: string, nowUnixSecs?: number | undefined | null): void
525
+
526
+ /**
527
+ * Verify a `RevocationListEnvelope` JSON string against a pinned issuer.
528
+ *
529
+ * Resolves on success; on failure throws an `Error` whose **`code`** property
530
+ * is one of `signature_invalid`, `issuer_mismatch`, `version_unknown`,
531
+ * `expired`, `malformed`. Branch on `error.code`, never on `error.message`:
532
+ * the code is the contract, the message wording is not.
533
+ *
534
+ * Establishes **authenticity and non-expiry only** — that the snapshot was
535
+ * signed by the holder of `expectedIssuerAid` and that its `expires_at` has
536
+ * not passed. It deliberately does not check `published_at` staleness:
537
+ * RFC-AITP-0008 §3 puts freshness policy at the consuming peer, and
538
+ * collapsing authenticity and freshness into a single switch is how a
539
+ * `soft_fail` mode ends up reporting a *forged* snapshot as not-revoked.
540
+ * The caller owns the staleness budget.
541
+ */
542
+ export declare function verifyRevocationList(envelopeJson: string, expectedIssuerAid: string, nowUnixSecs?: number | undefined | null): void
543
+
544
+ /**
545
+ * Verify a `SessionBundleEnvelope` JSON. `nowUnixSecs` defaults to
546
+ * the system clock. `revocationCheck` receives a JTI string and
547
+ * returns true if revoked.
548
+ */
549
+ export declare function verifySessionBundle(bundleEnvelopeJson: string, verifierAid: string, nowUnixSecs?: number | undefined | null, revocationCheck?: ((arg: string) => boolean) | undefined | null): JsBundleOutcome