@atlasauth/pca-agentcard 0.0.0-stage → 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.
- package/dist/index.d.ts +333 -0
- package/dist/index.js +440 -0
- package/dist/index.js.map +1 -0
- package/package.json +31 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @atlasauth/pca-agentcard — signed agent card + AgentFacts attestor for PCA.
|
|
3
|
+
*
|
|
4
|
+
* ┌──────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
5
|
+
* │ The fix for the spoofable self-declared agent card: PCA becomes the THIRD-PARTY ATTESTOR whose │
|
|
6
|
+
* │ card + AgentFacts point at LIVE, VERIFIABLE proof-of-authority instead of a self-assertion. │
|
|
7
|
+
* └──────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
8
|
+
*
|
|
9
|
+
* The agent-discovery world today has two surfaces that both separate "what an agent says about
|
|
10
|
+
* itself" from "what a third party will vouch for":
|
|
11
|
+
*
|
|
12
|
+
* • A2A 1.0 Agent Cards (`/.well-known/agent-card.json`) carry an `AgentCardSignature` — a JWS over
|
|
13
|
+
* the canonicalized card — so a consumer can tell a signed card from an unsigned, forgeable one.
|
|
14
|
+
* • NANDA AgentFacts is a metadata document that explicitly splits SELF-ASSERTED claims from
|
|
15
|
+
* third-party ATTESTATIONS (each a signed statement by a named attestor, with a validity window).
|
|
16
|
+
*
|
|
17
|
+
* Both schemes answer "is this card authentic?" — they do NOT answer "does this agent actually hold
|
|
18
|
+
* the authority it advertises?". That is exactly PCA's job. This package makes PCA the third-party
|
|
19
|
+
* attestor: it signs the agent's AgentFacts attestation block, and it builds a signed Agent Card whose
|
|
20
|
+
* metadata points at the agent's PCA passport AND a live proof-verification endpoint, so a relying party
|
|
21
|
+
* resolves verifiable proof-of-authority (a PCActn) instead of trusting the card's word.
|
|
22
|
+
*
|
|
23
|
+
* WIRE COMPATIBILITY. The Signed-Agent-Card surface here is byte-identical to the one in
|
|
24
|
+
* `@atlasauth/pca-a2a` (A2A 1.0 `AgentCardSignature`): the SAME canonical signing bytes (the card minus
|
|
25
|
+
* its `signatures`), the SAME detached-payload JWS (`b64:false`, `crit:['b64']`), the SAME `pca_passport`
|
|
26
|
+
* protected-header commitment, and the SAME `signatures[]` shape. A card issued here verifies under
|
|
27
|
+
* `@atlasauth/pca-a2a`'s `verifyAgentCard` and vice-versa — this module does not define a divergent
|
|
28
|
+
* scheme, it hosts the A2A card signer and layers AgentFacts + the attestor + the well-known hosting on
|
|
29
|
+
* top. (It builds only on `@atlasauth/pca` and `jose`, the same two primitives that card signer uses.)
|
|
30
|
+
*
|
|
31
|
+
* Everything here FAILS CLOSED: a missing signature, an unresolvable key, a tampered body, a bad/expired
|
|
32
|
+
* attestation, or an attestation about a different subject is rejected — never silently trusted.
|
|
33
|
+
*/
|
|
34
|
+
import { type AgentPassport } from '@atlasauth/pca';
|
|
35
|
+
import { type JSONWebKeySet, type JWK, type KeyLike } from 'jose';
|
|
36
|
+
/** A key usable to sign. A plain JWK is imported for the given alg; other forms are passed through. */
|
|
37
|
+
export type SignKeyInput = KeyLike | Uint8Array | JWK;
|
|
38
|
+
/** A key usable to verify. A plain JWK is imported for the given alg; other forms are passed through. */
|
|
39
|
+
export type VerifyKeyInput = KeyLike | Uint8Array | JWK;
|
|
40
|
+
/** Default JWS algorithm for card + attestation signatures. */
|
|
41
|
+
export declare const DEFAULT_ALG: "EdDSA";
|
|
42
|
+
/**
|
|
43
|
+
* A detached-payload JWS, per A2A 1.0's `AgentCardSignature`: `protected` is the base64url JWS protected
|
|
44
|
+
* header, `signature` the base64url signature. The payload is NOT carried (it is recomputed — the
|
|
45
|
+
* canonical bytes of the thing being signed — on verify). Reused verbatim for AgentFacts attestations.
|
|
46
|
+
*/
|
|
47
|
+
export interface AgentCardSignature {
|
|
48
|
+
protected: string;
|
|
49
|
+
signature: string;
|
|
50
|
+
header?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
/** Options shared by the verify surfaces: either a JWKS (kid-resolved) or a single key. */
|
|
53
|
+
export interface VerifyKeyOptions {
|
|
54
|
+
/** A JWKS to resolve the signing key from (matched by the JWS `kid` / `alg`). */
|
|
55
|
+
jwks?: JSONWebKeySet;
|
|
56
|
+
/** A single verification key (JWK, raw secret, or a crypto key). */
|
|
57
|
+
key?: VerifyKeyInput;
|
|
58
|
+
/** Expected JWS algorithm for `importJWK` of a plain JWK `key` (default `'EdDSA'`). */
|
|
59
|
+
alg?: string;
|
|
60
|
+
}
|
|
61
|
+
/** A reference to the agent's PCA passport (see `@atlasauth/pca` `AgentPassport`). */
|
|
62
|
+
export interface PassportRef {
|
|
63
|
+
/** The content-addressed passport id (`AgentPassport.id`). */
|
|
64
|
+
id: string;
|
|
65
|
+
/** Optional URL where the full, verifiable passport can be resolved. */
|
|
66
|
+
uri?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A live proof-of-authority pointer embedded in the signed card. This is what turns the card from a
|
|
70
|
+
* self-declaration into a pointer at verifiable authority: a relying party presents the agent's PCA
|
|
71
|
+
* proof (a PCActn) to `verificationEndpoint` and only trusts the agent once that proof verifies.
|
|
72
|
+
*/
|
|
73
|
+
export interface PcaProofRef {
|
|
74
|
+
/** The HTTP endpoint that verifies a presented PCA proof (PCActn) for this agent. */
|
|
75
|
+
verificationEndpoint: string;
|
|
76
|
+
/** Optional reference/digest of a representative or most-recent proof. */
|
|
77
|
+
proofRef?: string;
|
|
78
|
+
/** The resource server / Atlas instance id the agent's proofs are audience-bound to. */
|
|
79
|
+
aud?: string;
|
|
80
|
+
}
|
|
81
|
+
/** An A2A Agent Card skill entry. Structural only; real cards carry more fields, all preserved + signed. */
|
|
82
|
+
export interface AgentSkill {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
tags?: string[];
|
|
87
|
+
[k: string]: unknown;
|
|
88
|
+
}
|
|
89
|
+
/** A minimal, permissive A2A Agent Card. Real cards carry many more fields; all are preserved + signed. */
|
|
90
|
+
export interface AgentCard {
|
|
91
|
+
name: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
url?: string;
|
|
94
|
+
version?: string;
|
|
95
|
+
skills?: AgentSkill[];
|
|
96
|
+
/** The PCA passport this card's authority is rooted in (embedded + covered by the signature). */
|
|
97
|
+
pcaPassport?: PassportRef;
|
|
98
|
+
/** The live proof-verification pointer (embedded + covered by the signature). */
|
|
99
|
+
pcaProof?: PcaProofRef;
|
|
100
|
+
signatures?: AgentCardSignature[];
|
|
101
|
+
[k: string]: unknown;
|
|
102
|
+
}
|
|
103
|
+
export interface BuildAgentCardOptions {
|
|
104
|
+
/** The agent's human name (A2A `name`). */
|
|
105
|
+
name: string;
|
|
106
|
+
/** The agent's advertised skills. */
|
|
107
|
+
skills?: AgentSkill[];
|
|
108
|
+
/** The agent's A2A service URL. */
|
|
109
|
+
url?: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
version?: string;
|
|
112
|
+
/** Where/whether the full passport can be resolved (becomes `pcaPassport.uri`). */
|
|
113
|
+
passportUri?: string;
|
|
114
|
+
/** The live proof-of-authority pointer embedded in the card. */
|
|
115
|
+
pcaProofRef?: PcaProofRef;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Build an (unsigned) A2A Agent Card from a PCA passport. The card's metadata points at the PCA passport
|
|
119
|
+
* (`pcaPassport`) and, when given, the live proof-verification endpoint (`pcaProof`) — so once signed it
|
|
120
|
+
* is a pointer at verifiable authority rather than a self-declaration. Sign it with {@link issueSignedAgentCard}.
|
|
121
|
+
*/
|
|
122
|
+
export declare function buildAgentCard(passport: AgentPassport, opts: BuildAgentCardOptions): AgentCard;
|
|
123
|
+
export interface IssueAgentCardOptions {
|
|
124
|
+
/** JWS algorithm for the signature. Default `'EdDSA'`. */
|
|
125
|
+
alg?: string;
|
|
126
|
+
/** A passport reference to embed if the card does not already carry one. */
|
|
127
|
+
passport?: PassportRef | {
|
|
128
|
+
id: string;
|
|
129
|
+
};
|
|
130
|
+
/** Optional JWS `kid` (set it when verifiers resolve the key from a JWKS). */
|
|
131
|
+
kid?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Sign an A2A Agent Card. Ensures a PCA passport reference is embedded (`pcaPassport`) and committed in
|
|
135
|
+
* the JWS protected header (`pca_passport`), then signs the canonicalized card (minus `signatures`) and
|
|
136
|
+
* appends the detached-payload `AgentCardSignature`. Wire-identical to `@atlasauth/pca-a2a`.
|
|
137
|
+
*/
|
|
138
|
+
export declare function issueSignedAgentCard(card: AgentCard, signingKey: SignKeyInput, opts?: IssueAgentCardOptions): Promise<AgentCard>;
|
|
139
|
+
/** The outcome of validating a signed Agent Card. */
|
|
140
|
+
export interface AgentCardVerification {
|
|
141
|
+
ok: boolean;
|
|
142
|
+
reason?: string;
|
|
143
|
+
/** The passport id recovered from a verified signature's protected header (proof-of-authority pointer). */
|
|
144
|
+
passportRef?: string;
|
|
145
|
+
/** The passport reference embedded in the (verified) card body, when present. */
|
|
146
|
+
passport?: PassportRef;
|
|
147
|
+
/** The live proof pointer from the (verified) card body, when present. */
|
|
148
|
+
pcaProof?: PcaProofRef;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Validate an A2A Agent Card against its `AgentCardSignature`(s). Fail-closed: a card with no signatures,
|
|
152
|
+
* an unresolvable key, or ANY signature that does not verify over the canonicalized card (minus
|
|
153
|
+
* `signatures`) is rejected. On success, returns the PCA passport id the signature commits to plus the
|
|
154
|
+
* live proof pointer, so a caller can resolve + check them against a `PassportRegistry` / verify endpoint.
|
|
155
|
+
*/
|
|
156
|
+
export declare function verifyAgentCard(card: AgentCard, opts: VerifyKeyOptions): Promise<AgentCardVerification>;
|
|
157
|
+
/**
|
|
158
|
+
* JSON-LD contexts for an AgentFacts document. The DID context plus the AgentFacts vocabulary (the second
|
|
159
|
+
* entry is a placeholder for the canonical NANDA AgentFacts context URL — replace before production).
|
|
160
|
+
*/
|
|
161
|
+
export declare const AGENT_FACTS_CONTEXT: readonly string[];
|
|
162
|
+
/**
|
|
163
|
+
* One third-party attestation inside an AgentFacts doc: a NAMED attestor (`issuer`) vouches, over a
|
|
164
|
+
* signature, for a set of claims (`attests`) ABOUT a subject (`subject`) within a validity window. PCA
|
|
165
|
+
* is the issuer; the signature is a detached JWS over the canonical statement (see {@link issueAgentFacts}).
|
|
166
|
+
*/
|
|
167
|
+
export interface AgentFactsAttestation {
|
|
168
|
+
/** The attestor's identifier (e.g. a DID). PCA's attestor id when PCA signs it. */
|
|
169
|
+
issuer: string;
|
|
170
|
+
/** The agent this statement is ABOUT — MUST equal the enclosing doc's `id` (checked on verify). */
|
|
171
|
+
subject: string;
|
|
172
|
+
/** The claims this attestor vouches for (third-party-verified, as opposed to self-asserted). */
|
|
173
|
+
attests: Record<string, unknown>;
|
|
174
|
+
/** Validity window start (ISO 8601). */
|
|
175
|
+
validFrom: string;
|
|
176
|
+
/** Validity window end (ISO 8601), if the attestation expires. */
|
|
177
|
+
validUntil?: string;
|
|
178
|
+
/** Detached JWS over the canonicalized statement (issuer + subject + attests + validity). */
|
|
179
|
+
signature: AgentCardSignature;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* An AgentFacts document: the agent's id (DID / passport ref), its SELF-ASSERTED claims (unverified — the
|
|
183
|
+
* agent's own word), and a list of third-party ATTESTATIONS, each a signed statement. The split is the
|
|
184
|
+
* whole point: a relying party can tell what the agent merely claims from what a named attestor vouches for.
|
|
185
|
+
*/
|
|
186
|
+
export interface AgentFacts {
|
|
187
|
+
'@context': readonly string[];
|
|
188
|
+
/** The agent's DID / passport reference. */
|
|
189
|
+
id: string;
|
|
190
|
+
type: 'AgentFacts';
|
|
191
|
+
/** Claims the agent declares about itself — NOT verified; trust at your own risk. */
|
|
192
|
+
selfAsserted: Record<string, unknown>;
|
|
193
|
+
/** Third-party attestations, each independently verifiable + fail-closed. */
|
|
194
|
+
attestations: AgentFactsAttestation[];
|
|
195
|
+
}
|
|
196
|
+
/** Default attestor identity used when PCA signs an AgentFacts attestation. */
|
|
197
|
+
export declare const PCA_ATTESTOR_ID: "did:atlas:pca-attestor";
|
|
198
|
+
export interface IssueAgentFactsOptions {
|
|
199
|
+
/** The agent's self-declared claims (echoed verbatim; never signed). */
|
|
200
|
+
selfAsserted?: Record<string, unknown>;
|
|
201
|
+
/** The PCA attestor's signing key. */
|
|
202
|
+
attestorKey: SignKeyInput;
|
|
203
|
+
/** The claims PCA (the third party) vouches for about this agent. */
|
|
204
|
+
attests: Record<string, unknown>;
|
|
205
|
+
/** The attestor identifier recorded on the attestation. Default {@link PCA_ATTESTOR_ID}. */
|
|
206
|
+
attestorId?: string;
|
|
207
|
+
/** Override the agent id / DID (default: the passport id). */
|
|
208
|
+
agentId?: string;
|
|
209
|
+
/** JWS algorithm. Default `'EdDSA'`. */
|
|
210
|
+
alg?: string;
|
|
211
|
+
/** Optional JWS `kid` so a JWKS verifier can resolve the attestor key. */
|
|
212
|
+
kid?: string;
|
|
213
|
+
/** Validity window start (ISO). Default: now. */
|
|
214
|
+
validFrom?: string;
|
|
215
|
+
/** Validity window end (ISO). */
|
|
216
|
+
validUntil?: string;
|
|
217
|
+
/** Clock for the default `validFrom` (epoch ms). Default `Date.now()`. */
|
|
218
|
+
now?: number;
|
|
219
|
+
/** Override the JSON-LD `@context`. */
|
|
220
|
+
context?: readonly string[];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Issue an AgentFacts document for a PCA passport, with PCA as the THIRD-PARTY ATTESTOR. The agent's own
|
|
224
|
+
* `selfAsserted` claims are carried verbatim and left unsigned; the `attests` claims are wrapped in a
|
|
225
|
+
* statement (issuer + subject + validity) and signed with `attestorKey`. A verifier can then tell exactly
|
|
226
|
+
* which claims a named third party vouches for. The resulting doc is served at `/.well-known/agent-facts.json`.
|
|
227
|
+
*/
|
|
228
|
+
export declare function issueAgentFacts(passport: AgentPassport, opts: IssueAgentFactsOptions): Promise<AgentFacts>;
|
|
229
|
+
export interface AddAttestationOptions {
|
|
230
|
+
attestorKey: SignKeyInput;
|
|
231
|
+
attests: Record<string, unknown>;
|
|
232
|
+
attestorId?: string;
|
|
233
|
+
alg?: string;
|
|
234
|
+
kid?: string;
|
|
235
|
+
validFrom?: string;
|
|
236
|
+
validUntil?: string;
|
|
237
|
+
now?: number;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Append another third-party attestation to an existing AgentFacts doc (returns a copy; input unmutated).
|
|
241
|
+
* Lets several independent attestors each vouch for a different subset of claims.
|
|
242
|
+
*/
|
|
243
|
+
export declare function addAttestation(facts: AgentFacts, opts: AddAttestationOptions): Promise<AgentFacts>;
|
|
244
|
+
/** Per-attestation verification outcome. */
|
|
245
|
+
export interface AttestationCheck {
|
|
246
|
+
issuer: string;
|
|
247
|
+
ok: boolean;
|
|
248
|
+
reason?: string;
|
|
249
|
+
/** The attested claims (present only when this attestation verified). */
|
|
250
|
+
attests?: Record<string, unknown>;
|
|
251
|
+
}
|
|
252
|
+
/** Whether a claim in the resolved view is third-party attested or merely self-asserted. */
|
|
253
|
+
export type ClaimProvenance = 'attested' | 'self-asserted';
|
|
254
|
+
/** The outcome of verifying an AgentFacts document. */
|
|
255
|
+
export interface AgentFactsVerification {
|
|
256
|
+
ok: boolean;
|
|
257
|
+
reason?: string;
|
|
258
|
+
agentId: string;
|
|
259
|
+
/** One entry per attestation in the doc, in order. */
|
|
260
|
+
attestations: AttestationCheck[];
|
|
261
|
+
/** The union of claims from every VERIFIED attestation (third-party backed). */
|
|
262
|
+
attested: Record<string, unknown>;
|
|
263
|
+
/** The agent's self-declared claims, echoed (unverified — flagged as self-asserted). */
|
|
264
|
+
selfAsserted: Record<string, unknown>;
|
|
265
|
+
/** Provenance of every claim name seen across self-asserted + attested (attested wins on overlap). */
|
|
266
|
+
claims: Record<string, ClaimProvenance>;
|
|
267
|
+
}
|
|
268
|
+
export interface VerifyAgentFactsOptions extends VerifyKeyOptions {
|
|
269
|
+
/** Verification clock for the attestations' validity windows (epoch ms). Default `Date.now()`. */
|
|
270
|
+
now?: number;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Verify an AgentFacts document. Fail-closed throughout:
|
|
274
|
+
* • an attestation whose `subject` is not this doc's `id` is rejected;
|
|
275
|
+
* • an attestation outside its validity window (or with a malformed window) is rejected;
|
|
276
|
+
* • an attestation whose detached JWS does not verify under the supplied key/JWKS is rejected;
|
|
277
|
+
* • if ANY present attestation fails, the whole document verification returns `ok:false`.
|
|
278
|
+
* On success, the result marks which claims are third-party ATTESTED and which are merely SELF-ASSERTED
|
|
279
|
+
* (flagged, never promoted). A doc with zero attestations verifies, but attests nothing.
|
|
280
|
+
*/
|
|
281
|
+
export declare function verifyAgentFacts(facts: AgentFacts, opts: VerifyAgentFactsOptions): Promise<AgentFactsVerification>;
|
|
282
|
+
/** The A2A well-known path a signed Agent Card is served at. */
|
|
283
|
+
export declare const WELL_KNOWN_AGENT_CARD_PATH: "/.well-known/agent-card.json";
|
|
284
|
+
/** The well-known path an AgentFacts document is served at. */
|
|
285
|
+
export declare const WELL_KNOWN_AGENT_FACTS_PATH: "/.well-known/agent-facts.json";
|
|
286
|
+
/** A minimal, framework-agnostic HTTP response the handlers emit. */
|
|
287
|
+
export interface HostedResponse {
|
|
288
|
+
status: number;
|
|
289
|
+
headers: Record<string, string>;
|
|
290
|
+
body: string;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* A path handler: given a request path, return the response for the resource it serves, or `undefined`
|
|
294
|
+
* when the path is not this handler's — so it composes in a router (fall through to the next handler).
|
|
295
|
+
*/
|
|
296
|
+
export type PathHandler = (path: string) => HostedResponse | undefined;
|
|
297
|
+
/** Serve a signed Agent Card at {@link WELL_KNOWN_AGENT_CARD_PATH}; `undefined` for any other path. */
|
|
298
|
+
export declare function agentCardHandler(card: AgentCard, path?: string): PathHandler;
|
|
299
|
+
/** Serve an AgentFacts document at {@link WELL_KNOWN_AGENT_FACTS_PATH}; `undefined` for any other path. */
|
|
300
|
+
export declare function agentFactsHandler(facts: AgentFacts, path?: string): PathHandler;
|
|
301
|
+
/**
|
|
302
|
+
* A structural entry for publishing an agent to an A2A registry / NANDA index: the identity + discovery
|
|
303
|
+
* fields a registry indexes, plus the signed card, the AgentFacts doc, and the derived split of which
|
|
304
|
+
* advertised claim names are third-party ATTESTED vs merely SELF-ASSERTED (so an index can rank/flag them).
|
|
305
|
+
*/
|
|
306
|
+
export interface RegistryEntry {
|
|
307
|
+
/** The agent id / DID (the AgentFacts `id`). */
|
|
308
|
+
id: string;
|
|
309
|
+
name: string;
|
|
310
|
+
url?: string;
|
|
311
|
+
version?: string;
|
|
312
|
+
skills?: AgentSkill[];
|
|
313
|
+
/** The PCA passport the card commits to. */
|
|
314
|
+
passport?: PassportRef;
|
|
315
|
+
/** The live proof-verification pointer. */
|
|
316
|
+
pcaProof?: PcaProofRef;
|
|
317
|
+
/** The signed Agent Card (verbatim). */
|
|
318
|
+
card: AgentCard;
|
|
319
|
+
/** The well-known URL the card is served at, derived from `card.url` when present. */
|
|
320
|
+
agentCardUrl?: string;
|
|
321
|
+
/** The AgentFacts document (verbatim). */
|
|
322
|
+
facts: AgentFacts;
|
|
323
|
+
/** Claim names a third party attests (union across attestations). */
|
|
324
|
+
attestedClaims: string[];
|
|
325
|
+
/** Claim names the agent only self-asserts (not covered by any attestation). */
|
|
326
|
+
selfAssertedClaims: string[];
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Shape a {@link RegistryEntry} from a signed card + an AgentFacts doc for submission to an A2A registry /
|
|
330
|
+
* NANDA index. Purely structural: it does NOT re-verify (a registry re-verifies on ingest) — it derives
|
|
331
|
+
* the attested-vs-self-asserted claim split from the doc so the index can surface what a third party backs.
|
|
332
|
+
*/
|
|
333
|
+
export declare function toRegistryEntry(card: AgentCard, facts: AgentFacts): RegistryEntry;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @atlasauth/pca-agentcard — signed agent card + AgentFacts attestor for PCA.
|
|
4
|
+
*
|
|
5
|
+
* ┌──────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ The fix for the spoofable self-declared agent card: PCA becomes the THIRD-PARTY ATTESTOR whose │
|
|
7
|
+
* │ card + AgentFacts point at LIVE, VERIFIABLE proof-of-authority instead of a self-assertion. │
|
|
8
|
+
* └──────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
9
|
+
*
|
|
10
|
+
* The agent-discovery world today has two surfaces that both separate "what an agent says about
|
|
11
|
+
* itself" from "what a third party will vouch for":
|
|
12
|
+
*
|
|
13
|
+
* • A2A 1.0 Agent Cards (`/.well-known/agent-card.json`) carry an `AgentCardSignature` — a JWS over
|
|
14
|
+
* the canonicalized card — so a consumer can tell a signed card from an unsigned, forgeable one.
|
|
15
|
+
* • NANDA AgentFacts is a metadata document that explicitly splits SELF-ASSERTED claims from
|
|
16
|
+
* third-party ATTESTATIONS (each a signed statement by a named attestor, with a validity window).
|
|
17
|
+
*
|
|
18
|
+
* Both schemes answer "is this card authentic?" — they do NOT answer "does this agent actually hold
|
|
19
|
+
* the authority it advertises?". That is exactly PCA's job. This package makes PCA the third-party
|
|
20
|
+
* attestor: it signs the agent's AgentFacts attestation block, and it builds a signed Agent Card whose
|
|
21
|
+
* metadata points at the agent's PCA passport AND a live proof-verification endpoint, so a relying party
|
|
22
|
+
* resolves verifiable proof-of-authority (a PCActn) instead of trusting the card's word.
|
|
23
|
+
*
|
|
24
|
+
* WIRE COMPATIBILITY. The Signed-Agent-Card surface here is byte-identical to the one in
|
|
25
|
+
* `@atlasauth/pca-a2a` (A2A 1.0 `AgentCardSignature`): the SAME canonical signing bytes (the card minus
|
|
26
|
+
* its `signatures`), the SAME detached-payload JWS (`b64:false`, `crit:['b64']`), the SAME `pca_passport`
|
|
27
|
+
* protected-header commitment, and the SAME `signatures[]` shape. A card issued here verifies under
|
|
28
|
+
* `@atlasauth/pca-a2a`'s `verifyAgentCard` and vice-versa — this module does not define a divergent
|
|
29
|
+
* scheme, it hosts the A2A card signer and layers AgentFacts + the attestor + the well-known hosting on
|
|
30
|
+
* top. (It builds only on `@atlasauth/pca` and `jose`, the same two primitives that card signer uses.)
|
|
31
|
+
*
|
|
32
|
+
* Everything here FAILS CLOSED: a missing signature, an unresolvable key, a tampered body, a bad/expired
|
|
33
|
+
* attestation, or an attestation about a different subject is rejected — never silently trusted.
|
|
34
|
+
*/
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WELL_KNOWN_AGENT_FACTS_PATH = exports.WELL_KNOWN_AGENT_CARD_PATH = exports.PCA_ATTESTOR_ID = exports.AGENT_FACTS_CONTEXT = exports.DEFAULT_ALG = void 0;
|
|
37
|
+
exports.buildAgentCard = buildAgentCard;
|
|
38
|
+
exports.issueSignedAgentCard = issueSignedAgentCard;
|
|
39
|
+
exports.verifyAgentCard = verifyAgentCard;
|
|
40
|
+
exports.issueAgentFacts = issueAgentFacts;
|
|
41
|
+
exports.addAttestation = addAttestation;
|
|
42
|
+
exports.verifyAgentFacts = verifyAgentFacts;
|
|
43
|
+
exports.agentCardHandler = agentCardHandler;
|
|
44
|
+
exports.agentFactsHandler = agentFactsHandler;
|
|
45
|
+
exports.toRegistryEntry = toRegistryEntry;
|
|
46
|
+
const pca_1 = require("@atlasauth/pca");
|
|
47
|
+
const jose_1 = require("jose");
|
|
48
|
+
/** Default JWS algorithm for card + attestation signatures. */
|
|
49
|
+
exports.DEFAULT_ALG = 'EdDSA';
|
|
50
|
+
function isJwk(k) {
|
|
51
|
+
return typeof k === 'object' && k !== null && !(k instanceof Uint8Array) && 'kty' in k;
|
|
52
|
+
}
|
|
53
|
+
/** Produce a detached-payload JWS over `payload` (the canonical bytes of the signed object). */
|
|
54
|
+
async function signDetached(payload, signingKey, opts) {
|
|
55
|
+
const alg = opts.alg ?? exports.DEFAULT_ALG;
|
|
56
|
+
const key = isJwk(signingKey) ? await (0, jose_1.importJWK)(signingKey, alg) : signingKey;
|
|
57
|
+
const protectedHeader = {
|
|
58
|
+
alg,
|
|
59
|
+
b64: false,
|
|
60
|
+
crit: ['b64'],
|
|
61
|
+
...(opts.kid !== undefined ? { kid: opts.kid } : {}),
|
|
62
|
+
...(opts.header ?? {}),
|
|
63
|
+
};
|
|
64
|
+
const jws = await new jose_1.FlattenedSign(payload).setProtectedHeader(protectedHeader).sign(key);
|
|
65
|
+
if (jws.protected === undefined) {
|
|
66
|
+
throw new Error('signDetached: produced JWS is missing its protected header');
|
|
67
|
+
}
|
|
68
|
+
return { protected: jws.protected, signature: jws.signature };
|
|
69
|
+
}
|
|
70
|
+
async function resolveVerifyKey(opts) {
|
|
71
|
+
try {
|
|
72
|
+
if (opts.jwks)
|
|
73
|
+
return { resolver: (0, jose_1.createLocalJWKSet)(opts.jwks) };
|
|
74
|
+
if (opts.key !== undefined) {
|
|
75
|
+
return { resolver: isJwk(opts.key) ? await (0, jose_1.importJWK)(opts.key, opts.alg ?? exports.DEFAULT_ALG) : opts.key };
|
|
76
|
+
}
|
|
77
|
+
return { error: 'no verification key or JWKS supplied' };
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
return { error: `could not resolve verification key: ${e.message}` };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** Verify a detached-payload JWS over `payload`. Never throws; returns a fail-closed result. */
|
|
84
|
+
async function verifyDetached(payload, sig, resolver) {
|
|
85
|
+
if (typeof sig.protected !== 'string' || typeof sig.signature !== 'string') {
|
|
86
|
+
return { ok: false, reason: 'signature is malformed' };
|
|
87
|
+
}
|
|
88
|
+
const input = { protected: sig.protected, payload, signature: sig.signature };
|
|
89
|
+
try {
|
|
90
|
+
// Split so each branch binds a single flattenedVerify overload (key-resolver vs. concrete key).
|
|
91
|
+
const verified = typeof resolver === 'function'
|
|
92
|
+
? await (0, jose_1.flattenedVerify)(input, resolver)
|
|
93
|
+
: await (0, jose_1.flattenedVerify)(input, resolver);
|
|
94
|
+
return { ok: true, protectedHeader: verified.protectedHeader ?? {} };
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
return { ok: false, reason: e.message };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const PCA_PASSPORT_HEADER = 'pca_passport';
|
|
101
|
+
function passportRefFrom(p, uri) {
|
|
102
|
+
if ('model_id' in p)
|
|
103
|
+
return { id: p.id, ...(uri !== undefined ? { uri } : {}) };
|
|
104
|
+
return { id: p.id, ...(p.uri !== undefined ? { uri: p.uri } : uri !== undefined ? { uri } : {}) };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Build an (unsigned) A2A Agent Card from a PCA passport. The card's metadata points at the PCA passport
|
|
108
|
+
* (`pcaPassport`) and, when given, the live proof-verification endpoint (`pcaProof`) — so once signed it
|
|
109
|
+
* is a pointer at verifiable authority rather than a self-declaration. Sign it with {@link issueSignedAgentCard}.
|
|
110
|
+
*/
|
|
111
|
+
function buildAgentCard(passport, opts) {
|
|
112
|
+
const card = {
|
|
113
|
+
name: opts.name,
|
|
114
|
+
...(opts.description !== undefined ? { description: opts.description } : {}),
|
|
115
|
+
...(opts.url !== undefined ? { url: opts.url } : {}),
|
|
116
|
+
...(opts.version !== undefined ? { version: opts.version } : {}),
|
|
117
|
+
...(opts.skills !== undefined ? { skills: opts.skills } : {}),
|
|
118
|
+
pcaPassport: passportRefFrom(passport, opts.passportUri),
|
|
119
|
+
...(opts.pcaProofRef !== undefined ? { pcaProof: opts.pcaProofRef } : {}),
|
|
120
|
+
};
|
|
121
|
+
return card;
|
|
122
|
+
}
|
|
123
|
+
/** The canonical bytes a card signature covers: the card with `signatures` removed (everything else kept). */
|
|
124
|
+
function cardSigningBytes(card) {
|
|
125
|
+
const { signatures: _signatures, ...rest } = card;
|
|
126
|
+
void _signatures;
|
|
127
|
+
return (0, pca_1.canonicalBytes)(rest);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Sign an A2A Agent Card. Ensures a PCA passport reference is embedded (`pcaPassport`) and committed in
|
|
131
|
+
* the JWS protected header (`pca_passport`), then signs the canonicalized card (minus `signatures`) and
|
|
132
|
+
* appends the detached-payload `AgentCardSignature`. Wire-identical to `@atlasauth/pca-a2a`.
|
|
133
|
+
*/
|
|
134
|
+
async function issueSignedAgentCard(card, signingKey, opts = {}) {
|
|
135
|
+
const passport = opts.passport
|
|
136
|
+
? {
|
|
137
|
+
id: opts.passport.id,
|
|
138
|
+
...('uri' in opts.passport && opts.passport.uri !== undefined ? { uri: opts.passport.uri } : {}),
|
|
139
|
+
}
|
|
140
|
+
: card.pcaPassport;
|
|
141
|
+
// Embed the passport reference BEFORE signing so the signature covers it.
|
|
142
|
+
const toSign = { ...card, ...(passport ? { pcaPassport: passport } : {}) };
|
|
143
|
+
const payload = cardSigningBytes(toSign);
|
|
144
|
+
const signature = await signDetached(payload, signingKey, {
|
|
145
|
+
...(opts.alg !== undefined ? { alg: opts.alg } : {}),
|
|
146
|
+
...(opts.kid !== undefined ? { kid: opts.kid } : {}),
|
|
147
|
+
...(passport ? { header: { [PCA_PASSPORT_HEADER]: passport.id } } : {}),
|
|
148
|
+
});
|
|
149
|
+
const existing = toSign.signatures ?? [];
|
|
150
|
+
return { ...toSign, signatures: [...existing, signature] };
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Validate an A2A Agent Card against its `AgentCardSignature`(s). Fail-closed: a card with no signatures,
|
|
154
|
+
* an unresolvable key, or ANY signature that does not verify over the canonicalized card (minus
|
|
155
|
+
* `signatures`) is rejected. On success, returns the PCA passport id the signature commits to plus the
|
|
156
|
+
* live proof pointer, so a caller can resolve + check them against a `PassportRegistry` / verify endpoint.
|
|
157
|
+
*/
|
|
158
|
+
async function verifyAgentCard(card, opts) {
|
|
159
|
+
const signatures = card.signatures;
|
|
160
|
+
if (!Array.isArray(signatures) || signatures.length === 0) {
|
|
161
|
+
return { ok: false, reason: 'agent card carries no signatures' };
|
|
162
|
+
}
|
|
163
|
+
const resolved = await resolveVerifyKey(opts);
|
|
164
|
+
if ('error' in resolved)
|
|
165
|
+
return { ok: false, reason: resolved.error };
|
|
166
|
+
const payload = cardSigningBytes(card);
|
|
167
|
+
let passportRef;
|
|
168
|
+
for (let i = 0; i < signatures.length; i++) {
|
|
169
|
+
const sig = signatures[i];
|
|
170
|
+
if (!sig)
|
|
171
|
+
return { ok: false, reason: `signature ${i} is missing` };
|
|
172
|
+
const res = await verifyDetached(payload, sig, resolved.resolver);
|
|
173
|
+
if (!res.ok)
|
|
174
|
+
return { ok: false, reason: `signature ${i} did not verify: ${res.reason}` };
|
|
175
|
+
const ref = res.protectedHeader[PCA_PASSPORT_HEADER];
|
|
176
|
+
if (typeof ref === 'string' && passportRef === undefined)
|
|
177
|
+
passportRef = ref;
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
ok: true,
|
|
181
|
+
...(passportRef !== undefined ? { passportRef } : {}),
|
|
182
|
+
...(card.pcaPassport ? { passport: card.pcaPassport } : {}),
|
|
183
|
+
...(card.pcaProof ? { pcaProof: card.pcaProof } : {}),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
// ===================================================================================================
|
|
187
|
+
// 2. AgentFacts — self-asserted vs third-party-attested claims (PCA is the attestor)
|
|
188
|
+
// ===================================================================================================
|
|
189
|
+
/**
|
|
190
|
+
* JSON-LD contexts for an AgentFacts document. The DID context plus the AgentFacts vocabulary (the second
|
|
191
|
+
* entry is a placeholder for the canonical NANDA AgentFacts context URL — replace before production).
|
|
192
|
+
*/
|
|
193
|
+
exports.AGENT_FACTS_CONTEXT = [
|
|
194
|
+
'https://www.w3.org/ns/did/v1',
|
|
195
|
+
'https://nanda.ai/agentfacts/v1',
|
|
196
|
+
];
|
|
197
|
+
/** The canonical statement bytes an AgentFacts attestation signature covers (everything but the sig). */
|
|
198
|
+
function attestationStatementBytes(a) {
|
|
199
|
+
return (0, pca_1.canonicalBytes)({
|
|
200
|
+
d: 'atlas-pca/agentfacts/attestation/v1',
|
|
201
|
+
issuer: a.issuer,
|
|
202
|
+
subject: a.subject,
|
|
203
|
+
attests: a.attests,
|
|
204
|
+
validFrom: a.validFrom,
|
|
205
|
+
validUntil: a.validUntil ?? null,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/** Default attestor identity used when PCA signs an AgentFacts attestation. */
|
|
209
|
+
exports.PCA_ATTESTOR_ID = 'did:atlas:pca-attestor';
|
|
210
|
+
/** Sign one attestation statement with the attestor key (shared by issue + add). */
|
|
211
|
+
async function signAttestation(statement, key, opts) {
|
|
212
|
+
const signature = await signDetached(attestationStatementBytes(statement), key, {
|
|
213
|
+
...(opts.alg !== undefined ? { alg: opts.alg } : {}),
|
|
214
|
+
...(opts.kid !== undefined ? { kid: opts.kid } : {}),
|
|
215
|
+
header: { attestor: statement.issuer },
|
|
216
|
+
});
|
|
217
|
+
return { ...statement, signature };
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Issue an AgentFacts document for a PCA passport, with PCA as the THIRD-PARTY ATTESTOR. The agent's own
|
|
221
|
+
* `selfAsserted` claims are carried verbatim and left unsigned; the `attests` claims are wrapped in a
|
|
222
|
+
* statement (issuer + subject + validity) and signed with `attestorKey`. A verifier can then tell exactly
|
|
223
|
+
* which claims a named third party vouches for. The resulting doc is served at `/.well-known/agent-facts.json`.
|
|
224
|
+
*/
|
|
225
|
+
async function issueAgentFacts(passport, opts) {
|
|
226
|
+
const agentId = opts.agentId ?? passport.id;
|
|
227
|
+
const validFrom = opts.validFrom ?? new Date(opts.now ?? Date.now()).toISOString();
|
|
228
|
+
const statement = {
|
|
229
|
+
issuer: opts.attestorId ?? exports.PCA_ATTESTOR_ID,
|
|
230
|
+
subject: agentId,
|
|
231
|
+
attests: opts.attests,
|
|
232
|
+
validFrom,
|
|
233
|
+
...(opts.validUntil !== undefined ? { validUntil: opts.validUntil } : {}),
|
|
234
|
+
};
|
|
235
|
+
const attestation = await signAttestation(statement, opts.attestorKey, {
|
|
236
|
+
...(opts.alg !== undefined ? { alg: opts.alg } : {}),
|
|
237
|
+
...(opts.kid !== undefined ? { kid: opts.kid } : {}),
|
|
238
|
+
});
|
|
239
|
+
return {
|
|
240
|
+
'@context': opts.context ?? exports.AGENT_FACTS_CONTEXT,
|
|
241
|
+
id: agentId,
|
|
242
|
+
type: 'AgentFacts',
|
|
243
|
+
selfAsserted: opts.selfAsserted ?? {},
|
|
244
|
+
attestations: [attestation],
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Append another third-party attestation to an existing AgentFacts doc (returns a copy; input unmutated).
|
|
249
|
+
* Lets several independent attestors each vouch for a different subset of claims.
|
|
250
|
+
*/
|
|
251
|
+
async function addAttestation(facts, opts) {
|
|
252
|
+
const validFrom = opts.validFrom ?? new Date(opts.now ?? Date.now()).toISOString();
|
|
253
|
+
const statement = {
|
|
254
|
+
issuer: opts.attestorId ?? exports.PCA_ATTESTOR_ID,
|
|
255
|
+
subject: facts.id,
|
|
256
|
+
attests: opts.attests,
|
|
257
|
+
validFrom,
|
|
258
|
+
...(opts.validUntil !== undefined ? { validUntil: opts.validUntil } : {}),
|
|
259
|
+
};
|
|
260
|
+
const attestation = await signAttestation(statement, opts.attestorKey, {
|
|
261
|
+
...(opts.alg !== undefined ? { alg: opts.alg } : {}),
|
|
262
|
+
...(opts.kid !== undefined ? { kid: opts.kid } : {}),
|
|
263
|
+
});
|
|
264
|
+
return { ...facts, attestations: [...facts.attestations, attestation] };
|
|
265
|
+
}
|
|
266
|
+
function isPlainObject(v) {
|
|
267
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Verify an AgentFacts document. Fail-closed throughout:
|
|
271
|
+
* • an attestation whose `subject` is not this doc's `id` is rejected;
|
|
272
|
+
* • an attestation outside its validity window (or with a malformed window) is rejected;
|
|
273
|
+
* • an attestation whose detached JWS does not verify under the supplied key/JWKS is rejected;
|
|
274
|
+
* • if ANY present attestation fails, the whole document verification returns `ok:false`.
|
|
275
|
+
* On success, the result marks which claims are third-party ATTESTED and which are merely SELF-ASSERTED
|
|
276
|
+
* (flagged, never promoted). A doc with zero attestations verifies, but attests nothing.
|
|
277
|
+
*/
|
|
278
|
+
async function verifyAgentFacts(facts, opts) {
|
|
279
|
+
const selfAsserted = isPlainObject(facts.selfAsserted) ? facts.selfAsserted : {};
|
|
280
|
+
const now = opts.now ?? Date.now();
|
|
281
|
+
const base = {
|
|
282
|
+
ok: false,
|
|
283
|
+
agentId: facts.id,
|
|
284
|
+
attestations: [],
|
|
285
|
+
attested: {},
|
|
286
|
+
selfAsserted,
|
|
287
|
+
claims: {},
|
|
288
|
+
};
|
|
289
|
+
const list = facts.attestations;
|
|
290
|
+
if (!Array.isArray(list)) {
|
|
291
|
+
return { ...base, reason: 'agent facts has no attestations array' };
|
|
292
|
+
}
|
|
293
|
+
// Resolve the key once, but only insist on one when there is an attestation to verify.
|
|
294
|
+
let resolver;
|
|
295
|
+
if (list.length > 0) {
|
|
296
|
+
const resolved = await resolveVerifyKey(opts);
|
|
297
|
+
if ('error' in resolved) {
|
|
298
|
+
return { ...base, reason: resolved.error, attestations: list.map(mkMissingCheck) };
|
|
299
|
+
}
|
|
300
|
+
resolver = resolved.resolver;
|
|
301
|
+
}
|
|
302
|
+
const checks = [];
|
|
303
|
+
const attested = {};
|
|
304
|
+
let allOk = true;
|
|
305
|
+
for (const a of list) {
|
|
306
|
+
const check = await verifyOneAttestation(a, facts.id, now, resolver);
|
|
307
|
+
checks.push(check);
|
|
308
|
+
if (!check.ok) {
|
|
309
|
+
allOk = false;
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
if (check.attests)
|
|
313
|
+
for (const [k, v] of Object.entries(check.attests))
|
|
314
|
+
attested[k] = v;
|
|
315
|
+
}
|
|
316
|
+
const claims = {};
|
|
317
|
+
for (const k of Object.keys(selfAsserted))
|
|
318
|
+
claims[k] = 'self-asserted';
|
|
319
|
+
for (const k of Object.keys(attested))
|
|
320
|
+
claims[k] = 'attested'; // attested wins on overlap
|
|
321
|
+
return {
|
|
322
|
+
ok: allOk,
|
|
323
|
+
...(allOk ? {} : { reason: 'one or more attestations did not verify' }),
|
|
324
|
+
agentId: facts.id,
|
|
325
|
+
attestations: checks,
|
|
326
|
+
attested,
|
|
327
|
+
selfAsserted,
|
|
328
|
+
claims,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function mkMissingCheck(a) {
|
|
332
|
+
const issuer = a && typeof a.issuer === 'string' ? a.issuer : '<unknown>';
|
|
333
|
+
return { issuer, ok: false, reason: 'no verification key or JWKS supplied' };
|
|
334
|
+
}
|
|
335
|
+
async function verifyOneAttestation(a, docId, now, resolver) {
|
|
336
|
+
const issuer = a && typeof a.issuer === 'string' ? a.issuer : '<unknown>';
|
|
337
|
+
if (!a || typeof a.subject !== 'string' || !isPlainObject(a.attests) || typeof a.validFrom !== 'string') {
|
|
338
|
+
return { issuer, ok: false, reason: 'attestation is malformed' };
|
|
339
|
+
}
|
|
340
|
+
if (a.subject !== docId) {
|
|
341
|
+
return { issuer, ok: false, reason: `attestation subject '${a.subject}' does not match agent id '${docId}'` };
|
|
342
|
+
}
|
|
343
|
+
const from = Date.parse(a.validFrom);
|
|
344
|
+
if (!Number.isFinite(from))
|
|
345
|
+
return { issuer, ok: false, reason: 'attestation validFrom is not a valid date' };
|
|
346
|
+
if (now < from)
|
|
347
|
+
return { issuer, ok: false, reason: 'attestation is not yet valid' };
|
|
348
|
+
if (a.validUntil !== undefined) {
|
|
349
|
+
const until = Date.parse(a.validUntil);
|
|
350
|
+
if (!Number.isFinite(until))
|
|
351
|
+
return { issuer, ok: false, reason: 'attestation validUntil is not a valid date' };
|
|
352
|
+
if (now > until)
|
|
353
|
+
return { issuer, ok: false, reason: 'attestation has expired' };
|
|
354
|
+
}
|
|
355
|
+
if (!resolver)
|
|
356
|
+
return { issuer, ok: false, reason: 'no verification key or JWKS supplied' };
|
|
357
|
+
const statement = {
|
|
358
|
+
issuer: a.issuer,
|
|
359
|
+
subject: a.subject,
|
|
360
|
+
attests: a.attests,
|
|
361
|
+
validFrom: a.validFrom,
|
|
362
|
+
...(a.validUntil !== undefined ? { validUntil: a.validUntil } : {}),
|
|
363
|
+
};
|
|
364
|
+
const res = await verifyDetached(attestationStatementBytes(statement), a.signature, resolver);
|
|
365
|
+
if (!res.ok)
|
|
366
|
+
return { issuer, ok: false, reason: `signature did not verify: ${res.reason}` };
|
|
367
|
+
return { issuer, ok: true, attests: a.attests };
|
|
368
|
+
}
|
|
369
|
+
// ===================================================================================================
|
|
370
|
+
// 3. Well-known hosting layer (framework-agnostic)
|
|
371
|
+
// ===================================================================================================
|
|
372
|
+
/** The A2A well-known path a signed Agent Card is served at. */
|
|
373
|
+
exports.WELL_KNOWN_AGENT_CARD_PATH = '/.well-known/agent-card.json';
|
|
374
|
+
/** The well-known path an AgentFacts document is served at. */
|
|
375
|
+
exports.WELL_KNOWN_AGENT_FACTS_PATH = '/.well-known/agent-facts.json';
|
|
376
|
+
function jsonResponse(value) {
|
|
377
|
+
return {
|
|
378
|
+
status: 200,
|
|
379
|
+
headers: { 'content-type': 'application/json', 'cache-control': 'no-store' },
|
|
380
|
+
body: JSON.stringify(value),
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
function normalizePath(path) {
|
|
384
|
+
const q = path.indexOf('?');
|
|
385
|
+
const noQuery = q === -1 ? path : path.slice(0, q);
|
|
386
|
+
// Drop a single trailing slash (but keep the root "/").
|
|
387
|
+
return noQuery.length > 1 && noQuery.endsWith('/') ? noQuery.slice(0, -1) : noQuery;
|
|
388
|
+
}
|
|
389
|
+
/** Serve a signed Agent Card at {@link WELL_KNOWN_AGENT_CARD_PATH}; `undefined` for any other path. */
|
|
390
|
+
function agentCardHandler(card, path = exports.WELL_KNOWN_AGENT_CARD_PATH) {
|
|
391
|
+
const target = normalizePath(path);
|
|
392
|
+
const response = jsonResponse(card);
|
|
393
|
+
return (reqPath) => normalizePath(reqPath) === target ? response : undefined;
|
|
394
|
+
}
|
|
395
|
+
/** Serve an AgentFacts document at {@link WELL_KNOWN_AGENT_FACTS_PATH}; `undefined` for any other path. */
|
|
396
|
+
function agentFactsHandler(facts, path = exports.WELL_KNOWN_AGENT_FACTS_PATH) {
|
|
397
|
+
const target = normalizePath(path);
|
|
398
|
+
const response = jsonResponse(facts);
|
|
399
|
+
return (reqPath) => normalizePath(reqPath) === target ? response : undefined;
|
|
400
|
+
}
|
|
401
|
+
function wellKnownUrlFrom(serviceUrl, path) {
|
|
402
|
+
if (serviceUrl === undefined)
|
|
403
|
+
return undefined;
|
|
404
|
+
try {
|
|
405
|
+
return new URL(path, serviceUrl).toString();
|
|
406
|
+
}
|
|
407
|
+
catch {
|
|
408
|
+
return undefined;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Shape a {@link RegistryEntry} from a signed card + an AgentFacts doc for submission to an A2A registry /
|
|
413
|
+
* NANDA index. Purely structural: it does NOT re-verify (a registry re-verifies on ingest) — it derives
|
|
414
|
+
* the attested-vs-self-asserted claim split from the doc so the index can surface what a third party backs.
|
|
415
|
+
*/
|
|
416
|
+
function toRegistryEntry(card, facts) {
|
|
417
|
+
const attestedSet = new Set();
|
|
418
|
+
for (const a of facts.attestations ?? []) {
|
|
419
|
+
if (a && isPlainObject(a.attests))
|
|
420
|
+
for (const k of Object.keys(a.attests))
|
|
421
|
+
attestedSet.add(k);
|
|
422
|
+
}
|
|
423
|
+
const selfAssertedOnly = Object.keys(isPlainObject(facts.selfAsserted) ? facts.selfAsserted : {}).filter((k) => !attestedSet.has(k));
|
|
424
|
+
const agentCardUrl = wellKnownUrlFrom(card.url, exports.WELL_KNOWN_AGENT_CARD_PATH);
|
|
425
|
+
return {
|
|
426
|
+
id: facts.id,
|
|
427
|
+
name: card.name,
|
|
428
|
+
...(card.url !== undefined ? { url: card.url } : {}),
|
|
429
|
+
...(card.version !== undefined ? { version: card.version } : {}),
|
|
430
|
+
...(card.skills !== undefined ? { skills: card.skills } : {}),
|
|
431
|
+
...(card.pcaPassport ? { passport: card.pcaPassport } : {}),
|
|
432
|
+
...(card.pcaProof ? { pcaProof: card.pcaProof } : {}),
|
|
433
|
+
card,
|
|
434
|
+
...(agentCardUrl !== undefined ? { agentCardUrl } : {}),
|
|
435
|
+
facts,
|
|
436
|
+
attestedClaims: [...attestedSet],
|
|
437
|
+
selfAssertedClaims: selfAssertedOnly,
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;AA2MH,wCAWC;AAuBD,oDAwBC;AAoBD,0CA8BC;AA+GD,0CAwBC;AAiBD,wCAcC;AA+CD,4CA0DC;AAkFD,4CAKC;AAGD,8CAKC;AAgDD,0CAwBC;AA3uBD,wCAAoE;AACpE,+BASc;AAWd,+DAA+D;AAClD,QAAA,WAAW,GAAG,OAAgB,CAAC;AAa5C,SAAS,KAAK,CAAC,CAAiB;IAC9B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,UAAU,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACzF,CAAC;AASD,gGAAgG;AAChG,KAAK,UAAU,YAAY,CACzB,OAAmB,EACnB,UAAwB,EACxB,IAAyB;IAEzB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,mBAAW,CAAC;IACpC,MAAM,GAAG,GAAyB,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,IAAA,gBAAS,EAAC,UA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EAAE,CAAC,GAAG,WAAW,CAAC;QAChC,kBAAkB,EAAE,gBAAgB;KACrC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/pca-agentcard",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Signed agent card + AgentFacts attestor for PCA: issue/host a /.well-known/agent-card.json (A2A AgentCardSignature) and an AgentFacts metadata doc where PCA is the THIRD-PARTY attestor (separating self-asserted from attested), pointing to live verifiable proof-of-authority.",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"jose": "^5.9.6",
|
|
16
|
+
"@atlasauth/pca": "0.1.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "^5.6.3",
|
|
20
|
+
"vitest": "^2.1.4"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p tsconfig.build.json",
|
|
31
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
32
|
+
"test": "vitest run"
|
|
33
|
+
}
|
|
6
34
|
}
|
package/README.md
DELETED