@agentidentitytrustprotocol/aitp 0.5.0 → 0.7.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 +58 -5
  2. package/index.js +3 -1
  3. package/package.json +5 -5
package/index.d.ts CHANGED
@@ -125,8 +125,15 @@ export interface JsDelegationVerified {
125
125
  * delegation) is **rejected** with `DELEGATION_MULTIHOP_NOT_SUPPORTED`,
126
126
  * matching the Rust core default. To allow multi-hop chains, call
127
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.
128
135
  */
129
- export declare function verifyDelegation(token: string, verifierAid: string): JsDelegationVerified
136
+ export declare function verifyDelegation(token: string, verifierAid: string, revokedJtis?: Array<string> | undefined | null): JsDelegationVerified
130
137
  /**
131
138
  * Verify a delegation compact JWS allowing **RFC-AITP-0011 multi-hop**
132
139
  * chains up to `maxDelegationHops` total hops (`chain.length + 1`).
@@ -138,8 +145,21 @@ export declare function verifyDelegation(token: string, verifierAid: string): Js
138
145
  * `maxDelegationHops` defaults to `DEFAULT_MAX_DELEGATION_HOPS` (3, the RFC-AITP-0011 §2
139
146
  * recommended ceiling). Pass a smaller value for a tighter bound;
140
147
  * `maxDelegationHops = 0` reverts to strict single-hop (rejects any non-empty chain).
148
+ *
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.
155
+ *
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.
141
161
  */
142
- export declare function verifyDelegationMultihop(token: string, verifierAid: string, maxDelegationHops?: number | undefined | null): JsDelegationVerified
162
+ export declare function verifyDelegationMultihop(token: string, verifierAid: string, maxDelegationHops?: number | undefined | null, revokedJtis?: Array<string> | undefined | null): JsDelegationVerified
143
163
  /**
144
164
  * Compute the RFC 7638 JWK thumbprint of the public key embedded in
145
165
  * an AID — the value an OIDC IdP MUST place in the JWT's `cnf.jkt`
@@ -157,6 +177,33 @@ export declare function computeAidJkt(aid: string): string
157
177
  * a 32-byte Buffer. Throws if `certDer` is not a parseable certificate.
158
178
  */
159
179
  export declare function computeSpkiHash(certDer: Buffer): Buffer
180
+ /**
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.
187
+ *
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.
195
+ */
196
+ export declare function verifyRevocationList(envelopeJson: string, expectedIssuerAid: string, nowUnixSecs?: number | undefined | null): void
197
+ /**
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.
205
+ */
206
+ export declare function revocationSigningBytes(envelopeJson: string): Buffer
160
207
  /** Result of `processHello`: response body plus session id. */
161
208
  export interface JsHelloAckResult {
162
209
  /** `MUTUAL_HELLO_ACK` envelope JSON — set as the HTTP response body. */
@@ -227,9 +274,15 @@ export interface JsTctIdentity {
227
274
  jti: string
228
275
  }
229
276
  /**
230
- * Verify a `ManifestEnvelope` JSON string. Throws on signature,
231
- * proof-of-possession, expiry, or identity-hint shape failures.
232
- * Used by the AITP Control Plane during agent enrollment.
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.
233
286
  */
234
287
  export declare function verifyManifestJson(manifestEnvelopeJson: string): void
235
288
  /** An AITP agent: a signing key and (once built) its Manifest. */
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { AitpAgent, SessionBundleBuilder, verifySessionBundle, verifyDelegation, verifyDelegationMultihop, computeAidJkt, JwksProvider, computeSpkiHash, SpkiPinVerifier, JsInitiatorSession, JsResponderSession, TctStore, verifyManifestJson } = nativeBinding
313
+ const { AitpAgent, SessionBundleBuilder, verifySessionBundle, verifyDelegation, verifyDelegationMultihop, computeAidJkt, JwksProvider, computeSpkiHash, SpkiPinVerifier, verifyRevocationList, revocationSigningBytes, JsInitiatorSession, JsResponderSession, TctStore, verifyManifestJson } = nativeBinding
314
314
 
315
315
  module.exports.AitpAgent = AitpAgent
316
316
  module.exports.SessionBundleBuilder = SessionBundleBuilder
@@ -321,6 +321,8 @@ module.exports.computeAidJkt = computeAidJkt
321
321
  module.exports.JwksProvider = JwksProvider
322
322
  module.exports.computeSpkiHash = computeSpkiHash
323
323
  module.exports.SpkiPinVerifier = SpkiPinVerifier
324
+ module.exports.verifyRevocationList = verifyRevocationList
325
+ module.exports.revocationSigningBytes = revocationSigningBytes
324
326
  module.exports.JsInitiatorSession = JsInitiatorSession
325
327
  module.exports.JsResponderSession = JsResponderSession
326
328
  module.exports.TctStore = TctStore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentidentitytrustprotocol/aitp",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Agent Identity Trust Protocol — Node.js SDK",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": {
@@ -53,9 +53,9 @@
53
53
  "registry": "https://registry.npmjs.org/"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@agentidentitytrustprotocol/aitp-darwin-x64": "0.5.0",
57
- "@agentidentitytrustprotocol/aitp-darwin-arm64": "0.5.0",
58
- "@agentidentitytrustprotocol/aitp-linux-x64-gnu": "0.5.0",
59
- "@agentidentitytrustprotocol/aitp-linux-arm64-gnu": "0.5.0"
56
+ "@agentidentitytrustprotocol/aitp-darwin-x64": "0.7.0",
57
+ "@agentidentitytrustprotocol/aitp-darwin-arm64": "0.7.0",
58
+ "@agentidentitytrustprotocol/aitp-linux-x64-gnu": "0.7.0",
59
+ "@agentidentitytrustprotocol/aitp-linux-arm64-gnu": "0.7.0"
60
60
  }
61
61
  }