@atlasauth/pca-a2a 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/package.json +27 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Atlas Authorization
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # @atlasauth/pca-a2a
2
+
3
+ A2A (Agent2Agent) adapter for Proof-Carrying Authority (PCA). A2A defines how agents discover each other and exchange tasks; it does not prove that a relayed request is authorized by the principal behind it. This package binds PCA proofs onto three A2A surfaces, failing closed throughout:
4
+
5
+ 1. **Proof-carrying tasks** - attach a PCActn (a signed single-action proof with its capability chain) to a Task or Message under a namespaced `metadata` key, and verify it on receipt.
6
+ 2. **Signed Agent Cards** - issue and validate an A2A `AgentCardSignature` (a detached JWS, via `jose`) whose protected header commits to the agent's PCA passport id.
7
+ 3. **AP2 payment profile** - map a PCActn to an AP2-shaped Payment Mandate that carries its authority by reference to the proof.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm i @atlasauth/pca-a2a
13
+ ```
14
+
15
+ Depends on `@atlasauth/pca` and `jose` (installed transitively). For the full AP2 Intent/Cart/Payment chain and settlement hooks, see `@atlasauth/pca-ap2`.
16
+
17
+ ## Usage
18
+
19
+ ```ts
20
+ import { buildPCActn } from '@atlasauth/pca';
21
+ import {
22
+ attachPcaToA2ATask, pcaA2AMiddleware,
23
+ issueSignedAgentCard, verifyAgentCard,
24
+ a2aPaymentMandateFromPca, verifyA2APaymentMandate,
25
+ } from '@atlasauth/pca-a2a';
26
+
27
+ // Sender: build a PCActn with @atlasauth/pca, then ride it on the task.
28
+ const pcActn = buildPCActn({ grant, chain: [grant], plan, nodeId: 'buy-1', counter: 1,
29
+ signerSecret: agentSecret, aud: 'my-rs' });
30
+ const task = attachPcaToA2ATask({ id: 't1', status: { state: 'submitted' } }, pcActn);
31
+
32
+ // Receiver: guard incoming tasks. Pin the principal you trust.
33
+ const guard = pcaA2AMiddleware({ aud: 'my-rs', expectedRootIssuer: principalPublicKey });
34
+ const verdict = await guard(task); // { ok: true, result, pcActn } | { ok: false, reason }
35
+
36
+ // Signed Agent Card (key is a jose KeyLike, Uint8Array or JWK).
37
+ const card = await issueSignedAgentCard({ name: 'Buyer', url: 'https://a.example' }, privateKey,
38
+ { passport: { id: 'pp_1' } });
39
+ await verifyAgentCard(card, { key: publicKey }); // { ok: true, passportRef: 'pp_1', ... }
40
+
41
+ // Payment mandate that points at the PCActn.
42
+ const mandate = a2aPaymentMandateFromPca(pcActn, {
43
+ amount: { currency: 'USD', value: 120 }, paymentMethod: { type: 'card' }, merchant: 'acme',
44
+ });
45
+ await verifyA2APaymentMandate(mandate, pcActn, { aud: 'my-rs', expectedRootIssuer: principalPublicKey });
46
+ ```
47
+
48
+ By default a guard requires a proof (`require: true`); with `require: false` a task without a proof passes, but a proof that is present and invalid is still rejected. Always pin `expectedRootIssuer` (or `grant`): otherwise the chain root is taken from the proof itself and only proves internal consistency, not that a principal you trust issued it.
49
+
50
+ ## API
51
+
52
+ - Tasks: `attachPcaToA2ATask`, `attachPcaToA2AMessage`, `extractPca`, `extractPcaFromMessage`, `verifyA2ATask`, `pcaA2AMiddleware`, `PCA_A2A_EXTENSION_URI`.
53
+ - Agent Cards: `issueSignedAgentCard`, `verifyAgentCard` (verify with a single `key` or a `jwks`).
54
+ - Payments: `a2aPaymentMandateFromPca`, `pcaBindingFromA2APaymentMandate`, `verifyA2APaymentMandate`, `A2A_AP2_CONTEXT`.
55
+
56
+ ## Status
57
+
58
+ Experimental. The A2A object model here is structural and permissive, not a full A2A SDK. The Payment Mandate shape follows the AP2 vocabulary but its JSON-LD context is a placeholder and PCA-specific fields live in a non-standard `x_pca` extension; validate against the official AP2 schemas before production use. The cryptography is unaudited.
59
+
60
+ Source and issues: https://github.com/Atlas-Authorization/pca
61
+
62
+ ## License
63
+
64
+ MIT - see LICENSE
package/package.json CHANGED
@@ -1,7 +1,27 @@
1
1
  {
2
2
  "name": "@atlasauth/pca-a2a",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "A2A (Agent2Agent) adapter for PCA: verify/attach proof-carrying actions on A2A task send/receive, validate Signed Agent Cards, and an AP2 payment-mandate profile.",
5
+ "keywords": [
6
+ "a2a",
7
+ "agent2agent",
8
+ "agent card",
9
+ "ap2",
10
+ "agent authorization",
11
+ "proof-carrying authority",
12
+ "pca",
13
+ "ai agents"
14
+ ],
15
+ "license": "MIT",
16
+ "homepage": "https://github.com/Atlas-Authorization/pca#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/Atlas-Authorization/pca/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Atlas-Authorization/pca.git",
23
+ "directory": "packages/pca-a2a"
24
+ },
5
25
  "main": "./dist/index.js",
6
26
  "types": "./dist/index.d.ts",
7
27
  "exports": {
@@ -13,7 +33,7 @@
13
33
  },
14
34
  "dependencies": {
15
35
  "jose": "^5.9.6",
16
- "@atlasauth/pca": "0.1.0"
36
+ "@atlasauth/pca": "0.3.0"
17
37
  },
18
38
  "devDependencies": {
19
39
  "typescript": "^5.6.3",
@@ -21,8 +41,12 @@
21
41
  },
22
42
  "files": [
23
43
  "dist",
24
- "README.md"
44
+ "README.md",
45
+ "LICENSE"
25
46
  ],
47
+ "engines": {
48
+ "node": ">=20"
49
+ },
26
50
  "publishConfig": {
27
51
  "access": "public"
28
52
  },