@agentcreds/sdk 0.1.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 (5) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +159 -0
  3. package/index.d.ts +1271 -0
  4. package/index.js +370 -0
  5. package/package.json +45 -0
package/index.d.ts ADDED
@@ -0,0 +1,1271 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ /**
7
+ * Constructor options for [`IdentityConfig`]. All fields are optional and
8
+ * fall back to their config defaults (`did_method = "key"`, `key_algorithm =
9
+ * "ed25519"`) when omitted.
10
+ */
11
+ export interface IdentityConfigInit {
12
+ didMethod?: string
13
+ keyAlgorithm?: string
14
+ webHost?: string
15
+ webPath?: string
16
+ cheqdNetwork?: string
17
+ indyNamespace?: string
18
+ }
19
+ /**
20
+ * Constructor options for [`DelegationConfig`]. All fields are optional and
21
+ * fall back to their config defaults (`maxDepth = 3`, `defaultTtlSecs =
22
+ * 3600`, `maxTtlSecs = 86400`) when omitted.
23
+ */
24
+ export interface DelegationConfigInit {
25
+ maxDepth?: number
26
+ defaultTtlSecs?: number
27
+ maxTtlSecs?: number
28
+ }
29
+ /**
30
+ * The human principal, attested by an IdP, on whose behalf an agent acts - the
31
+ * enforced on-behalf-of dimension of a credential. A plain data object:
32
+ * `scopeConsented`/`resourceAuthority` default to empty and `authorizedAt`
33
+ * defaults to now when omitted.
34
+ */
35
+ export interface HumanAuthorization {
36
+ principalDid: string
37
+ /**
38
+ * `"human"` or `"workload"` - which root attested this principal. Defaults to
39
+ * `"human"`.
40
+ */
41
+ kind?: string
42
+ /**
43
+ * Where `scopeConsented` and `resourceAuthority` came from - `"attested"`,
44
+ * `"policy"` or `"asserted"`. Defaults to `"asserted"`, the weakest reading,
45
+ * because a caller that does not say has not established anything.
46
+ */
47
+ entitlementSource?: string
48
+ issuer: string
49
+ subject: string
50
+ expiresAt: Date
51
+ scopeConsented?: Array<string>
52
+ resourceAuthority?: Array<string>
53
+ authorizedAt?: Date
54
+ }
55
+ /** Constructor options for [`CapabilityClaims`]. */
56
+ export interface CapabilityClaimsInit {
57
+ tools: Array<string>
58
+ /**
59
+ * Resource-namespace patterns the agent may reach - a capability-axis
60
+ * ceiling enforced at mint, needing no principal to carry it.
61
+ */
62
+ resources?: Array<string>
63
+ maxDelegationDepth: number
64
+ validForSecs: number
65
+ budgetUsd?: number
66
+ autonomyLevel?: number
67
+ modelVersion?: string
68
+ artifactHash?: string
69
+ authorizedBy?: string
70
+ /** Who answers for what this agent does. Never selectively disclosable. */
71
+ accountableParty?: string
72
+ /** Which revision of the ownership record named that party. */
73
+ partyVersion?: number
74
+ /** Salted commitment to that ownership record - the members never travel. */
75
+ partyCommitment?: string
76
+ }
77
+ /**
78
+ * Constructor options for [`Scope`]. `budgetUsd` (USD-cents) and `maxDepth`
79
+ * default to unlimited / 0 (no further delegation) when omitted.
80
+ */
81
+ export interface ScopeInit {
82
+ tools: Array<string>
83
+ budgetUsd?: number
84
+ maxDepth?: number
85
+ }
86
+ /**
87
+ * Issue a capability credential to `agentDid`, bound to a verified human
88
+ * principal. The credential's validity is capped at the human's authorization
89
+ * expiry; `tools` are the granted (and recorded-as-consented) capabilities and
90
+ * `resourceAuthority` bounds which resources the agent may be scoped to.
91
+ */
92
+ export declare function issueOnBehalfOf(anchor: TrustAnchor, agentDid: string, principal: VerifiedHumanPrincipal, tools: Array<string>, resourceAuthority: Array<string>, maxDelegationDepth: number, validForSecs: number, resourceSource?: string | undefined | null): CapabilityCredential
93
+ /** Default OAuth Status List size (131,072 entries / 16KB bitstring). */
94
+ export declare function defaultListSize(): number
95
+ /**
96
+ * Issue a capability credential to `agentDid`, gated on a validated SVID (its
97
+ * SPIFFE ID is recorded as the credential's `authorizedBy` provenance).
98
+ */
99
+ export declare function issueFromSvid(anchor: TrustAnchor, agentDid: string, svid: ValidatedSvid, tools: Array<string>, maxDelegationDepth: number, validForSecs: number): CapabilityCredential
100
+ export declare function version(): string
101
+ /**
102
+ * One Authorization Decision Record - who was allowed to do what, the outcome,
103
+ * and any security signals. Serializable for export to a SIEM (`toJson`).
104
+ */
105
+ export declare class AuthzDecision {
106
+ /**
107
+ * Build a record from a delegation token and an outcome. `allow=false`
108
+ * marks a denial; pass the `signal` (e.g. `"action_denied"`) and `reason`.
109
+ * `kind` is one of mint/attenuate/verify/verifyRooted/presentation/revocation.
110
+ */
111
+ static fromToken(kind: string, token: DelegationToken, action?: string | undefined | null, allow?: boolean | undefined | null, signal?: string | undefined | null, reason?: string | undefined | null): AuthzDecision
112
+ /** A bare allow for a subject (e.g. a non-token check). */
113
+ static allow(kind: string, subjectDid: string): AuthzDecision
114
+ /** A bare deny for a subject, with a signal and reason. */
115
+ static deny(kind: string, subjectDid: string, signal: string, reason: string): AuthzDecision
116
+ get id(): string
117
+ get seq(): number
118
+ get timestamp(): string
119
+ get kind(): string
120
+ get decision(): string
121
+ get allowed(): boolean
122
+ get subjectDid(): string
123
+ get rootAgentDid(): string
124
+ get issuerDid(): string
125
+ get vcId(): string
126
+ get action(): string | null
127
+ /**
128
+ * The principal whose authority was exercised, if any. `None` is the autonomous
129
+ * case, not a missing value.
130
+ */
131
+ get principalDid(): string | null
132
+ /**
133
+ * Who answers for this decision - the responsible party *within* the issuing
134
+ * organization. `None` means the credential predates accountability being
135
+ * recorded; the organization named by `issuerDid` is accountable regardless.
136
+ */
137
+ get accountableParty(): string | null
138
+ /**
139
+ * How firmly the accountable party is known. Absent means the credential predates
140
+ * provenance being recorded, and must be read as the weakest source.
141
+ */
142
+ get accountabilitySource(): string | null
143
+ /**
144
+ * Record who answers for this decision, and on what basis.
145
+ *
146
+ * Not derivable from the token: the accountable party is a claim on the
147
+ * **credential**, so a verifier holds it during verification and passes it in.
148
+ * Without this the record answers "who is answerable" only via a join back to
149
+ * the credential - the join the field exists to remove.
150
+ *
151
+ * `partyVersion` and `partyCommitment` come from the same credential and turn
152
+ * the party from a name into a resolvable claim: which revision of the ownership
153
+ * record to read, and proof the record produced is the one committed to. Neither
154
+ * is personal data.
155
+ */
156
+ withAccountability(party?: string | undefined | null, source?: string | undefined | null, partyVersion?: number | undefined | null, partyCommitment?: string | undefined | null): AuthzDecision
157
+ /**
158
+ * Record the R10 evaluation and admission outcomes separately.
159
+ *
160
+ * `evaluation = "allow"` with `admission = "deny"` is a replay: valid,
161
+ * policy-satisfying evidence refused because its reliance unit was already
162
+ * consumed. A single verdict field reports that identically to evidence that
163
+ * never verified - and the two call for opposite responses.
164
+ *
165
+ * Both absent when no execution-time gate applied, which is the ordinary case.
166
+ */
167
+ withVerdicts(evaluation?: string | undefined | null, admission?: string | undefined | null): AuthzDecision
168
+ /**
169
+ * Which revision of the ownership record named the accountable party - i.e.
170
+ * which org chart to resolve it against.
171
+ */
172
+ get partyVersion(): number | null
173
+ /**
174
+ * Salted commitment to that ownership record, so the resolution can be proved
175
+ * rather than asserted.
176
+ */
177
+ get partyCommitment(): string | null
178
+ /**
179
+ * Did the execution-time evidence verify and satisfy policy? `"allow"`,
180
+ * `"deny"`, or absent when no gate applied.
181
+ */
182
+ get evaluation(): string | null
183
+ /** Was the reliance unit admitted? `"allow"`, `"deny"`, or absent. */
184
+ get admission(): string | null
185
+ get depth(): number
186
+ get maxDepth(): number
187
+ get signals(): Array<string>
188
+ get reason(): string | null
189
+ /** The record as a JSON string (for a SIEM/log sink). */
190
+ toJson(): string
191
+ /** The canonical SHA-256 digest of this record, hex-encoded. */
192
+ digestHex(): string
193
+ }
194
+ /**
195
+ * A recorder that stamps each decision with a sequence number, advances a
196
+ * tamper-evident hash-chain, and returns the stamped record to forward.
197
+ */
198
+ export declare class AdrStream {
199
+ constructor()
200
+ /**
201
+ * Record a decision; returns the stamped record (with its `seq` assigned).
202
+ * Forward the returned record to your SIEM.
203
+ */
204
+ record(decision: AuthzDecision): AuthzDecision
205
+ /** The current hash-chain head (hex). */
206
+ head(): string
207
+ /** The number of decisions recorded so far. */
208
+ count(): number
209
+ /** Sign the current `(count, head)` with `anchor` for tamper-evidence. */
210
+ signCheckpoint(anchor: TrustAnchor): AdrCheckpoint
211
+ /**
212
+ * Recompute the hash-chain head from a JSON array of recorded decisions
213
+ * (e.g. `JSON.stringify(records.map(r => JSON.parse(r.toJson())))`), to
214
+ * check a received stream against a signed checkpoint.
215
+ */
216
+ static replayJson(decisionsJson: string): string
217
+ }
218
+ /**
219
+ * An anchor-signed attestation that the decision log reached `count` records
220
+ * with hash-chain `head`.
221
+ */
222
+ export declare class AdrCheckpoint {
223
+ get count(): number
224
+ get head(): string
225
+ get issuerDid(): string
226
+ get signature(): string
227
+ /** Verify the checkpoint signature against `anchor`. */
228
+ verify(anchor: TrustAnchor): void
229
+ /** The checkpoint as a JSON string. */
230
+ toJson(): string
231
+ /** Parse a checkpoint from its JSON string. */
232
+ static fromJson(s: string): AdrCheckpoint
233
+ }
234
+ /**
235
+ * One enrolled human approver: a `did:key` signing identity, roles, and an optional
236
+ * expiry (`notAfterUnix`, unix seconds).
237
+ */
238
+ export declare class ApproverEntry {
239
+ constructor(approverId: string, approverDid: string, roles?: Array<string> | undefined | null, notAfterUnix?: number | undefined | null)
240
+ get approverId(): string
241
+ get approverDid(): string
242
+ get roles(): Array<string>
243
+ /** Per-approver expiry as unix seconds, or null if the entry does not expire. */
244
+ get notAfterUnix(): number | null
245
+ }
246
+ /**
247
+ * A versioned, **anchor-signed** directory of human approver keys.
248
+ *
249
+ * Verified under the same org anchor that roots delegation - there is no second trust
250
+ * root - and carries a signed `notAfter` so a relying party can bound its staleness.
251
+ */
252
+ export declare class ApproverDirectory {
253
+ /**
254
+ * Seal (sign) a directory with the org `anchor`. `notAfterUnix` sets an optional
255
+ * staleness bound.
256
+ */
257
+ static seal(entries: Array<ApproverEntry>, version: number, anchor: TrustAnchor, notAfterUnix?: number | undefined | null): ApproverDirectory
258
+ get version(): number
259
+ /**
260
+ * DID of the anchor that sealed this directory.
261
+ *
262
+ * Under rotation this is the org's CURRENT key, which differs from the root a
263
+ * relying party pinned - so a verifier needs it to resolve the right key through
264
+ * the organization's key history.
265
+ */
266
+ get issuerDid(): string
267
+ /** The enrolled approvers, in the sealed order (sorted by `approverId`). */
268
+ get entries(): Array<ApproverEntry>
269
+ /** The sealed expiry as unix seconds, or null if unbounded. */
270
+ get notAfterUnix(): number | null
271
+ /**
272
+ * Verify the signature against `anchor` **and** the expiry at `nowUnix`.
273
+ *
274
+ * Both together: an authentic-but-lapsed directory must be refused, not assumed
275
+ * current, or the staleness bound is decorative.
276
+ */
277
+ verifyCurrent(anchor: TrustAnchor, nowUnix: number): void
278
+ toJson(): string
279
+ static fromJson(s: string): ApproverDirectory
280
+ }
281
+ /** Execution-time human authorization evidence (R10). */
282
+ export declare class ApprovalEvidence {
283
+ /** Mint **anchor-signed** evidence: the organization approved. */
284
+ static approve(action: Action, approver: string, approvalId: string, expiresAt: number, anchor: TrustAnchor): ApprovalEvidence
285
+ /**
286
+ * Mint **approver-key-signed** evidence: this individual approved. Verified against
287
+ * an [`ApproverDirectory`] rather than the org anchor.
288
+ */
289
+ static approveByKey(action: Action, approverId: string, approver: AgentIdentity, approvalId: string, expiresAt: number): ApprovalEvidence
290
+ get approvalId(): string
291
+ get approver(): string
292
+ get expiresAt(): number
293
+ /** Verify anchor-signed evidence for `action` at `nowUnix`. */
294
+ verify(action: Action, anchor: TrustAnchor, nowUnix: number): void
295
+ /**
296
+ * Verify **approver-key-signed** evidence against an anchor-signed `directory`,
297
+ * optionally requiring a role.
298
+ */
299
+ verifyWithDirectory(action: Action, directory: ApproverDirectory, anchor: TrustAnchor, nowUnix: number, requiredRole?: string | undefined | null): void
300
+ toJson(): string
301
+ static fromJson(s: string): ApprovalEvidence
302
+ }
303
+ /**
304
+ * An org's private, append-only audit log for one correlation id. Only the
305
+ * signed commitments (from `export`) are ever shared.
306
+ */
307
+ export declare class AuditLog {
308
+ constructor(correlationId: string, orgId: string)
309
+ /** Append an action; returns its per-org sequence number. */
310
+ record(agentDid: string, action: string, outcome: string): number
311
+ /**
312
+ * Export signed commitments to share, as a JSON array string. Raw records
313
+ * stay in this log.
314
+ */
315
+ export(anchor: TrustAnchor): string
316
+ /** Selectively reveal one raw record as a JSON string (or null). */
317
+ reveal(seq: number): string | null
318
+ get len(): number
319
+ get isEmpty(): boolean
320
+ }
321
+ /**
322
+ * Merges multiple orgs' commitments into one verifiable, ordered
323
+ * chain-of-custody - without seeing raw logs.
324
+ */
325
+ export declare class AuditCompositor {
326
+ constructor(correlationId: string)
327
+ /**
328
+ * Ingest one org's exported commitments (the JSON from `AuditLog.export`),
329
+ * verifying every signature against `orgAnchor`.
330
+ */
331
+ ingest(commitmentsJson: string, orgAnchor: TrustAnchor): void
332
+ /** The merged chain-of-custody as a JSON array string. */
333
+ chainOfCustody(): string
334
+ /** A single tamper-evident digest over the whole ordered chain. */
335
+ rootHash(): string
336
+ /**
337
+ * Verify a selectively-revealed record (the JSON from `AuditLog.reveal`)
338
+ * against the composited commitment.
339
+ */
340
+ verifyRevealed(recordJson: string): boolean
341
+ get len(): number
342
+ get isEmpty(): boolean
343
+ }
344
+ /** The summary returned by a successful `EvidenceBundle.verify`. */
345
+ export declare class EvidenceReport {
346
+ get correlationId(): string
347
+ get decisions(): number
348
+ get allowed(): number
349
+ get denied(): number
350
+ get signals(): Array<string>
351
+ get checkpointVerified(): boolean
352
+ get custodyEntries(): number
353
+ }
354
+ /**
355
+ * A signed, self-verifying compliance export of the authorization decisions
356
+ * (and optional chain-of-custody) for a delegation flow.
357
+ */
358
+ export declare class EvidenceBundle {
359
+ /**
360
+ * Seal and sign a bundle with `anchor` for the flow `correlationId` (the
361
+ * root `vcId`). `decisionsJson` is a JSON array of decision records (e.g.
362
+ * `JSON.stringify(records.map(r => JSON.parse(r.toJson())))`); optionally
363
+ * include the `subjectDid`, a stream `checkpoint`, and the chain-of-custody
364
+ * from an `AuditCompositor`.
365
+ */
366
+ static seal(anchor: TrustAnchor, correlationId: string, decisionsJson: string, subjectDid?: string | undefined | null, checkpoint?: AdrCheckpoint | undefined | null, compositor?: AuditCompositor | undefined | null): EvidenceBundle
367
+ /** Verify the bundle against `anchor` and return an `EvidenceReport`. */
368
+ verify(anchor: TrustAnchor): EvidenceReport
369
+ get bundleId(): string
370
+ get generatedAt(): string
371
+ get issuerDid(): string
372
+ get correlationId(): string
373
+ get subjectDid(): string | null
374
+ get decisionsHead(): string
375
+ get custodyRoot(): string | null
376
+ get signature(): string
377
+ /** The decision records included in the bundle. */
378
+ decisions(): Array<AuthzDecision>
379
+ /** The bundle as a JSON string (the export artifact). */
380
+ toJson(): string
381
+ /** Parse a bundle from its JSON string. */
382
+ static fromJson(s: string): EvidenceBundle
383
+ }
384
+ /** Identity and cryptographic key configuration. */
385
+ export declare class IdentityConfig {
386
+ constructor(init?: IdentityConfigInit | undefined | null)
387
+ /** Which DID method to use for new identities (`"key"`, `"web"`, `"cheqd"`, or `"indy"`). */
388
+ get didMethod(): string
389
+ /** Preferred key algorithm for new key pairs (`"ed25519"` or `"p256"`). */
390
+ get keyAlgorithm(): string
391
+ /** DNS host - required when `didMethod = "web"`. */
392
+ get webHost(): string | null
393
+ /** Optional URL path suffix - used when `didMethod = "web"`. */
394
+ get webPath(): string | null
395
+ /** Cheqd network (`"mainnet"` or `"testnet"`) - required when `didMethod = "cheqd"`. */
396
+ get cheqdNetwork(): string | null
397
+ /** Indy ledger namespace - required when `didMethod = "indy"`. */
398
+ get indyNamespace(): string | null
399
+ toString(): string
400
+ }
401
+ /** Delegation chain limits and token lifetime settings. */
402
+ export declare class DelegationConfig {
403
+ constructor(init?: DelegationConfigInit | undefined | null)
404
+ /** Maximum allowed delegation depth. */
405
+ get maxDepth(): number
406
+ /** Default token TTL in seconds when the caller does not specify one. */
407
+ get defaultTtlSecs(): number
408
+ /** Hard ceiling on token TTL - any caller-supplied value is clamped to this. */
409
+ get maxTtlSecs(): number
410
+ /** Clamp a caller-supplied TTL to `maxTtlSecs`. */
411
+ clampTtl(requestedSecs: number): number
412
+ toString(): string
413
+ }
414
+ /** Cross-organizational trust verification settings. */
415
+ export declare class TrustConfig {
416
+ /** `minimumTrustLevel` defaults to `"self_asserted"` when omitted. */
417
+ constructor(minimumTrustLevel?: string | undefined | null)
418
+ /** VCs from issuers below this level are rejected by `TrustRegistry`. */
419
+ get minimumTrustLevel(): string
420
+ toString(): string
421
+ }
422
+ /**
423
+ * Complete SDK configuration. Construct with defaults, or load from a TOML
424
+ * file / string / environment variables.
425
+ */
426
+ export declare class AgentCredsConfig {
427
+ /**
428
+ * Construct a configuration with all defaults (`did:key` / Ed25519,
429
+ * max delegation depth 3, 1h default / 24h max token TTL, minimum
430
+ * trust level `"self_asserted"`).
431
+ */
432
+ constructor()
433
+ /**
434
+ * Load configuration from a TOML file. Missing sections or keys fall
435
+ * back to their default values.
436
+ */
437
+ static fromToml(path: string): AgentCredsConfig
438
+ /** Parse configuration from a TOML string. */
439
+ static fromTomlStr(toml: string): AgentCredsConfig
440
+ /**
441
+ * Build configuration from environment variables (`AF_*`), falling back
442
+ * to defaults for any variable that is not set or unrecognised.
443
+ */
444
+ static fromEnv(): AgentCredsConfig
445
+ get identity(): IdentityConfig
446
+ get delegation(): DelegationConfig
447
+ get trust(): TrustConfig
448
+ /** Validate that all required fields for the chosen DID method are present. */
449
+ validate(): void
450
+ toString(): string
451
+ }
452
+ export declare class CapabilityClaims {
453
+ constructor(init: CapabilityClaimsInit)
454
+ get tools(): Array<string>
455
+ get resources(): Array<string> | null
456
+ get partyVersion(): number | null
457
+ get partyCommitment(): string | null
458
+ get budgetUsd(): number | null
459
+ get maxDelegationDepth(): number
460
+ get validForSecs(): number
461
+ get autonomyLevel(): number
462
+ get modelVersion(): string | null
463
+ get artifactHash(): string | null
464
+ get authorizedBy(): string | null
465
+ /**
466
+ * Who answers for what this agent does.
467
+ *
468
+ * Unlike `authorizedBy`, this is never selectively disclosable - a verifier is
469
+ * always shown it, because "who is responsible" is not a claim the holder gets to
470
+ * withhold.
471
+ */
472
+ get accountableParty(): string | null
473
+ /**
474
+ * How the accountable party was established. Travels with the party because in an
475
+ * audit they are one question.
476
+ */
477
+ get accountabilitySource(): string
478
+ /**
479
+ * The human principal this credential authorizes the agent to act for, if
480
+ * it is an on-behalf-of credential.
481
+ */
482
+ get onBehalfOf(): HumanAuthorization | null
483
+ /** Bind a principal (on-behalf-of) to these claims. */
484
+ setOnBehalfOf(auth: HumanAuthorization): void
485
+ /** Validate that claims are internally consistent (throws on failure). */
486
+ validate(): void
487
+ toString(): string
488
+ }
489
+ export declare class CredentialStatus {
490
+ /**
491
+ * Construct an OAuth Status List entry reference for `index` within the list
492
+ * published at `registryUrl`.
493
+ */
494
+ constructor(registryUrl: string, index: number)
495
+ get id(): string
496
+ get type(): string
497
+ get statusPurpose(): string
498
+ get statusListIndex(): number
499
+ get statusListCredential(): string
500
+ toString(): string
501
+ }
502
+ export declare class LinkedDataProof {
503
+ get type(): string
504
+ get created(): Date
505
+ get verificationMethod(): string
506
+ get proofPurpose(): string
507
+ get proofValue(): string
508
+ get payloadHash(): string
509
+ toString(): string
510
+ }
511
+ export declare class CapabilityCredential {
512
+ /** Issue a new capability credential signed by `anchor`. */
513
+ static issue(anchor: TrustAnchor, subjectDid: string, claims: CapabilityClaims, revocation?: CredentialStatus | undefined | null): CapabilityCredential
514
+ /** Deserialise a credential from its JSON-LD representation. */
515
+ static fromJson(json: string): CapabilityCredential
516
+ /** Serialize this credential to canonical JSON-LD. */
517
+ toJson(): string
518
+ get id(): string
519
+ get context(): Array<string>
520
+ get type(): Array<string>
521
+ get issuer(): string
522
+ get issuanceDate(): Date
523
+ get proof(): LinkedDataProof
524
+ get credentialStatus(): CredentialStatus | null
525
+ subjectDid(): string
526
+ claims(): CapabilityClaims
527
+ expirationDate(): Date
528
+ isValid(): boolean
529
+ /**
530
+ * Verify this credential's cryptographic proof against `anchor`.
531
+ * `strictIssuer` defaults to `true`.
532
+ */
533
+ verify(anchor: TrustAnchor, strictIssuer?: boolean | undefined | null): void
534
+ toString(): string
535
+ }
536
+ /**
537
+ * One revision of "who is behind this accountable party".
538
+ *
539
+ * Held by the organization and **never** placed in a credential - only `version`
540
+ * and `commitment` travel. The members are personal data, and a credential is
541
+ * signed, immutable, presented across organizational boundaries, and outlives the
542
+ * employment, so it can neither correct nor erase them.
543
+ *
544
+ * The commitment is salted, so it is not a membership oracle over a guessable
545
+ * list. Erasure degrades in the right direction: delete someone from the store and
546
+ * the commitment stops matching anything you can produce - you lose the ability to
547
+ * prove *who was in the team*, and keep the ability to prove *which team*.
548
+ */
549
+ export declare class OwnershipRecord {
550
+ /**
551
+ * Build a record. `members` is sorted and de-duplicated, so the store's return
552
+ * order cannot change the commitment. `salt` must be at least 16 characters - a
553
+ * short salt makes the commitment brute-forceable from a candidate membership
554
+ * list, which is the exact data it exists to protect.
555
+ */
556
+ constructor(partyId: string, version: number, members: Array<string>, salt: string)
557
+ get partyId(): string
558
+ /**
559
+ * Which revision this is. Goes on the credential; an auditor uses it to ask the
560
+ * store for the record as it stood at issuance rather than as it stands now.
561
+ */
562
+ get version(): number
563
+ /** The members, sorted. Personal data - keep it here. */
564
+ get members(): Array<string>
565
+ /** The salted commitment, hex. The only part that travels. */
566
+ get commitment(): string
567
+ /**
568
+ * Whether this record is the one `commitment` was made over - the audit-time
569
+ * check. A record that does not match was not the one committed to.
570
+ */
571
+ matches(commitment: string): boolean
572
+ }
573
+ export declare class Scope {
574
+ constructor(init: ScopeInit)
575
+ get tools(): Array<string>
576
+ get budgetUsd(): number | null
577
+ get maxDepth(): number
578
+ get resources(): Array<string>
579
+ /**
580
+ * Return a copy of this scope with an exact-match resource allow-list (the
581
+ * resources the agent may touch). Narrows like tools across hops.
582
+ */
583
+ withResources(resources: Array<string>): Scope
584
+ /**
585
+ * True if `self` is permitted under `parent` (tools subset, budget and
586
+ * depth not wider).
587
+ */
588
+ isSubsetOf(parent: Scope): boolean
589
+ /** The first tool in `self` that `parent` does not permit, if any. */
590
+ firstWideningCapability(parent: Scope): string | null
591
+ toString(): string
592
+ }
593
+ export declare class Action {
594
+ /** Create an action with the current timestamp. */
595
+ constructor(tool: string, parameters: string)
596
+ get tool(): string
597
+ get parameters(): string
598
+ get timestamp(): Date
599
+ get resource(): string | null
600
+ get actingFor(): string | null
601
+ /** Return a copy of this action tagged with the resource it touches. */
602
+ withResource(resource: string): Action
603
+ /**
604
+ * Return a copy of this action made on behalf of the given principal DID
605
+ * (required when the token is bound to a principal).
606
+ */
607
+ withActingFor(principalDid: string): Action
608
+ /**
609
+ * A stable content binding of this action (tool, parameters, resource) -
610
+ * pass to `PopChallenge.withRequestBinding` to bind a presentation to
611
+ * exactly this request.
612
+ */
613
+ requestBinding(): string
614
+ toString(): string
615
+ }
616
+ export declare class ChainEntry {
617
+ get depth(): number
618
+ get agentDid(): string
619
+ get tools(): Array<string>
620
+ get resources(): Array<string>
621
+ get budgetUsd(): number | null
622
+ get issuedAt(): Date
623
+ get expiresAt(): Date
624
+ toString(): string
625
+ }
626
+ export declare class DelegationChain {
627
+ get vcId(): string
628
+ get issuerDid(): string
629
+ /** The human principal the chain is bound to (on-behalf-of), if any. */
630
+ get principalDid(): string | null
631
+ get entries(): Array<ChainEntry>
632
+ toString(): string
633
+ }
634
+ export declare class DelegationToken {
635
+ /**
636
+ * Mint a new delegation token from a capability credential. `scope` must
637
+ * be a subset of `vc`'s claims; `ttlSecs` is capped at the VC's expiry.
638
+ */
639
+ static mint(vc: CapabilityCredential, scope: Scope, ttlSecs: number, agent: AgentIdentity): DelegationToken
640
+ /**
641
+ * Attenuate this token for a sub-agent. `narrow` must be a subset of the
642
+ * current leaf block's scope; widening throws `ScopeWideningError`.
643
+ */
644
+ attenuate(narrow: Scope, ttlSecs: number, agent: AgentIdentity): DelegationToken
645
+ /**
646
+ * Verify the chain's integrity and authenticity (every block signature,
647
+ * expiry, hash linkage, monotonic scope narrowing) and that `action` is
648
+ * permitted by the leaf block.
649
+ *
650
+ * NOTE: this proves the chain is authentic but not that its root authority
651
+ * came from a trusted anchor. Use `verifyRooted` (or independently verify
652
+ * the backing credential) to establish anchor-rooted authority.
653
+ */
654
+ verify(action: Action): void
655
+ /**
656
+ * Verify `action` against this token **and** bind its root to an
657
+ * anchor-issued credential: verifies `vc` against `anchor`, confirms the
658
+ * token was derived from `vc`, that the root was minted by the credential
659
+ * subject, and that the root scope is within the credential's claims.
660
+ * This is the complete check a relying party should use.
661
+ */
662
+ verifyRooted(action: Action, vc: CapabilityCredential, anchor: TrustAnchor): void
663
+ /**
664
+ * `verifyRooted`, evaluated **as of** `epochSeconds` instead of the wall clock.
665
+ *
666
+ * One instant governs the credential's expiry, every hop's expiry and the Datalog
667
+ * time check, so the answer cannot straddle two clocks. For audit re-verification
668
+ * ("was this authorized when it happened?") and for conformance vectors that must
669
+ * outlive the token lifetimes the autonomy ladder permits.
670
+ *
671
+ * **Not the enforcement path** - a relying party deciding in real time calls
672
+ * `verifyRooted`. Revocation is not covered: a historical answer also needs the
673
+ * status list as it stood then.
674
+ */
675
+ verifyRootedAt(action: Action, vc: CapabilityCredential, anchor: TrustAnchor, epochSeconds: number): void
676
+ /**
677
+ * Produce a proof of possession for `challenge`, signed by the token's
678
+ * leaf agent. Only the leaf agent can do this.
679
+ */
680
+ provePossession(challenge: PopChallenge, leafAgent: AgentIdentity): ProofOfPossession
681
+ /**
682
+ * The complete presentation check: anchor-rooted verification plus proof
683
+ * of possession of the leaf key for `expectedChallenge`.
684
+ */
685
+ verifyPresentation(action: Action, vc: CapabilityCredential, anchor: TrustAnchor, proof: ProofOfPossession, expectedChallenge: PopChallenge, maxAgeSecs: number): void
686
+ /**
687
+ * `verifyPresentation`, evaluated **as of** `epochSeconds` instead of the wall
688
+ * clock. One instant governs the credential, every hop, the Datalog time check and
689
+ * the proof's freshness window.
690
+ *
691
+ * **Not the enforcement path** - a relying party deciding in real time calls
692
+ * `verifyPresentation`. This exists for audit re-verification and for golden
693
+ * vectors that must outlive the token lifetimes the autonomy ladder permits.
694
+ */
695
+ verifyPresentationAt(action: Action, vc: CapabilityCredential, anchor: TrustAnchor, proof: ProofOfPossession, expectedChallenge: PopChallenge, maxAgeSecs: number, epochSeconds: number): void
696
+ /** Serialize to CBOR bytes for compact wire transport. */
697
+ toCbor(): Buffer
698
+ /** Deserialise a token from CBOR bytes. */
699
+ static fromCbor(data: Buffer): DelegationToken
700
+ get vcId(): string
701
+ get issuerDid(): string
702
+ /** The human principal DID this token is bound to (on-behalf-of), or null. */
703
+ get principalDid(): string | null
704
+ /** The root resource allow-list this token was minted with. */
705
+ rootResources(): Array<string>
706
+ /** Current delegation depth (0 = not delegated). */
707
+ depth(): number
708
+ /** Extract the full delegation chain as audit entries. */
709
+ chain(): DelegationChain
710
+ toString(): string
711
+ }
712
+ export declare class PublicKey {
713
+ get algorithm(): string
714
+ get bytes(): Buffer
715
+ toMultibase(): string
716
+ toString(): string
717
+ }
718
+ export declare class VerificationMethod {
719
+ get id(): string
720
+ get type(): string
721
+ get controller(): string
722
+ get publicKeyMultibase(): string
723
+ toString(): string
724
+ }
725
+ export declare class DidDocument {
726
+ get id(): string
727
+ get context(): Array<string>
728
+ get authentication(): Array<string>
729
+ get assertionMethod(): Array<string>
730
+ get created(): Date
731
+ get updated(): Date
732
+ get verificationMethod(): Array<VerificationMethod>
733
+ primaryKeyMultibase(): string | null
734
+ toJson(): string
735
+ toObject(): any
736
+ toString(): string
737
+ }
738
+ export declare class AgentIdentity {
739
+ /** Create an ephemeral `did:key` identity. */
740
+ static createDidKey(algorithm?: string | undefined | null): AgentIdentity
741
+ /** Create an org-anchored `did:web` identity. */
742
+ static createDidWeb(host: string, path?: string | undefined | null, algorithm?: string | undefined | null): AgentIdentity
743
+ /** Create a `did:cheqd` identity for the given network. */
744
+ static createDidCheqd(network: string, uniqueId: string, algorithm?: string | undefined | null): AgentIdentity
745
+ /** Create a `did:indy` identity within the given ledger namespace. */
746
+ static createDidIndy(namespace: string, uniqueId: string, algorithm?: string | undefined | null): AgentIdentity
747
+ get did(): string
748
+ get algorithm(): string
749
+ get publicKey(): PublicKey
750
+ document(): DidDocument
751
+ fingerprint(): string
752
+ sign(message: Buffer): Buffer
753
+ verify(message: Buffer, signature: Buffer): void
754
+ toString(): string
755
+ }
756
+ export declare class TrustAnchor {
757
+ /** Convenience constructor for a `did:key` / Ed25519 trust anchor. */
758
+ static generate(): TrustAnchor
759
+ /** Create a trust anchor anchored to a `did:key` identifier. */
760
+ static createDidKey(algorithm?: string | undefined | null): TrustAnchor
761
+ /**
762
+ * Construct a **verify-only** trust anchor from a `did:key` (no private
763
+ * key) - e.g. the current key reached by following a `KeyHistory`. Use it to
764
+ * verify credentials/signatures against a known anchor DID; signing fails.
765
+ */
766
+ static fromDidKey(did: string): TrustAnchor
767
+ /** Create a trust anchor anchored to a `did:web` identifier. */
768
+ static createDidWeb(host: string, path?: string | undefined | null, algorithm?: string | undefined | null): TrustAnchor
769
+ /** Create a trust anchor anchored to a `did:cheqd` identifier. */
770
+ static createDidCheqd(network: string, uniqueId: string, algorithm?: string | undefined | null): TrustAnchor
771
+ /** Create a trust anchor anchored to a `did:indy` identifier. */
772
+ static createDidIndy(namespace: string, uniqueId: string, algorithm?: string | undefined | null): TrustAnchor
773
+ get did(): string
774
+ get algorithm(): string
775
+ get publicKey(): PublicKey
776
+ document(): DidDocument
777
+ verifySignature(message: Buffer, signature: Buffer): void
778
+ toString(): string
779
+ }
780
+ /**
781
+ * In-memory DID resolver used for tests, local development, and wiring up
782
+ * `TrustRegistry` cross-org resolution without a network round-trip.
783
+ *
784
+ * Once passed to `TrustRegistry.withInMemoryResolver()`, the resolver is
785
+ * consumed and can no longer be modified.
786
+ */
787
+ export declare class InMemoryResolver {
788
+ constructor()
789
+ /** Register a DID document so it can be resolved later. */
790
+ register(did: string, document: DidDocument): void
791
+ /** Convenience: register an `AgentIdentity`'s DID document under its own DID. */
792
+ registerIdentity(identity: AgentIdentity): void
793
+ toString(): string
794
+ }
795
+ /** A human principal whose identity an IdP cryptographically attested. */
796
+ export declare class VerifiedHumanPrincipal {
797
+ get issuer(): string
798
+ get subject(): string
799
+ get email(): string | null
800
+ get expiresAt(): Date
801
+ get scope(): Array<string>
802
+ /** The actor (`act.sub`) for an RFC 8693 on-behalf-of token, if present. */
803
+ get actedBy(): string | null
804
+ /** Mint this principal's stable DID from its IdP identity. */
805
+ humanIdentity(): HumanIdentity
806
+ }
807
+ /** An OpenID Connect provider the org trusts, used to validate human ID tokens. */
808
+ export declare class OidcProvider {
809
+ /**
810
+ * Build a provider for `issuer` (the IdP's `iss`) and `audience` (your
811
+ * client id). `leewaySecs` is the allowed clock skew for `exp`/`nbf`
812
+ * (default 60).
813
+ */
814
+ constructor(issuer: string, audience: string, leewaySecs?: number | undefined | null)
815
+ /** Add an Ed25519 (`EdDSA`) signing key (32 bytes), optionally by `kid`. */
816
+ addEd25519Key(publicKey: Buffer, kid?: string | undefined | null): void
817
+ /** Add a P-256 (`ES256`) signing key (SEC1 bytes), optionally by `kid`. */
818
+ addP256Key(publicKey: Buffer, kid?: string | undefined | null): void
819
+ /** Add an RSA (`RS256`) signing key from JWKS `n`/`e` (base64url), by `kid`. */
820
+ addRsaKey(n: string, e: string, kid?: string | undefined | null): void
821
+ /** Import the provider's signing keys from its JWKS document. */
822
+ addKeysFromJwks(jwks: string): void
823
+ /**
824
+ * Validate an OIDC ID token (or RFC 8693 OBO token) and return the verified
825
+ * human principal. If `expectedAgentDid` is given and the token carries an
826
+ * `act` actor, they must match; `expectedNonce` is checked when supplied.
827
+ */
828
+ validateIdToken(idToken: string, expectedAgentDid?: string | undefined | null, expectedNonce?: string | undefined | null): VerifiedHumanPrincipal
829
+ }
830
+ export declare class PopChallenge {
831
+ /**
832
+ * Create a fresh challenge with a random nonce. `audience` optionally binds
833
+ * the proof to a specific verifier (e.g. an MCP server URI).
834
+ */
835
+ constructor(audience?: string | undefined | null)
836
+ get nonce(): Buffer
837
+ get audience(): string | null
838
+ get issuedAt(): Date
839
+ /**
840
+ * Return a copy of this challenge bound to a specific request (pass
841
+ * `Action.requestBinding`). The holder signs the bound challenge, so the
842
+ * resulting presentation is valid only for that exact action.
843
+ */
844
+ withRequestBinding(binding: string): PopChallenge
845
+ /** Serialize to CBOR for wire transport. */
846
+ toCbor(): Buffer
847
+ /** Deserialise a challenge from CBOR bytes. */
848
+ static fromCbor(data: Buffer): PopChallenge
849
+ }
850
+ export declare class ProofOfPossession {
851
+ get leafDid(): string
852
+ /**
853
+ * Verify this proof against `token` and the `challenge` the verifier
854
+ * issued, within `maxAgeSecs`. Throws on failure.
855
+ */
856
+ verify(token: DelegationToken, challenge: PopChallenge, maxAgeSecs: number): void
857
+ /** Serialize to CBOR for wire transport. */
858
+ toCbor(): Buffer
859
+ /** Deserialise a proof from CBOR bytes. */
860
+ static fromCbor(data: Buffer): ProofOfPossession
861
+ }
862
+ export declare class Presentation {
863
+ /** The delegation token being presented (e.g. for audit via `chain()`). */
864
+ get token(): DelegationToken
865
+ /** The credential the token's root is derived from. */
866
+ get credential(): CapabilityCredential
867
+ /**
868
+ * Whether this presentation's proof is bound to a specific request. A
869
+ * verifier requiring per-request binding should reject presentations for
870
+ * which this is false.
871
+ */
872
+ get isActionBound(): boolean
873
+ /**
874
+ * Assemble a presentation (holder side): mints the proof of possession for
875
+ * `challenge` using `leafAgent` and bundles it with the token and its
876
+ * backing credential.
877
+ */
878
+ static create(token: DelegationToken, credential: CapabilityCredential, challenge: PopChallenge, leafAgent: AgentIdentity): Presentation
879
+ /**
880
+ * Verify the full presentation (verifier side): anchor-rooted token
881
+ * verification plus proof of possession. Throws on failure.
882
+ */
883
+ verify(action: Action, anchor: TrustAnchor, challenge: PopChallenge, maxAgeSecs: number): void
884
+ /**
885
+ * `verify`, evaluated **as of** `epochSeconds` rather than the wall clock. One
886
+ * instant governs the credential, every hop, the Datalog time check and the
887
+ * proof's freshness window.
888
+ *
889
+ * **Not the enforcement path** - a relying party deciding in real time calls
890
+ * `verify`. This exists for audit re-verification and for golden vectors that must
891
+ * outlive the one-hour token lifetime the autonomy ladder permits.
892
+ */
893
+ verifyAt(action: Action, anchor: TrustAnchor, challenge: PopChallenge, maxAgeSecs: number, epochSeconds: number): void
894
+ /** Serialize to CBOR for wire transport. */
895
+ toCbor(): Buffer
896
+ /** Deserialise a presentation from CBOR bytes. */
897
+ static fromCbor(data: Buffer): Presentation
898
+ /**
899
+ * Encode this presentation as an A2A identity header string
900
+ * (`AgentCreds-A2A/1.<base64url>`), suitable for an A2A task header.
901
+ */
902
+ toA2AHeader(): string
903
+ /** Decode an A2A identity header string back into a presentation. */
904
+ static fromA2AHeader(header: string): Presentation
905
+ /**
906
+ * Verify an A2A presentation as the receiving agent: full presentation
907
+ * verification plus a requirement that the embedded challenge audience
908
+ * equals `expectedAudience` (this verifier).
909
+ */
910
+ verifyA2A(action: Action, anchor: TrustAnchor, expectedAudience: string, maxAgeSecs: number): void
911
+ }
912
+ /**
913
+ * A human principal's stable DID, minted from their IdP identity at issuance.
914
+ *
915
+ * The human authenticates through the IdP and holds no key here; the DID is a
916
+ * deterministic, resolvable identifier derived from `(issuer, subject)`.
917
+ */
918
+ export declare class HumanIdentity {
919
+ /** Mint a stable `did:web` for a human from their validated IdP identity. */
920
+ static fromIdp(issuer: string, subject: string): HumanIdentity
921
+ /**
922
+ * Mint a stable `did:web` for a **workload** from its verified SPIFFE ID.
923
+ *
924
+ * `did:web:<trust-domain>:w:<fingerprint>` - `:w:` distinguishes it from the `:u:`
925
+ * of a human, so the two can never collide in the identifier space.
926
+ *
927
+ * The SVID must already have been verified against the trust domain's bundle. This
928
+ * does **not** make the workload an accountable party: a service cannot answer for
929
+ * an action, only the team that operates it can.
930
+ */
931
+ static fromSpiffe(spiffeId: string): HumanIdentity
932
+ /** `"human"` or `"workload"` - which root attested this identity. */
933
+ get kind(): string
934
+ get did(): string
935
+ get issuer(): string
936
+ get subject(): string
937
+ /**
938
+ * Build a `HumanAuthorization` for this principal, granted now and expiring
939
+ * at `expiresAt`. `scopeConsented` (tool ids) and `resourceAuthority`
940
+ * (resource patterns) default to empty.
941
+ */
942
+ authorize(expiresAt: Date, scopeConsented?: Array<string> | undefined | null, resourceAuthority?: Array<string> | undefined | null, source?: string | undefined | null): HumanAuthorization
943
+ }
944
+ export declare class TrustEntry {
945
+ /**
946
+ * Create a trust entry. `trustLevel` is one of `"unverified"`,
947
+ * `"self_asserted"`, `"verified"`, or `"authoritative"`.
948
+ */
949
+ constructor(did: string, orgName: string, publicKey: PublicKey, trustLevel: string)
950
+ get did(): string
951
+ get orgName(): string
952
+ get publicKey(): PublicKey
953
+ get didMethod(): string
954
+ get trustLevel(): string
955
+ get registeredAt(): Date
956
+ get revocationEndpoint(): string | null
957
+ /**
958
+ * Where this member publishes its signed key history. `None` = the member does not
959
+ * rotate, so its registered DID is both root and current.
960
+ */
961
+ get keyHistoryUrl(): string | null
962
+ set keyHistoryUrl(url?: string | undefined | null)
963
+ /** Verify a signature produced by this trust anchor's key. */
964
+ verifySignature(message: Buffer, signature: Buffer): void
965
+ toString(): string
966
+ }
967
+ export declare class TrustRegistry {
968
+ /** Create a registry backed by a fresh, empty in-memory resolver. */
969
+ constructor()
970
+ /**
971
+ * Create a registry backed by `resolver`. The resolver is consumed -
972
+ * it cannot be modified or reused afterwards.
973
+ */
974
+ static withInMemoryResolver(resolver: InMemoryResolver): TrustRegistry
975
+ /** Minimum trust level accepted by `verifyCredential`. */
976
+ get minimumTrustLevel(): string
977
+ set minimumTrustLevel(level: string)
978
+ /** Register a trust anchor entry. */
979
+ register(entry: TrustEntry): void
980
+ /**
981
+ * Resolve a trust anchor by DID, caching the result if a resolver lookup
982
+ * was required.
983
+ */
984
+ resolve(did: string): TrustEntry
985
+ /** Number of registered trust anchors. */
986
+ len(): number
987
+ /** True if no trust anchors are registered. */
988
+ isEmpty(): boolean
989
+ /** All registered DIDs. */
990
+ registeredDids(): Array<string>
991
+ /**
992
+ * Export the registry as a signed, versioned `SignedTrustConfig` sealed by
993
+ * `anchor` - the portable, tamper-evident artifact you persist/distribute.
994
+ */
995
+ export(anchor: TrustAnchor, version: number): SignedTrustConfig
996
+ /** Build a registry from a verified signed config (in-memory resolver). */
997
+ static fromConfig(config: SignedTrustConfig, anchor: TrustAnchor): TrustRegistry
998
+ /** Merge a verified config's entries into this registry (additive). */
999
+ importConfig(config: SignedTrustConfig, anchor: TrustAnchor): void
1000
+ /**
1001
+ * Verify `vc` against this registry without contacting the issuer:
1002
+ * resolves the issuer's trust entry, checks its trust level meets
1003
+ * `minimumTrustLevel`, and verifies the credential's proof.
1004
+ */
1005
+ verifyCredential(vc: CapabilityCredential): TrustEntry
1006
+ toString(): string
1007
+ }
1008
+ /**
1009
+ * A signed, versioned snapshot of a `TrustRegistry` - the persistable,
1010
+ * tamper-evident trust configuration.
1011
+ */
1012
+ export declare class SignedTrustConfig {
1013
+ get version(): number
1014
+ get generatedAt(): string
1015
+ get issuerDid(): string
1016
+ get minimumTrustLevel(): string
1017
+ get entries(): Array<TrustEntry>
1018
+ /** Verify the config's signature against `anchor` (its issuer). */
1019
+ verify(anchor: TrustAnchor): void
1020
+ /** Whether the config is inside its validity window (unbounded = always current). */
1021
+ isCurrent(): boolean
1022
+ /** The sealed expiry (rfc3339), or null if the config is unbounded. */
1023
+ get notAfter(): string | null
1024
+ /**
1025
+ * Verify authenticity **and** freshness - what a relying party should use.
1026
+ *
1027
+ * `verify` alone accepts an EXPIRED config, so a relying party calling only that
1028
+ * honours a lapsed membership list indefinitely: the framework could remove a
1029
+ * member and never be believed.
1030
+ */
1031
+ verifyCurrent(anchor: TrustAnchor): void
1032
+ /** The config as a JSON string (the persisted artifact). */
1033
+ toJson(): string
1034
+ /** Parse a config from its JSON string. */
1035
+ static fromJson(s: string): SignedTrustConfig
1036
+ }
1037
+ export declare class RevocationList {
1038
+ /**
1039
+ * Create a new, empty revocation list published at `id`, signed by
1040
+ * `anchor`. `size` defaults to [`defaultListSize`] (131,072 entries).
1041
+ */
1042
+ constructor(id: string, anchor: TrustAnchor, size?: number | undefined | null)
1043
+ /**
1044
+ * Deserialise a published revocation list from its JSON form. Call `verify`
1045
+ * against the issuer anchor before trusting it.
1046
+ */
1047
+ static fromJson(json: string): RevocationList
1048
+ /** Serialize this list to JSON (the published form a relying party fetches). */
1049
+ toJson(): string
1050
+ get id(): string
1051
+ get issuer(): string
1052
+ get updated(): Date
1053
+ get size(): number
1054
+ get encodedList(): string
1055
+ get signature(): string
1056
+ /** Revoke the credential at `index`, re-signing the list with `anchor`. */
1057
+ revoke(index: number, anchor: TrustAnchor): void
1058
+ /** Un-revoke the credential at `index`, re-signing the list with `anchor`. */
1059
+ unrevoke(index: number, anchor: TrustAnchor): void
1060
+ /** True if the credential at `index` is revoked. */
1061
+ isRevoked(index: number): boolean
1062
+ /** Verify this list's signature against `anchor`. */
1063
+ verify(anchor: TrustAnchor): void
1064
+ /** Total number of revoked credentials in this list. */
1065
+ revocationCount(): number
1066
+ /** SHA-256 fingerprint of the current list state. */
1067
+ fingerprint(): string
1068
+ toString(): string
1069
+ }
1070
+ export declare class RevocationRegistry {
1071
+ /** Create an empty registry. */
1072
+ constructor()
1073
+ /** Register a revocation list under its ID (URL). */
1074
+ register(list: RevocationList): void
1075
+ /** Look up a revocation list by ID (URL), or `null` if not registered. */
1076
+ get(listId: string): RevocationList | null
1077
+ /** Revoke `index` in the list identified by `listId`, re-signing with `anchor`. */
1078
+ revoke(listId: string, index: number, anchor: TrustAnchor): void
1079
+ /** Un-revoke `index` in the list identified by `listId`, re-signing with `anchor`. */
1080
+ unrevoke(listId: string, index: number, anchor: TrustAnchor): void
1081
+ /**
1082
+ * Check the revocation status of `credentialId` (throws
1083
+ * `CredentialRevokedError` if revoked, or if `listId` is unknown).
1084
+ */
1085
+ isRevoked(listId: string, index: number, credentialId: string): void
1086
+ toString(): string
1087
+ }
1088
+ /** A signed endorsement by an outgoing anchor key of its successor. */
1089
+ export declare class RotationStatement {
1090
+ /** Issue a statement: `old` signs an endorsement of `next` (effective now). */
1091
+ static issue(old: TrustAnchor, next: TrustAnchor): RotationStatement
1092
+ /** Verify the statement is authentically signed by the outgoing key. */
1093
+ verify(): void
1094
+ get previousDid(): string
1095
+ get nextDid(): string
1096
+ get effectiveAt(): string
1097
+ get signature(): string
1098
+ toJson(): string
1099
+ static fromJson(s: string): RotationStatement
1100
+ }
1101
+ /** The chain of rotation statements from an anchor's original key to its current. */
1102
+ export declare class KeyHistory {
1103
+ /** A new history rooted at `rootDid`. */
1104
+ constructor(rootDid: string)
1105
+ /** A new history rooted at `anchor`'s DID. */
1106
+ static genesis(anchor: TrustAnchor): KeyHistory
1107
+ /** Append a rotation (must chain from the current key and verify). */
1108
+ push(statement: RotationStatement): void
1109
+ /** The current (latest) anchor DID in the chain. */
1110
+ currentDid(): string
1111
+ /** Verify the chain from `trustedRootDid` and return the current DID. */
1112
+ verify(trustedRootDid: string): string
1113
+ /** Verify the chain and return a verify-only `TrustAnchor` for the current key. */
1114
+ currentAnchor(trustedRootDid: string): TrustAnchor
1115
+ /** Every anchor DID the organization legitimately held (root + successors). */
1116
+ dids(): Array<string>
1117
+ /**
1118
+ * Verify the chain and confirm `issuerDid` is in the history, returning a
1119
+ * verify-only `TrustAnchor` for it (use to verify a credential's issuer).
1120
+ * Withdraw `did` from issuance. Re-seal afterwards or the change is unsigned.
1121
+ */
1122
+ repudiate(did: string): void
1123
+ /**
1124
+ * Seal the history: the **current** key signs the chain, repudiations and expiry.
1125
+ * `notAfterUnix` is seconds since the epoch; omit for an unbounded seal.
1126
+ */
1127
+ seal(current: TrustAnchor, version: number, notAfterUnix?: number | undefined | null): void
1128
+ /** Whether the sealed history is still inside its validity window. */
1129
+ isCurrent(): boolean
1130
+ /** Verify the chain and the seal under the current key (authenticity only). */
1131
+ verifySealed(trustedRootDid: string): string
1132
+ /** Verify authenticity **and** freshness - what a relying party should use. */
1133
+ verifyCurrent(trustedRootDid: string): string
1134
+ /** The DIDs still trusted for issuance (the chain minus the repudiations). */
1135
+ activeDids(): Array<string>
1136
+ /** The DIDs withdrawn from issuance. */
1137
+ repudiated(): Array<string>
1138
+ authorizeIssuer(trustedRootDid: string, issuerDid: string): TrustAnchor
1139
+ /** Serialize the history to JSON (the portable artifact relying parties follow). */
1140
+ toJson(): string
1141
+ /** Parse a history from JSON. */
1142
+ static fromJson(s: string): KeyHistory
1143
+ }
1144
+ /**
1145
+ * An SD-JWT capability credential in compact form. The issuer hands the whole
1146
+ * thing to the holder; the holder calls `present` to reveal a subset.
1147
+ */
1148
+ export declare class SdJwt {
1149
+ /**
1150
+ * Issue an SD-JWT whose disclosable claims are the fields of `claims`
1151
+ * (tools, budget, depth, autonomy, and the optional model/artifact/
1152
+ * authorizer fields when present).
1153
+ */
1154
+ static fromCapability(anchor: TrustAnchor, subjectDid: string, claims: CapabilityClaims, validForSecs: number): SdJwt
1155
+ /** Parse a compact SD-JWT (e.g. one received from an issuer). */
1156
+ static parse(s: string): SdJwt
1157
+ /** The full compact serialization to hand to the holder. */
1158
+ asStr(): string
1159
+ /** The names of the claims this SD-JWT can disclose. */
1160
+ disclosableClaims(): Array<string>
1161
+ /**
1162
+ * Holder side: a presentation revealing only the named claims (plus the
1163
+ * always-disclosed registered claims). Unknown names are ignored.
1164
+ */
1165
+ present(disclose: Array<string>): string
1166
+ /**
1167
+ * Verifier side: verify a presentation against the issuer `anchor`,
1168
+ * returning the disclosed claims. Throws on a bad signature, expiry, or a
1169
+ * disclosure not covered by the signed `_sd` set.
1170
+ */
1171
+ static verifyPresentation(presentation: string, anchor: TrustAnchor): DisclosedCredential
1172
+ }
1173
+ /** The result of verifying an SD-JWT presentation. */
1174
+ export declare class DisclosedCredential {
1175
+ get issuer(): string
1176
+ get subject(): string
1177
+ get vct(): string
1178
+ get issuedAt(): string
1179
+ get expiresAt(): string
1180
+ /** The disclosed claims as a JSON object string (name -> value). */
1181
+ get disclosedJson(): string
1182
+ }
1183
+ /** A parsed SPIFFE ID (`spiffe://<trust_domain><path>`). */
1184
+ export declare class SpiffeId {
1185
+ /** Parse a SPIFFE ID from its `spiffe://...` URI form. */
1186
+ static parse(s: string): SpiffeId
1187
+ get trustDomain(): string
1188
+ get path(): string
1189
+ uri(): string
1190
+ }
1191
+ /** A successfully validated JWT-SVID. */
1192
+ export declare class ValidatedSvid {
1193
+ get spiffeId(): SpiffeId
1194
+ /** SVID expiry as an RFC 3339 timestamp string. */
1195
+ get expiresAt(): string
1196
+ get audiences(): Array<string>
1197
+ }
1198
+ /** The set of public keys for a SPIFFE trust domain, used to validate JWT-SVIDs. */
1199
+ export declare class SpiffeTrustBundle {
1200
+ constructor()
1201
+ /** Add an Ed25519 (`EdDSA`) trust-domain key (32 bytes), optionally by `kid`. */
1202
+ addEd25519Key(publicKey: Buffer, kid?: string | undefined | null): void
1203
+ /** Add a P-256 (`ES256`) trust-domain key (SEC1 bytes), optionally by `kid`. */
1204
+ addP256Key(publicKey: Buffer, kid?: string | undefined | null): void
1205
+ /** Validate a JWT-SVID against this bundle, optionally requiring `expectedAudience`. */
1206
+ validateJwtSvid(jwt: string, expectedAudience?: string | undefined | null): ValidatedSvid
1207
+ /**
1208
+ * Export this bundle as a JWKS document (the portable WIMSE trust-bundle
1209
+ * exchange form) for peers to import.
1210
+ */
1211
+ toJwks(): string
1212
+ /** Import a trust bundle from a peer's JWKS document. */
1213
+ static fromJwks(jwks: string): SpiffeTrustBundle
1214
+ }
1215
+ /**
1216
+ * A mock organization for local cross-org testing: a trust anchor plus
1217
+ * one-call agent/credential issuance.
1218
+ */
1219
+ export declare class MockOrg {
1220
+ constructor(name: string)
1221
+ get name(): string
1222
+ get did(): string
1223
+ /** Create an agent and issue it a capability credential in one call. */
1224
+ issueAgent(tools: Array<string>, budgetUsd: number | undefined | null, maxDelegationDepth: number, validForSecs: number): MockAgent
1225
+ /** Verify a presentation as a relying party that trusts this org. */
1226
+ verifyPresented(presentation: Presentation, action: Action, challenge: PopChallenge, maxAgeSecs: number): void
1227
+ }
1228
+ /**
1229
+ * An agent issued by a [`MockOrg`]: holds the identity and credential, and can
1230
+ * mint tokens / assemble presentations without exposing key material.
1231
+ */
1232
+ export declare class MockAgent {
1233
+ get did(): string
1234
+ /** The capability credential issued to this agent. */
1235
+ get credential(): CapabilityCredential
1236
+ /** Mint a runtime delegation token for this agent. */
1237
+ mint(tools: Array<string>, budgetUsd: number | undefined | null, maxDepth: number, ttlSecs: number): DelegationToken
1238
+ /** Assemble a presentation of `token` for `challenge`, signed by this agent. */
1239
+ present(token: DelegationToken, challenge: PopChallenge): Presentation
1240
+ }
1241
+ /**
1242
+ * A bridge that federates peer SPIFFE trust domains: import each peer's JWKS
1243
+ * bundle, then validate SVIDs it signs.
1244
+ */
1245
+ export declare class FederationBridge {
1246
+ constructor()
1247
+ /**
1248
+ * Federate a peer domain by importing its JWKS trust-bundle export.
1249
+ * `trustLevel` is one of `unverified`/`self_asserted`/`verified`/`authoritative`.
1250
+ */
1251
+ addDomainFromJwks(trustDomain: string, jwks: string, trustLevel: string): void
1252
+ /** The trust domains this bridge federates. */
1253
+ trustedDomains(): Array<string>
1254
+ /** Validate a federated SVID, routing it to its trust domain's bundle. */
1255
+ validate(jwtSvid: string, expectedAudience?: string | undefined | null): FederatedIdentity
1256
+ }
1257
+ /** A validated, federated workload identity from a peer trust domain. */
1258
+ export declare class FederatedIdentity {
1259
+ /** The workload's SPIFFE ID, as a `spiffe://...` URI. */
1260
+ get spiffeId(): string
1261
+ get trustDomain(): string
1262
+ /** The trust level assigned to the issuing domain. */
1263
+ get trustLevel(): string
1264
+ get expiresAt(): string
1265
+ get audiences(): Array<string>
1266
+ /**
1267
+ * Issue a capability credential for this federated workload, signed by the
1268
+ * relying org's own `anchor`.
1269
+ */
1270
+ issueCredential(anchor: TrustAnchor, agentDid: string, tools: Array<string>, maxDelegationDepth: number, validForSecs: number): CapabilityCredential
1271
+ }