atp-sdk 1.0.0 β 1.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/CHANGELOG.md +92 -3
- package/README.md +259 -26
- package/dist/client/atp.d.ts.map +1 -1
- package/dist/client/atp.js +3 -0
- package/dist/client/atp.js.map +1 -1
- package/dist/client/base.d.ts.map +1 -1
- package/dist/client/base.js +5 -3
- package/dist/client/base.js.map +1 -1
- package/dist/client/gateway.js +1 -1
- package/dist/client/gateway.js.map +1 -1
- package/dist/client/payments.d.ts.map +1 -0
- package/dist/client/payments.js +254 -0
- package/dist/client/payments.js.map +1 -0
- package/dist/index.cjs +17 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/monitoring/index.d.ts.map +1 -0
- package/dist/monitoring/index.js +7 -0
- package/dist/monitoring/index.js.map +1 -0
- package/dist/monitoring/universal-monitor.d.ts.map +1 -0
- package/dist/monitoring/universal-monitor.js +278 -0
- package/dist/monitoring/universal-monitor.js.map +1 -0
- package/dist/protocols/base/adapter.d.ts.map +1 -0
- package/dist/protocols/base/adapter.js +77 -0
- package/dist/protocols/base/adapter.js.map +1 -0
- package/dist/protocols/base/detector.d.ts.map +1 -0
- package/dist/protocols/base/detector.js +236 -0
- package/dist/protocols/base/detector.js.map +1 -0
- package/dist/protocols/base/index.d.ts.map +1 -0
- package/dist/protocols/base/index.js +9 -0
- package/dist/protocols/base/index.js.map +1 -0
- package/dist/protocols/base/types.d.ts.map +1 -0
- package/dist/protocols/base/types.js +18 -0
- package/dist/protocols/base/types.js.map +1 -0
- package/dist/protocols/index.d.ts.map +1 -0
- package/dist/protocols/index.js +18 -0
- package/dist/protocols/index.js.map +1 -0
- package/dist/protocols/mcp/index.d.ts.map +1 -0
- package/dist/protocols/mcp/index.js +7 -0
- package/dist/protocols/mcp/index.js.map +1 -0
- package/dist/protocols/mcp/mcp-adapter.d.ts.map +1 -0
- package/dist/protocols/mcp/mcp-adapter.js +165 -0
- package/dist/protocols/mcp/mcp-adapter.js.map +1 -0
- package/dist/simple-agent.d.ts.map +1 -1
- package/dist/simple-agent.js +247 -30
- package/dist/simple-agent.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/crypto.d.ts.map +1 -1
- package/dist/utils/crypto.js +241 -19
- package/dist/utils/crypto.js.map +1 -1
- package/dist/utils/did.js +1 -1
- package/dist/utils/did.js.map +1 -1
- package/dist/utils/trust.d.ts.map +1 -0
- package/dist/utils/trust.js +187 -0
- package/dist/utils/trust.js.map +1 -0
- package/dist/utils/version-manager.d.ts.map +1 -0
- package/dist/utils/version-manager.js +286 -0
- package/dist/utils/version-manager.js.map +1 -0
- package/docs/API-SURFACE.md +42 -0
- package/docs/MIGRATION.md +36 -0
- package/docs/MULTI-PROTOCOL-SUPPORT.md +430 -0
- package/docs/guides/troubleshooting.md +0 -0
- package/examples/00-quickstart-local.js +19 -0
- package/examples/00-quickstart.js +32 -0
- package/examples/08-payment-protocols.js +325 -0
- package/examples/09-multi-protocol-support.js +372 -0
- package/examples/10-monitoring-health.js +142 -0
- package/examples/11-quantum-safe-demo.js +77 -0
- package/examples/HELLO-WORLD.md +36 -0
- package/package.json +21 -11
package/CHANGELOG.md
CHANGED
|
@@ -90,12 +90,101 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
90
90
|
|
|
91
91
|
---
|
|
92
92
|
|
|
93
|
+
## [1.1.0] - 2024-12-20
|
|
94
|
+
|
|
95
|
+
### π Major Release: Quantum-Safe by Default
|
|
96
|
+
|
|
97
|
+
This release makes ATP the first SDK to enable quantum-safe cryptography by default, protecting AI agents from both current threats and future quantum computing attacks.
|
|
98
|
+
|
|
99
|
+
### Added
|
|
100
|
+
|
|
101
|
+
#### Quantum-Safe Cryptography (Default)
|
|
102
|
+
- **Hybrid ML-DSA + Ed25519**: All new agents automatically use hybrid quantum-safe cryptography
|
|
103
|
+
- **ML-DSA (Dilithium Successor)**: NIST-standardized post-quantum signatures enabled by default
|
|
104
|
+
- **Backward Compatible**: Existing Ed25519-only keys continue to work
|
|
105
|
+
- **Zero Configuration**: Quantum-safe keys generated automatically with `Agent.create()`
|
|
106
|
+
|
|
107
|
+
#### Enhanced Agent Class
|
|
108
|
+
- **Simplified API**: `Agent.create()` method for instant agent creation
|
|
109
|
+
- **Quantum-Safe Detection**: `isQuantumSafe()` method to check agent crypto status
|
|
110
|
+
- **Default Security**: All new agents use quantum-safe crypto without extra setup
|
|
111
|
+
|
|
112
|
+
#### Developer Experience
|
|
113
|
+
- **Quick Start Options**: Works immediately without services (basic mode) or with full ATP services
|
|
114
|
+
- **Better Error Messages**: Clear guidance when services aren't running
|
|
115
|
+
- **Local Testing**: `00-quickstart-local.js` for testing without network
|
|
116
|
+
|
|
117
|
+
#### Examples & Documentation
|
|
118
|
+
- **Quantum-Safe Demo**: `examples/11-quantum-safe-demo.js` showcases hybrid crypto
|
|
119
|
+
- **Integration Tests**: `test-integration-quantum-safe.js` for end-to-end validation
|
|
120
|
+
- **Quick Start Guide**: New `/docs/QUICK-START.md` for 30-second onboarding
|
|
121
|
+
- **API Surface Documentation**: Stable API documentation for developers
|
|
122
|
+
|
|
123
|
+
### Changed
|
|
124
|
+
|
|
125
|
+
#### Breaking Changes
|
|
126
|
+
- **None**: This release is fully backward compatible
|
|
127
|
+
|
|
128
|
+
#### Default Behavior
|
|
129
|
+
- **Quantum-Safe Default**: New agents use hybrid ML-DSA + Ed25519 by default
|
|
130
|
+
- **Key Generation**: `CryptoUtils.generateKeyPair()` now generates hybrid keys by default
|
|
131
|
+
- **Package Name**: Consistent `atp-sdk` naming across all documentation
|
|
132
|
+
|
|
133
|
+
### Security
|
|
134
|
+
|
|
135
|
+
- **NIST PQC Standard**: ML-DSA (CRYSTALS-Dilithium successor) implementation
|
|
136
|
+
- **Hybrid Mode**: Combines classical Ed25519 with post-quantum ML-DSA
|
|
137
|
+
- **Future-Proof**: Protection against both current and future quantum attacks
|
|
138
|
+
- **Cryptographic Signatures**: All operations use quantum-safe signatures when available
|
|
139
|
+
|
|
140
|
+
### Performance
|
|
141
|
+
|
|
142
|
+
- **Minimal Overhead**: ~44% overhead compared to Ed25519-only (15ms vs 10ms verification)
|
|
143
|
+
- **Optimized Hybrid Mode**: Efficient combination of classical and post-quantum algorithms
|
|
144
|
+
- **Backward Compatible**: Ed25519-only mode still available for performance-critical use cases
|
|
145
|
+
|
|
146
|
+
### Documentation
|
|
147
|
+
|
|
148
|
+
- **Developer-First**: Restructured README with "Get Started in 30 Seconds"
|
|
149
|
+
- **Quick Start Guide**: Dedicated guide for immediate onboarding
|
|
150
|
+
- **API Reference**: Complete API surface documentation
|
|
151
|
+
- **Migration Guide**: Clear upgrade path from v1.0.0
|
|
152
|
+
|
|
153
|
+
### Fixed
|
|
154
|
+
|
|
155
|
+
- **Audit Service Port**: Corrected default port to 3005 across all documentation
|
|
156
|
+
- **Package Naming**: Unified to `atp-sdk` (unscoped) across all docs
|
|
157
|
+
- **Documentation Links**: Fixed broken links in README and docs
|
|
158
|
+
- **SDK Metadata**: Updated internal package references
|
|
159
|
+
|
|
160
|
+
### Migration from v1.0.0
|
|
161
|
+
|
|
162
|
+
**No changes required!** This release is fully backward compatible. Existing code continues to work.
|
|
163
|
+
|
|
164
|
+
**To enable quantum-safe for new agents:**
|
|
165
|
+
```typescript
|
|
166
|
+
// Old way (still works)
|
|
167
|
+
const agent = new Agent('name');
|
|
168
|
+
await agent.initialize();
|
|
169
|
+
|
|
170
|
+
// New way (quantum-safe by default)
|
|
171
|
+
const agent = await Agent.create('name'); // Quantum-safe automatically!
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**To check quantum-safe status:**
|
|
175
|
+
```typescript
|
|
176
|
+
const agent = await Agent.create('name');
|
|
177
|
+
console.log(agent.isQuantumSafe()); // true
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
93
182
|
## [Unreleased]
|
|
94
183
|
|
|
95
184
|
### Planned Features
|
|
96
|
-
- **v1.
|
|
97
|
-
- **v1.
|
|
98
|
-
- **v1.
|
|
185
|
+
- **v1.2.0**: WebAssembly support for browser environments
|
|
186
|
+
- **v1.3.0**: GraphQL API support and enhanced querying
|
|
187
|
+
- **v1.4.0**: Advanced zero-knowledge proof features
|
|
99
188
|
- **v2.0.0**: ATP Protocol v2 compatibility and new features
|
|
100
189
|
|
|
101
190
|
---
|
package/README.md
CHANGED
|
@@ -1,38 +1,70 @@
|
|
|
1
|
-
#
|
|
1
|
+
# atp-sdk - Agent Trust Protocol SDK
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **The Ecosystem Security Layer for AI Agents** - Official TypeScript SDK for Agent Trust Protocolβ’
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
ATP provides universal quantum-safe security for all AI agent protocols (MCP, Swarm, ADK, A2A, and more). Build secure, verifiable, and trustworthy AI agents in 3 lines of code!
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/atp-sdk)
|
|
6
8
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
7
9
|
[](https://www.typescriptlang.org/)
|
|
10
|
+
[](https://github.com/agent-trust-protocol/core)
|
|
8
11
|
|
|
9
|
-
##
|
|
12
|
+
## β‘ Get Started in 30 Seconds
|
|
10
13
|
|
|
11
14
|
```bash
|
|
12
|
-
npm install
|
|
15
|
+
npm install atp-sdk
|
|
13
16
|
```
|
|
14
17
|
|
|
15
18
|
```typescript
|
|
16
|
-
import { Agent } from '
|
|
19
|
+
import { Agent } from 'atp-sdk';
|
|
20
|
+
|
|
21
|
+
// Option 1: Works immediately (no services needed)
|
|
22
|
+
const agent = await Agent.create('MyBot');
|
|
23
|
+
console.log('DID:', agent.getDID());
|
|
24
|
+
console.log('Quantum-safe:', agent.isQuantumSafe()); // true
|
|
17
25
|
|
|
18
|
-
|
|
19
|
-
await agent.
|
|
20
|
-
|
|
26
|
+
// Option 2: Full features (with ATP services)
|
|
27
|
+
await agent.initialize(); // Connects to ATP network
|
|
28
|
+
await agent.send('did:atp:other', 'Hello!');
|
|
29
|
+
console.log(await agent.getTrustScore('did:atp:other'));
|
|
21
30
|
```
|
|
22
31
|
|
|
23
|
-
That's it
|
|
32
|
+
**That's it!** Your agent now has:
|
|
33
|
+
- β
Quantum-safe cryptography (hybrid Ed25519 + ML-DSA)
|
|
34
|
+
- β
Decentralized Identity (DID)
|
|
35
|
+
- β
Cryptographic signatures
|
|
36
|
+
- β
Trust scoring
|
|
37
|
+
|
|
38
|
+
## π Setup Options
|
|
39
|
+
|
|
40
|
+
### Quick Start (No Services Required)
|
|
41
|
+
Works immediately - perfect for testing and development:
|
|
24
42
|
|
|
25
|
-
|
|
43
|
+
```typescript
|
|
44
|
+
import { Agent } from 'atp-sdk';
|
|
45
|
+
const agent = await Agent.create('MyBot');
|
|
46
|
+
// Ready to use!
|
|
47
|
+
```
|
|
26
48
|
|
|
27
|
-
|
|
49
|
+
### Full Setup (With ATP Services)
|
|
50
|
+
For complete functionality including identity registration, credentials, and permissions:
|
|
28
51
|
|
|
29
52
|
```bash
|
|
30
|
-
#
|
|
31
|
-
|
|
53
|
+
# Start ATP services (one command)
|
|
54
|
+
docker-compose up -d
|
|
55
|
+
|
|
56
|
+
# Or clone and start locally
|
|
57
|
+
git clone https://github.com/agent-trust-protocol/core.git
|
|
32
58
|
cd agent-trust-protocol
|
|
33
59
|
./start-services.sh
|
|
34
60
|
```
|
|
35
61
|
|
|
62
|
+
Then initialize your agent:
|
|
63
|
+
```typescript
|
|
64
|
+
const agent = await Agent.create('MyBot');
|
|
65
|
+
await agent.initialize(); // Connects to ATP services
|
|
66
|
+
```
|
|
67
|
+
|
|
36
68
|
## π Full SDK Documentation
|
|
37
69
|
|
|
38
70
|
For advanced usage, see the complete API documentation below...
|
|
@@ -41,14 +73,53 @@ For advanced usage, see the complete API documentation below...
|
|
|
41
73
|
|
|
42
74
|
- **[Complete Documentation](./docs/README.md)** - Comprehensive guides and API reference
|
|
43
75
|
- **[API Reference](./docs/api/README.md)** - Detailed API documentation
|
|
76
|
+
- **[Public API Surface](./docs/API-SURFACE.md)** - Stable exports for developers
|
|
77
|
+
- **[Migration Guide](./docs/MIGRATION.md)** - Upgrade notes and defaults
|
|
44
78
|
- **[Examples](./examples/README.md)** - Practical examples and use cases
|
|
45
79
|
- **[Configuration Guide](./docs/guides/configuration.md)** - Advanced configuration options
|
|
46
80
|
- **[Authentication Guide](./docs/guides/authentication.md)** - Security and authentication patterns
|
|
47
81
|
- **[Best Practices](./docs/guides/best-practices.md)** - Production-ready guidelines
|
|
48
82
|
- **[Troubleshooting](./docs/guides/troubleshooting.md)** - Common issues and solutions
|
|
49
83
|
|
|
84
|
+
## π‘οΈ ATP: The Ecosystem Security Layer
|
|
85
|
+
|
|
86
|
+
**Agent Trust Protocol (ATP) is the universal security layer for the AI agent ecosystem.**
|
|
87
|
+
|
|
88
|
+
Unlike protocol-specific security solutions, ATP works across all agent protocols:
|
|
89
|
+
- **MCP** (Model Context Protocol) - Anthropic
|
|
90
|
+
- **Swarm** - OpenAI multi-agent orchestration
|
|
91
|
+
- **ADK** (Agent Development Kit) - Google
|
|
92
|
+
- **A2A** (Agent2Agent) - Vendor-neutral protocol
|
|
93
|
+
- **Any custom protocol** - ATP adapts to your needs
|
|
94
|
+
|
|
95
|
+
ATP provides:
|
|
96
|
+
- π **Universal Security**: One security layer for all protocols
|
|
97
|
+
- βοΈ **Quantum-Safe**: Future-proof cryptography (ML-DSA + Ed25519)
|
|
98
|
+
- π― **Trust Management**: Dynamic trust scoring across protocols
|
|
99
|
+
- π **Audit Trail**: Immutable logging for compliance
|
|
100
|
+
- π **Identity**: Decentralized identity (DID) for all agents
|
|
101
|
+
|
|
50
102
|
## β¨ Features
|
|
51
103
|
|
|
104
|
+
### π **Multi-Protocol Support** (NEW in v1.1!)
|
|
105
|
+
- **Universal Security Layer** - Works with MCP, Swarm, ADK, and A2A protocols
|
|
106
|
+
- **Automatic Protocol Detection** - Identifies agent protocol automatically
|
|
107
|
+
- **Unified Monitoring** - Monitor all agents through single interface
|
|
108
|
+
- **Quantum-Safe Security** - Post-quantum cryptography across all protocols
|
|
109
|
+
- **Trust Scoring** - Consistent trust metrics regardless of protocol
|
|
110
|
+
- **Audit Trail** - Immutable logging for all protocol events
|
|
111
|
+
|
|
112
|
+
[Learn more about multi-protocol support β](./docs/MULTI-PROTOCOL-SUPPORT.md)
|
|
113
|
+
|
|
114
|
+
### π³ **Payment Protocols**
|
|
115
|
+
- **Google AP2 Integration** - Agent Payments Protocol with mandate-based authorization
|
|
116
|
+
- **OpenAI ACP Support** - Agentic Commerce Protocol for ChatGPT commerce
|
|
117
|
+
- Intent & Cart Mandates with cryptographic signatures
|
|
118
|
+
- Multi-payment support (cards, crypto, stablecoins, bank transfers)
|
|
119
|
+
- Payment policy enforcement and spending limits
|
|
120
|
+
- Complete audit trail for all transactions
|
|
121
|
+
- Verifiable credentials for payment authorization
|
|
122
|
+
|
|
52
123
|
### π **Identity Management**
|
|
53
124
|
- Generate and manage Decentralized Identifiers (DIDs)
|
|
54
125
|
- Register and resolve identities on the ATP network
|
|
@@ -105,7 +176,7 @@ The ATPβ’ SDK provides a unified interface to multiple microservices:
|
|
|
105
176
|
β β β
|
|
106
177
|
βββββββββΌβββββββββ ββββββββββΌβββββββββ βββββββββΌβββββββββ
|
|
107
178
|
β Identity Serviceβ βCredentials Serviceβ β Audit Service β
|
|
108
|
-
β (Port 3001) β β (Port 3002) β β (Port
|
|
179
|
+
β (Port 3001) β β (Port 3002) β β (Port 3005) β
|
|
109
180
|
βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββ
|
|
110
181
|
β β β
|
|
111
182
|
βββββββββΌβββββββββ ββββββββββΌβββββββββ βββββββββΌβββββββββ
|
|
@@ -126,19 +197,19 @@ The ATPβ’ SDK provides a unified interface to multiple microservices:
|
|
|
126
197
|
|
|
127
198
|
```bash
|
|
128
199
|
# Using npm
|
|
129
|
-
npm install
|
|
200
|
+
npm install atp-sdk
|
|
130
201
|
|
|
131
202
|
# Using yarn
|
|
132
|
-
yarn add
|
|
203
|
+
yarn add atp-sdk
|
|
133
204
|
|
|
134
205
|
# Using pnpm
|
|
135
|
-
pnpm add
|
|
206
|
+
pnpm add atp-sdk
|
|
136
207
|
```
|
|
137
208
|
|
|
138
209
|
### Basic Configuration
|
|
139
210
|
|
|
140
211
|
```javascript
|
|
141
|
-
import { ATPClient, createQuickConfig } from '
|
|
212
|
+
import { ATPClient, createQuickConfig } from 'atp-sdk';
|
|
142
213
|
|
|
143
214
|
// Development (local services)
|
|
144
215
|
const config = createQuickConfig('http://localhost');
|
|
@@ -169,7 +240,7 @@ const client = new ATPClient(config);
|
|
|
169
240
|
### Identity Management
|
|
170
241
|
|
|
171
242
|
```javascript
|
|
172
|
-
import { DIDUtils, CryptoUtils } from '
|
|
243
|
+
import { DIDUtils, CryptoUtils } from 'atp-sdk';
|
|
173
244
|
|
|
174
245
|
// Generate new identity
|
|
175
246
|
const { did, document, keyPair } = await DIDUtils.generateDID({
|
|
@@ -366,6 +437,132 @@ const health = await client.gateway.getStatus();
|
|
|
366
437
|
console.log('Gateway status:', health.data.status);
|
|
367
438
|
```
|
|
368
439
|
|
|
440
|
+
### Payment Protocols (AP2 & ACP)
|
|
441
|
+
|
|
442
|
+
```javascript
|
|
443
|
+
// Google AP2 (Agent Payments Protocol) Integration
|
|
444
|
+
|
|
445
|
+
// 1. Create Intent Mandate (User Authorization)
|
|
446
|
+
const intentMandate = await client.payments.createIntentMandate({
|
|
447
|
+
userDid: 'did:atp:user123',
|
|
448
|
+
agentDid: 'did:atp:shopping-agent',
|
|
449
|
+
purpose: 'Holiday shopping assistant',
|
|
450
|
+
maxAmount: 500.00,
|
|
451
|
+
currency: 'USD',
|
|
452
|
+
expiresAt: new Date('2025-12-31'),
|
|
453
|
+
restrictions: {
|
|
454
|
+
merchants: ['amazon.com', 'etsy.com'],
|
|
455
|
+
categories: ['gifts', 'electronics'],
|
|
456
|
+
dailyLimit: 200.00
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
// 2. Create Cart Mandate (Specific Transaction)
|
|
461
|
+
const cartMandate = await client.payments.createCartMandate({
|
|
462
|
+
intentMandateId: intentMandate.data.id,
|
|
463
|
+
merchant: 'etsy.com',
|
|
464
|
+
items: [
|
|
465
|
+
{ id: 'item-1', name: 'Handmade Mug', quantity: 2, price: 24.99, currency: 'USD' },
|
|
466
|
+
{ id: 'item-2', name: 'Coffee Beans', quantity: 1, price: 18.50, currency: 'USD' }
|
|
467
|
+
],
|
|
468
|
+
total: 68.48,
|
|
469
|
+
currency: 'USD',
|
|
470
|
+
paymentMethod: paymentMethodObject
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
// 3. Execute Payment
|
|
474
|
+
const payment = await client.payments.executeAP2Payment({
|
|
475
|
+
cartMandateId: cartMandate.data.id,
|
|
476
|
+
paymentMethod: paymentMethodObject,
|
|
477
|
+
billingAddress: {
|
|
478
|
+
line1: '123 Main St',
|
|
479
|
+
city: 'San Francisco',
|
|
480
|
+
state: 'CA',
|
|
481
|
+
postalCode: '94102',
|
|
482
|
+
country: 'US'
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
console.log('Payment completed:', payment.data.id);
|
|
487
|
+
console.log('Audit trail events:', payment.data.auditTrail.length);
|
|
488
|
+
|
|
489
|
+
// OpenAI ACP (Agentic Commerce Protocol) Integration
|
|
490
|
+
|
|
491
|
+
// 1. Create Checkout Session
|
|
492
|
+
const checkout = await client.payments.createACPCheckout({
|
|
493
|
+
merchantId: 'merchant-123',
|
|
494
|
+
agentDid: 'did:atp:shopping-agent',
|
|
495
|
+
items: [
|
|
496
|
+
{ productId: 'prod-vintage-lamp', quantity: 1 },
|
|
497
|
+
{ productId: 'prod-art-print', quantity: 2 }
|
|
498
|
+
],
|
|
499
|
+
shippingAddress: {
|
|
500
|
+
line1: '456 Oak Ave',
|
|
501
|
+
city: 'New York',
|
|
502
|
+
state: 'NY',
|
|
503
|
+
postalCode: '10001',
|
|
504
|
+
country: 'US'
|
|
505
|
+
},
|
|
506
|
+
customerEmail: 'customer@example.com'
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
// 2. Complete Checkout
|
|
510
|
+
const result = await client.payments.completeACPCheckout({
|
|
511
|
+
sessionId: checkout.data.id,
|
|
512
|
+
paymentMethodId: 'pm-card-123',
|
|
513
|
+
sharedPaymentToken: 'spt-stripe-abc123'
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
console.log('Transaction ID:', result.data.transactionId);
|
|
517
|
+
console.log('Receipt URL:', result.data.receipt?.url);
|
|
518
|
+
|
|
519
|
+
// Payment Policy Management
|
|
520
|
+
const policy = await client.payments.createPaymentPolicy({
|
|
521
|
+
name: 'Shopping Assistant Limits',
|
|
522
|
+
agentDid: 'did:atp:shopping-agent',
|
|
523
|
+
maxTransactionAmount: 100.00,
|
|
524
|
+
dailyLimit: 250.00,
|
|
525
|
+
monthlyLimit: 1000.00,
|
|
526
|
+
allowedMerchants: ['etsy.com', 'amazon.com'],
|
|
527
|
+
requiresApproval: true,
|
|
528
|
+
notificationThreshold: 50.00
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// Add Payment Methods
|
|
532
|
+
const cardMethod = await client.payments.addPaymentMethod({
|
|
533
|
+
userDid: 'did:atp:user123',
|
|
534
|
+
type: 'card',
|
|
535
|
+
details: {
|
|
536
|
+
last4: '4242',
|
|
537
|
+
brand: 'Visa',
|
|
538
|
+
expiryMonth: 12,
|
|
539
|
+
expiryYear: 2026
|
|
540
|
+
},
|
|
541
|
+
isDefault: true
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
// Crypto/Stablecoin Support
|
|
545
|
+
const cryptoMethod = await client.payments.addPaymentMethod({
|
|
546
|
+
userDid: 'did:atp:user123',
|
|
547
|
+
type: 'stablecoin',
|
|
548
|
+
details: {
|
|
549
|
+
walletAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
|
|
550
|
+
blockchain: 'ethereum',
|
|
551
|
+
tokenSymbol: 'USDC'
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
// Query Transaction History
|
|
556
|
+
const transactions = await client.payments.queryTransactions({
|
|
557
|
+
userDid: 'did:atp:user123',
|
|
558
|
+
startDate: new Date('2025-01-01'),
|
|
559
|
+
endDate: new Date(),
|
|
560
|
+
status: 'completed'
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
console.log('Total transactions:', transactions.data.length);
|
|
564
|
+
```
|
|
565
|
+
|
|
369
566
|
## π οΈ Development
|
|
370
567
|
|
|
371
568
|
### Environment Setup
|
|
@@ -405,7 +602,7 @@ node examples/index.js 3 # Verifiable credentials
|
|
|
405
602
|
The SDK is written in TypeScript and provides comprehensive type definitions:
|
|
406
603
|
|
|
407
604
|
```typescript
|
|
408
|
-
import { ATPClient, ATPConfig, VerifiableCredential } from '
|
|
605
|
+
import { ATPClient, ATPConfig, VerifiableCredential } from 'atp-sdk';
|
|
409
606
|
|
|
410
607
|
const config: ATPConfig = {
|
|
411
608
|
baseUrl: 'http://localhost',
|
|
@@ -446,11 +643,11 @@ npm run test -- --grep "Identity"
|
|
|
446
643
|
### Testing Your Application
|
|
447
644
|
|
|
448
645
|
```javascript
|
|
449
|
-
import { ATPClient } from '
|
|
646
|
+
import { ATPClient } from 'atp-sdk';
|
|
450
647
|
import { jest } from '@jest/globals';
|
|
451
648
|
|
|
452
649
|
// Mock the SDK for testing
|
|
453
|
-
jest.mock('
|
|
650
|
+
jest.mock('atp-sdk');
|
|
454
651
|
|
|
455
652
|
describe('My Application', () => {
|
|
456
653
|
let mockClient;
|
|
@@ -524,9 +721,15 @@ const results = await Promise.allSettled(
|
|
|
524
721
|
|
|
525
722
|
### Health Checks
|
|
526
723
|
|
|
724
|
+
**Quick Start Example**: See [`examples/10-monitoring-health.js`](./examples/10-monitoring-health.js) for a complete monitoring example.
|
|
725
|
+
|
|
527
726
|
```javascript
|
|
528
727
|
// Implement health check endpoint
|
|
728
|
+
import { ATPClient, createQuickConfig } from 'atp-sdk';
|
|
729
|
+
|
|
529
730
|
app.get('/health', async (req, res) => {
|
|
731
|
+
const client = new ATPClient(createQuickConfig('http://localhost'));
|
|
732
|
+
|
|
530
733
|
try {
|
|
531
734
|
const health = await client.testConnectivity();
|
|
532
735
|
|
|
@@ -545,6 +748,19 @@ app.get('/health', async (req, res) => {
|
|
|
545
748
|
});
|
|
546
749
|
```
|
|
547
750
|
|
|
751
|
+
### Gateway Health & Status
|
|
752
|
+
|
|
753
|
+
```javascript
|
|
754
|
+
// Get detailed gateway health
|
|
755
|
+
const health = await client.gateway.getHealth();
|
|
756
|
+
|
|
757
|
+
// Get gateway status with load metrics
|
|
758
|
+
const status = await client.gateway.getStatus();
|
|
759
|
+
|
|
760
|
+
// Get connection statistics
|
|
761
|
+
const stats = await client.gateway.getConnectionStats();
|
|
762
|
+
```
|
|
763
|
+
|
|
548
764
|
### Metrics
|
|
549
765
|
|
|
550
766
|
```javascript
|
|
@@ -621,11 +837,28 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
621
837
|
|
|
622
838
|
## π Roadmap
|
|
623
839
|
|
|
624
|
-
- [
|
|
625
|
-
- [ ] **v1.2.0** -
|
|
626
|
-
- [ ] **v1.3.0** -
|
|
840
|
+
- [x] **v1.1.0** - Payment Protocols (AP2 & ACP) Integration
|
|
841
|
+
- [ ] **v1.2.0** - WebAssembly support for browser environments
|
|
842
|
+
- [ ] **v1.3.0** - GraphQL API support
|
|
843
|
+
- [ ] **v1.4.0** - Advanced zero-knowledge proof features
|
|
627
844
|
- [ ] **v2.0.0** - ATP Protocol v2 compatibility
|
|
628
845
|
|
|
846
|
+
## π Payment Protocol Partners
|
|
847
|
+
|
|
848
|
+
The ATP SDK integrates with industry-leading payment platforms:
|
|
849
|
+
|
|
850
|
+
**AP2 (Agent Payments Protocol) Partners:**
|
|
851
|
+
- Adyen, American Express, Ant International
|
|
852
|
+
- Coinbase, Ethereum Foundation, MetaMask
|
|
853
|
+
- Etsy, Mastercard, PayPal, Revolut
|
|
854
|
+
- Salesforce, ServiceNow, Stripe, Worldpay
|
|
855
|
+
- 60+ additional partners
|
|
856
|
+
|
|
857
|
+
**ACP (Agentic Commerce Protocol):**
|
|
858
|
+
- OpenAI ChatGPT Commerce
|
|
859
|
+
- Stripe Shared Payment Tokens
|
|
860
|
+
- Etsy Instant Checkout
|
|
861
|
+
|
|
629
862
|
---
|
|
630
863
|
|
|
631
864
|
**Agent Trust Protocolβ’** - Building the foundation for trustworthy AI and secure digital interactions.
|
package/dist/client/atp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atp.d.ts","sourceRoot":"","sources":["../../src/client/atp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"atp.d.ts","sourceRoot":"","sources":["../../src/client/atp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,SAAS;IAQR,OAAO,CAAC,MAAM;IAP1B,SAAgB,QAAQ,EAAE,cAAc,CAAC;IACzC,SAAgB,WAAW,EAAE,iBAAiB,CAAC;IAC/C,SAAgB,WAAW,EAAE,iBAAiB,CAAC;IAC/C,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,OAAO,EAAE,aAAa,CAAC;IACvC,SAAgB,QAAQ,EAAE,cAAc,CAAC;gBAErB,MAAM,EAAE,SAAS;IASrC;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE;QACtB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI;IAYR;;OAEG;IACH,SAAS,IAAI,SAAS;IAItB;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;IAI/C;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC;QAChC,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,EAAE,OAAO,CAAC;QACrB,WAAW,EAAE,OAAO,CAAC;QACrB,KAAK,EAAE,OAAO,CAAC;QACf,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IAiCF;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB"}
|
package/dist/client/atp.js
CHANGED
|
@@ -3,6 +3,7 @@ import { CredentialsClient } from './credentials.js';
|
|
|
3
3
|
import { PermissionsClient } from './permissions.js';
|
|
4
4
|
import { AuditClient } from './audit.js';
|
|
5
5
|
import { GatewayClient } from './gateway.js';
|
|
6
|
+
import { PaymentsClient } from './payments.js';
|
|
6
7
|
/**
|
|
7
8
|
* Main ATPβ’ SDK Client
|
|
8
9
|
*
|
|
@@ -17,6 +18,7 @@ export class ATPClient {
|
|
|
17
18
|
this.permissions = new PermissionsClient(config);
|
|
18
19
|
this.audit = new AuditClient(config);
|
|
19
20
|
this.gateway = new GatewayClient(config);
|
|
21
|
+
this.payments = new PaymentsClient(config);
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Update authentication for all service clients
|
|
@@ -29,6 +31,7 @@ export class ATPClient {
|
|
|
29
31
|
this.permissions.updateAuth(auth);
|
|
30
32
|
this.audit.updateAuth(auth);
|
|
31
33
|
this.gateway.updateAuth(auth);
|
|
34
|
+
this.payments.updateAuth(auth);
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
37
|
* Get current configuration
|
package/dist/client/atp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atp.js","sourceRoot":"","sources":["../../src/client/atp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"atp.js","sourceRoot":"","sources":["../../src/client/atp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;G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AG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;cAI5F,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;cAI3F,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;cAIlF,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAI7G;;OAEG;IACI,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACI,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAMxD;;OAEG;IACI,UAAU,CAAC,IAAI,EAAE;QACtB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI;IAIR;;OAEG;IACI,eAAe,IAAI,OAAO;IAIjC;;OAEG;IACI,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC;CAGxC"}
|
package/dist/client/base.js
CHANGED
|
@@ -26,6 +26,7 @@ export class BaseClient {
|
|
|
26
26
|
permissions: config.services?.permissions,
|
|
27
27
|
audit: config.services?.audit,
|
|
28
28
|
gateway: config.services?.gateway,
|
|
29
|
+
payments: config.services?.payments,
|
|
29
30
|
...config.services
|
|
30
31
|
},
|
|
31
32
|
auth: {
|
|
@@ -47,7 +48,8 @@ export class BaseClient {
|
|
|
47
48
|
credentials: ':3002',
|
|
48
49
|
permissions: ':3003',
|
|
49
50
|
audit: ':3005',
|
|
50
|
-
gateway: ':3000'
|
|
51
|
+
gateway: ':3000',
|
|
52
|
+
payments: ':3004'
|
|
51
53
|
};
|
|
52
54
|
return paths[serviceKey] || '';
|
|
53
55
|
}
|
|
@@ -69,13 +71,13 @@ export class BaseClient {
|
|
|
69
71
|
// Response interceptor for error handling
|
|
70
72
|
this.http.interceptors.response.use((response) => {
|
|
71
73
|
if (this.config.debug) {
|
|
72
|
-
console.log(
|
|
74
|
+
console.log('[ATP SDK] Response:', response.data);
|
|
73
75
|
}
|
|
74
76
|
return response;
|
|
75
77
|
}, (error) => {
|
|
76
78
|
const atpError = this.handleError(error);
|
|
77
79
|
if (this.config.debug) {
|
|
78
|
-
console.error(
|
|
80
|
+
console.error('[ATP SDK] Error:', atpError);
|
|
79
81
|
}
|
|
80
82
|
return Promise.reject(atpError);
|
|
81
83
|
});
|
package/dist/client/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/client/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAExG,MAAM,OAAgB,UAAU;IAI9B,YAAY,MAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/client/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC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AI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED;;OAEG;IACI,SAAS;QACd,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;CACF"}
|
package/dist/client/gateway.js
CHANGED
|
@@ -76,7 +76,7 @@ export class GatewayClient extends BaseClient {
|
|
|
76
76
|
*/
|
|
77
77
|
async connectEventStream(options) {
|
|
78
78
|
const wsUrl = this.config.services.gateway?.replace('http', 'ws') ||
|
|
79
|
-
this.config.baseUrl.replace('http', 'ws')
|
|
79
|
+
`${this.config.baseUrl.replace('http', 'ws')}:3000`;
|
|
80
80
|
const url = `${wsUrl}/ws/events`;
|
|
81
81
|
const queryParams = new URLSearchParams();
|
|
82
82
|
if (options?.filters) {
|