Skip to content

Commit db25f9b

Browse files
author
timolein74
committed
Add AsterPay KYA Trust Score demo for ACK-ID integration
Made-with: Cursor
1 parent f0e8c6c commit db25f9b

10 files changed

Lines changed: 883 additions & 0 deletions

File tree

demos/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ pnpm demo:e2e
3636

3737
[View the code](./e2e)
3838

39+
### AsterPay KYA Trust Score demo
40+
41+
A demo showing how AsterPay KYA Trust Score tokens integrate with ACK-ID for trust-gated agent commerce via ERC-8183.
42+
43+
```sh
44+
pnpm demo:asterpay-kya
45+
```
46+
47+
[View the code](./asterpay-kya)
48+
3949
## Note
4050

4151
These demos are designed as interactive walkthroughs of various ACK flows. The source code is designed with this in mind, and may not be suitable for production environments.

demos/asterpay-kya/README.md

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# ACK-ID: AsterPay KYA Trust Score Demo
2+
3+
This demo shows how [AsterPay](https://asterpay.io) KYA (Know Your Agent) Trust Score tokens integrate with ACK-ID's identity infrastructure. AsterPay provides a 5-layer trust verification framework for AI agent payments: VERIFY → SCREEN → SCORE → SETTLE → COMPLY.
4+
5+
## Getting started
6+
7+
Before starting, please follow the [Getting Started](../../README.md#getting-started) guide at the root of this monorepo.
8+
9+
### Running the demo
10+
11+
You can use the demo by running the following command from the root of this repository:
12+
13+
```sh
14+
pnpm run demo:asterpay-kya
15+
```
16+
17+
Alternatively, you can run the demo from this directory (`./demos/asterpay-kya`) with:
18+
19+
```sh
20+
pnpm run demo
21+
```
22+
23+
## What is ACK-ID?
24+
25+
ACK-ID is a protocol built on W3C Standards that provides verifiable, secure identity infrastructure for agents. It uses DIDs (Decentralized Identifiers) and Verifiable Credentials to establish trust and enable agent-to-agent commerce. ACK-ID serves as the core identity layer that other agent systems can build upon.
26+
27+
## What is AsterPay KYA?
28+
29+
AsterPay's Know Your Agent (KYA) framework provides trust scoring and verification for AI agents. KYA tokens are JWT-based credentials that contain:
30+
31+
- **Trust Score** (0-100): Composite score from 7 on-chain and off-chain signals
32+
- **Tier Classification**: Open, Verified, Trusted, or Enterprise
33+
- **Score Components**: Wallet Age, Transaction Activity, Sanctions Screening, ERC-8004 Identity, Operator KYB, Payment History, Trust Bond
34+
- **InsumerAPI Attestations**: Third-party ES256-signed attestations for Coinbase KYC, country verification, Gitcoin Passport, and USDC balance
35+
- **Sanctions Screening**: Chainalysis-powered sanctions check
36+
- **Cryptographic Proof**: ES256 JWT signature from AsterPay's infrastructure
37+
38+
## How AsterPay KYA Works with ACK-ID
39+
40+
This demo demonstrates how KYA Trust Score tokens leverage ACK-ID's infrastructure:
41+
42+
1. **Native Compatibility**: KYA JWTs convert to standard W3C Verifiable Credentials
43+
2. **Cryptographic Integrity**: Bidirectional conversion preserves original signatures with perfect fidelity
44+
3. **Trust-Score-Aware Verification**: ACK-ID verifiers can set minimum trust score thresholds
45+
4. **ERC-8183 Integration**: IACPHook gates agent commerce jobs using trust score verification
46+
47+
## Demo Flow
48+
49+
### 1. KYA Trust Score Token Creation
50+
51+
- Creates an AsterPay KYA token with trust score, 7 scoring components, InsumerAPI attestations, and sanctions screening result
52+
- Simulates what AsterPay's API returns at `GET /v1/agent/trust-score/:address`
53+
54+
### 2. JWT to Verifiable Credential Conversion
55+
56+
- Converts the KYA JWT to a W3C Verifiable Credential
57+
- Preserves all original JWT data and cryptographic signatures
58+
- Generates an ACK-ID compatible DID: `did:web:api.asterpay.io:agent:{address}`
59+
- Extracts trust score, tier, components, and attestation data
60+
61+
### 3. Bidirectional Conversion
62+
63+
- Demonstrates perfect fidelity conversion back to original JWT format
64+
- Proves cryptographic integrity is maintained throughout the process
65+
- Verifies `original JWT === reconstructed JWT`
66+
67+
### 4. ACK-ID Verification with Trust Score Gate
68+
69+
- Verification with configurable minimum trust score thresholds
70+
- Automatic sanctions status checking
71+
- Trusted issuer validation
72+
- Shows PASS/BLOCK scenarios for different thresholds
73+
74+
### 5. ERC-8183 IACPHook Simulation
75+
76+
- Simulates an ERC-8183 Agentic Commerce Protocol job
77+
- Runs 5-shield verification: VERIFY → SCREEN → SCORE → ATTEST → COMPLY
78+
- Demonstrates how trust scores gate agent access to commerce jobs
79+
80+
## Technical Implementation
81+
82+
### Verifiable Credential Structure
83+
84+
The demo creates a Verifiable Credential containing the full KYA trust data:
85+
86+
```json
87+
{
88+
"@context": [
89+
"https://www.w3.org/2018/credentials/v1",
90+
"https://agentcommercekit.com/contexts/asterpay-kya/v1"
91+
],
92+
"type": ["VerifiableCredential", "AsterPayKYACredential", "AgentTrustScoreCredential"],
93+
"issuer": { "id": "did:web:api.asterpay.io" },
94+
"credentialSubject": {
95+
"id": "did:web:api.asterpay.io:agent:0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
96+
"trustScore": 82,
97+
"tier": "trusted",
98+
"components": {
99+
"walletAge": 12,
100+
"transactionActivity": 11,
101+
"sanctionsScreening": 15,
102+
"ercIdentity": 15,
103+
"operatorKyb": 10,
104+
"paymentHistory": 9,
105+
"trustBond": 10
106+
},
107+
"insumerAttestation": {
108+
"coinbaseKyc": { "met": true },
109+
"coinbaseCountry": { "met": true, "country": "EU" },
110+
"gitcoinPassport": { "met": true, "minScore": 20 },
111+
"tokenBalance": { "met": true, "chain": "base", "token": "USDC", "minBalance": "100" }
112+
},
113+
"sanctioned": false
114+
}
115+
}
116+
```
117+
118+
### DID Generation
119+
120+
The system generates a DID for the agent identity:
121+
122+
- **Agent DID**: `did:web:api.asterpay.io:agent:{address}`
123+
124+
### Trust Score Components
125+
126+
| Component | Max Score | Description |
127+
|-----------|-----------|-------------|
128+
| Wallet Age | 15 | How long the wallet has existed |
129+
| Transaction Activity | 15 | On-chain transaction history |
130+
| Sanctions Screening | 15 | Chainalysis sanctions clearance |
131+
| ERC-8004 Identity | 15 | Registered agent identity on-chain |
132+
| Operator KYB | 15 | Know Your Business verification |
133+
| Payment History | 15 | Historical payment reliability |
134+
| Trust Bond | 10 | Staked collateral for trust |
135+
136+
### Verification Flow
137+
138+
1. **JWT Verification**: Validates the KYA token signature using AsterPay's JWKS
139+
2. **Trust Check**: Ensures AsterPay is in the trusted issuers list
140+
3. **Expiration Check**: Validates token hasn't expired
141+
4. **Sanctions Check**: Verifies agent is not sanctioned
142+
5. **Trust Score Gate**: Checks score meets minimum threshold
143+
6. **Attestation Check**: Validates Coinbase KYC attestation
144+
145+
## Sample Output
146+
147+
```txt
148+
KYA Trust Score × ACK-ID Demo
149+
150+
✨ === AsterPay KYA Trust Score → ACK-ID Integration Demo === ✨
151+
152+
1. Creating AsterPay KYA Trust Score token...
153+
✓ KYA token created
154+
155+
2. Converting KYA JWT to ACK-ID Verifiable Credential...
156+
✓ Verifiable Credential created
157+
Trust Score: 82 / 100
158+
Tier: trusted
159+
160+
3. Demonstrating bidirectional conversion...
161+
✓ Successfully converted VC back to JWT
162+
Original JWT matches reconstructed: true
163+
164+
4. Running ACK-ID verification with trust score gate...
165+
4a. minTrustScore=50: ✓ PASSED
166+
4b. minTrustScore=90: ✗ BLOCKED
167+
4c. Untrusted issuer: ✗ BLOCKED
168+
169+
5. Simulating ERC-8183 IACPHook with ACK-ID...
170+
✅ VERIFY: ERC-8004 identity confirmed
171+
✅ SCREEN: Chainalysis sanctions clear
172+
✅ SCORE: Trust score 82 ≥ 50 minimum
173+
✅ ATTEST: InsumerAPI — KYC, Country, Passport, USDC
174+
✅ COMPLY: Tier "trusted" authorized
175+
✓ IACPHook: APPROVED — Agent may fund the job
176+
177+
🎉 Demo complete
178+
```
179+
180+
## Production Considerations
181+
182+
For production deployment:
183+
184+
1. **JWKS Endpoint**: Fetch AsterPay's current JWKS from `https://api.asterpay.io/.well-known/jwks.json`
185+
2. **Trust Configuration**: Configure AsterPay as a trusted issuer in ACK-ID systems
186+
3. **Score Thresholds**: Set appropriate minimum trust scores per use case
187+
4. **Attestation Validation**: Verify InsumerAPI attestation signatures independently
188+
5. **Sanctions Monitoring**: Implement real-time sanctions screening updates
189+
190+
## Learn More
191+
192+
- [Agent Commerce Kit](https://www.agentcommercekit.com) Documentation
193+
- [ACK-ID](https://www.agentcommercekit.com/ack-id) Documentation
194+
- [W3C Verifiable Credentials](https://www.w3.org/TR/vc-data-model/) Specification
195+
- [AsterPay](https://asterpay.io) — The Trust Layer for AI Agent Payments
196+
- [InsumerAPI](https://insumermodel.com) — Third-party attestation provider
197+
- [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) — Agent Identity Standard
198+
- [ERC-8183](https://eips.ethereum.org/EIPS/eip-8183) — Agentic Commerce Protocol

demos/asterpay-kya/package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "@demos/asterpay-kya",
3+
"version": "0.0.1",
4+
"private": true,
5+
"homepage": "https://github.com/agentcommercekit/ack#readme",
6+
"bugs": "https://github.com/agentcommercekit/ack/issues",
7+
"license": "MIT",
8+
"author": {
9+
"name": "AsterPay",
10+
"url": "https://asterpay.io"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/agentcommercekit/ack.git",
15+
"directory": "demos/asterpay-kya"
16+
},
17+
"type": "module",
18+
"scripts": {
19+
"check:types": "tsc --noEmit",
20+
"clean": "git clean -fdX .turbo",
21+
"demo": "tsx ./src/index.ts",
22+
"test": "vitest"
23+
},
24+
"dependencies": {
25+
"@repo/cli-tools": "workspace:*",
26+
"agentcommercekit": "workspace:*",
27+
"jose": "catalog:",
28+
"zod": "catalog:"
29+
},
30+
"devDependencies": {
31+
"@repo/typescript-config": "workspace:*"
32+
}
33+
}

0 commit comments

Comments
 (0)