agentic-payments 0.1.2 → 0.1.4
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 +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/tools/mandate.d.ts +16 -0
- package/dist/mcp/tools/mandate.d.ts.map +1 -1
- package/dist/mcp/tools/mandate.js +42 -4
- package/dist/mcp/tools/mandate.js.map +1 -1
- package/dist/visa-tap/index.d.ts +40 -0
- package/dist/visa-tap/index.d.ts.map +1 -0
- package/dist/visa-tap/index.js +42 -0
- package/dist/visa-tap/index.js.map +1 -0
- package/dist/visa-tap/quic-transport.d.ts +67 -0
- package/dist/visa-tap/quic-transport.d.ts.map +1 -0
- package/dist/visa-tap/quic-transport.js +148 -0
- package/dist/visa-tap/quic-transport.js.map +1 -0
- package/dist/visa-tap/rfc9421.d.ts +19 -0
- package/dist/visa-tap/rfc9421.d.ts.map +1 -0
- package/dist/visa-tap/rfc9421.js +113 -0
- package/dist/visa-tap/rfc9421.js.map +1 -0
- package/dist/visa-tap/types.d.ts +119 -0
- package/dist/visa-tap/types.d.ts.map +1 -0
- package/dist/visa-tap/types.js +7 -0
- package/dist/visa-tap/types.js.map +1 -0
- package/package.json +10 -1
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,9 @@ export type { AgentVote, VerificationResult, VerificationConfig, SystemMetrics,
|
|
|
49
49
|
export { IntentMandate, CartMandate, PaymentMandate } from './mandate.js';
|
|
50
50
|
export type { IntentMandateData, CartMandateData, PaymentMandateData, CartItem, ValidationResult, } from './mandate.js';
|
|
51
51
|
export { PaymentError, PaymentErrorCode, isRecoverable, getErrorCode, formatError, AgenticPaymentError, CryptoError, ValidationError, ConsensusError, SystemError, WasmInitError, ErrorCode, } from './errors.js';
|
|
52
|
+
export { VisaTapQuicTransport, createQuicTransport } from './visa-tap/index.js';
|
|
53
|
+
export { signHttpMessage, verifyHttpSignature, computeContentDigest } from './visa-tap/index.js';
|
|
54
|
+
export { TAP_VERSION, DEFAULT_QUIC_PORT, MAX_MANDATE_LIFETIME_SECS } from './visa-tap/index.js';
|
|
52
55
|
export declare const VERSION = "1.0.0";
|
|
53
56
|
/**
|
|
54
57
|
* Get library information
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW,EAEX,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,OAAO,IAAI;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW,EAEX,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGhG,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,OAAO,IAAI;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAgBA;;;;;AAGD,wBAGE"}
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,10 @@ export { IntentMandate, CartMandate, PaymentMandate } from './mandate.js';
|
|
|
50
50
|
export { PaymentError, PaymentErrorCode, isRecoverable, getErrorCode, formatError,
|
|
51
51
|
// Legacy aliases
|
|
52
52
|
AgenticPaymentError, CryptoError, ValidationError, ConsensusError, SystemError, WasmInitError, ErrorCode, } from './errors.js';
|
|
53
|
+
// Visa TAP (Trusted Agent Protocol) - QUIC transport integration
|
|
54
|
+
export { VisaTapQuicTransport, createQuicTransport } from './visa-tap/index.js';
|
|
55
|
+
export { signHttpMessage, verifyHttpSignature, computeContentDigest } from './visa-tap/index.js';
|
|
56
|
+
export { TAP_VERSION, DEFAULT_QUIC_PORT, MAX_MANDATE_LIFETIME_SECS } from './visa-tap/index.js';
|
|
53
57
|
// Version information
|
|
54
58
|
export const VERSION = '1.0.0';
|
|
55
59
|
/**
|
|
@@ -68,6 +72,9 @@ export function getInfo() {
|
|
|
68
72
|
'intent-mandates',
|
|
69
73
|
'cart-mandates',
|
|
70
74
|
'payment-mandates',
|
|
75
|
+
'visa-tap-quic-transport',
|
|
76
|
+
'rfc9421-http-signatures',
|
|
77
|
+
'active-mandates',
|
|
71
78
|
],
|
|
72
79
|
};
|
|
73
80
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,eAAe;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAS1E,gBAAgB;AAChB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW;AACX,iBAAiB;AACjB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EACX,aAAa,EACb,SAAS,G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mB;QACnC,QAAQ,EAAE;YACR,oBAAoB;YACpB,uBAAuB;YACvB,2BAA2B;YAC3B,iBAAiB;YACjB,eAAe;YACf,kBAAkB;YAClB,yBAAyB;YACzB,yBAAyB;YACzB,iBAAiB;SAClB;KACF,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,eAAe;IACb,OAAO;IACP,OAAO;CACR,CAAC"}
|
|
@@ -24,6 +24,22 @@ export declare function revokeMandateTool(args: RevokeMandateArgs): Promise<Tool
|
|
|
24
24
|
export declare function listRevocationsTool(): Promise<ToolResult>;
|
|
25
25
|
/**
|
|
26
26
|
* Get mandate information
|
|
27
|
+
*
|
|
28
|
+
* Note: Active Mandates are stateless by design - they are cryptographic objects
|
|
29
|
+
* that can be created, signed, and verified without central storage. This library
|
|
30
|
+
* provides the cryptographic primitives, but does not implement storage.
|
|
31
|
+
*
|
|
32
|
+
* To integrate mandate storage:
|
|
33
|
+
* 1. Store signed mandates in your application database after creation
|
|
34
|
+
* 2. Index by mandate_id for quick retrieval
|
|
35
|
+
* 3. Check revocation list before authorizing payments
|
|
36
|
+
* 4. Implement your own getMandateInfo that queries your storage
|
|
37
|
+
*
|
|
38
|
+
* Example storage implementations:
|
|
39
|
+
* - PostgreSQL with JSONB columns for mandate bodies
|
|
40
|
+
* - Redis for high-performance caching
|
|
41
|
+
* - IPFS for decentralized storage
|
|
42
|
+
* - Blockchain for immutable audit trails
|
|
27
43
|
*/
|
|
28
44
|
export declare function getMandateInfoTool(args: {
|
|
29
45
|
mandate_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mandate.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/mandate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,KAAK,EACV,UAAU,EACV,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,uBA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|
@@ -143,16 +143,54 @@ export async function listRevocationsTool() {
|
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* Get mandate information
|
|
146
|
+
*
|
|
147
|
+
* Note: Active Mandates are stateless by design - they are cryptographic objects
|
|
148
|
+
* that can be created, signed, and verified without central storage. This library
|
|
149
|
+
* provides the cryptographic primitives, but does not implement storage.
|
|
150
|
+
*
|
|
151
|
+
* To integrate mandate storage:
|
|
152
|
+
* 1. Store signed mandates in your application database after creation
|
|
153
|
+
* 2. Index by mandate_id for quick retrieval
|
|
154
|
+
* 3. Check revocation list before authorizing payments
|
|
155
|
+
* 4. Implement your own getMandateInfo that queries your storage
|
|
156
|
+
*
|
|
157
|
+
* Example storage implementations:
|
|
158
|
+
* - PostgreSQL with JSONB columns for mandate bodies
|
|
159
|
+
* - Redis for high-performance caching
|
|
160
|
+
* - IPFS for decentralized storage
|
|
161
|
+
* - Blockchain for immutable audit trails
|
|
146
162
|
*/
|
|
147
163
|
export async function getMandateInfoTool(args) {
|
|
148
164
|
try {
|
|
149
165
|
const { mandate_id } = args;
|
|
150
|
-
// This is a placeholder - in a real implementation, you would
|
|
151
|
-
// fetch mandate details from storage
|
|
152
166
|
return {
|
|
153
|
-
success:
|
|
167
|
+
success: false,
|
|
154
168
|
mandate_id,
|
|
155
|
-
|
|
169
|
+
error: 'Mandate storage not implemented - this library is stateless',
|
|
170
|
+
message: `Active Mandates are cryptographic objects that don't require central storage.
|
|
171
|
+
To retrieve mandate information:
|
|
172
|
+
1. Implement storage in your application (database, cache, IPFS, etc.)
|
|
173
|
+
2. Store signed mandates after creation with create_active_mandate
|
|
174
|
+
3. Query your storage by mandate_id when needed
|
|
175
|
+
4. Verify signatures with verify_mandate before authorizing payments
|
|
176
|
+
|
|
177
|
+
Example mandate storage schema:
|
|
178
|
+
{
|
|
179
|
+
"mandate_id": "mandate_uuid",
|
|
180
|
+
"signed_mandate": { /* SignedMandate object */ },
|
|
181
|
+
"created_at": "2025-01-15T10:00:00Z",
|
|
182
|
+
"last_used": "2025-01-20T15:30:00Z",
|
|
183
|
+
"total_spent": 0,
|
|
184
|
+
"is_revoked": false
|
|
185
|
+
}`,
|
|
186
|
+
architecture: 'stateless',
|
|
187
|
+
storage_options: [
|
|
188
|
+
'PostgreSQL (JSONB)',
|
|
189
|
+
'Redis (caching)',
|
|
190
|
+
'IPFS (decentralized)',
|
|
191
|
+
'Blockchain (immutable)',
|
|
192
|
+
'Application in-memory',
|
|
193
|
+
],
|
|
156
194
|
};
|
|
157
195
|
}
|
|
158
196
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mandate.js","sourceRoot":"","sources":["../../../src/mcp/tools/mandate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAUvC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,OAAO,GAAgB;YAC3B,UAAU,EAAE,WAAW,MAAM,EAAE,EAAE;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE;gBACH,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB;YACD,UAAU,EACR,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,CAAC,WAAW,EAAE;YAClE,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,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OAAO,EAAE,IAAI;YACb,KAAK,EAAE,WAAW,CAAC,MAAM;YACzB,WAAW;SACZ,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAExC;IACC,IAAI,CAAC;QACH,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAE5B,OAAO;YACL,OAAO,EAAE,KAAK;YACd,UAAU;YACV,KAAK,EAAE,6DAA6D;YACpE,OAAO,EAAE;;;;;;;;;;;;;;;EAeb;YACI,YAAY,EAAE,WAAW;YACzB,eAAe,EAAE;gBACf,oBAAoB;gBACpB,iBAAiB;gBACjB,sBAAsB;gBACtB,wBAAwB;gBACxB,uBAAuB;aACxB;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visa TAP (Trusted Agent Protocol) Integration
|
|
3
|
+
*
|
|
4
|
+
* High-performance payment infrastructure with QUIC transport,
|
|
5
|
+
* RFC 9421 HTTP message signatures, and Active Mandates.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { VisaTapQuicTransport, signHttpMessage } from 'agentic-payments/visa-tap';
|
|
10
|
+
*
|
|
11
|
+
* // Create QUIC transport
|
|
12
|
+
* const transport = new VisaTapQuicTransport({
|
|
13
|
+
* host: 'merchant.com',
|
|
14
|
+
* port: 8443
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* await transport.connect();
|
|
18
|
+
*
|
|
19
|
+
* // Send payment
|
|
20
|
+
* const response = await transport.sendPayment(signedMandate);
|
|
21
|
+
* console.log('Payment approved:', response.transactionId);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export { validateAndVerify, guardExecution, revoke, isRevoked, getAllRevocations, type SignedMandate, type VerificationResult, type ExecutionGuard, type RevocationRecord, } from '../active-mandate/index.js';
|
|
25
|
+
export { VisaTapQuicTransport, createQuicTransport } from './quic-transport.js';
|
|
26
|
+
export { signHttpMessage, verifyHttpSignature, computeContentDigest, } from './rfc9421.js';
|
|
27
|
+
export type { Period, MandateKind, ActiveMandatePayload, SignedActiveMandate, SignatureComponents, SignedHttpMessage, QuicConfig, QuicStats, PaymentResponse, } from './types.js';
|
|
28
|
+
/**
|
|
29
|
+
* Visa TAP protocol version
|
|
30
|
+
*/
|
|
31
|
+
export declare const TAP_VERSION = "1.0";
|
|
32
|
+
/**
|
|
33
|
+
* Default QUIC port for Visa TAP
|
|
34
|
+
*/
|
|
35
|
+
export declare const DEFAULT_QUIC_PORT = 8443;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum mandate lifetime (7 days in seconds)
|
|
38
|
+
*/
|
|
39
|
+
export declare const MAX_MANDATE_LIFETIME_SECS: number;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visa-tap/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,MAAM,EACN,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,WAAW,QAAQ,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAmB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visa TAP (Trusted Agent Protocol) Integration
|
|
3
|
+
*
|
|
4
|
+
* High-performance payment infrastructure with QUIC transport,
|
|
5
|
+
* RFC 9421 HTTP message signatures, and Active Mandates.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { VisaTapQuicTransport, signHttpMessage } from 'agentic-payments/visa-tap';
|
|
10
|
+
*
|
|
11
|
+
* // Create QUIC transport
|
|
12
|
+
* const transport = new VisaTapQuicTransport({
|
|
13
|
+
* host: 'merchant.com',
|
|
14
|
+
* port: 8443
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* await transport.connect();
|
|
18
|
+
*
|
|
19
|
+
* // Send payment
|
|
20
|
+
* const response = await transport.sendPayment(signedMandate);
|
|
21
|
+
* console.log('Payment approved:', response.transactionId);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
// Re-export from active-mandate (already working)
|
|
25
|
+
export { validateAndVerify, guardExecution, revoke, isRevoked, getAllRevocations, } from '../active-mandate/index.js';
|
|
26
|
+
// Export QUIC transport
|
|
27
|
+
export { VisaTapQuicTransport, createQuicTransport } from './quic-transport.js';
|
|
28
|
+
// Export RFC 9421
|
|
29
|
+
export { signHttpMessage, verifyHttpSignature, computeContentDigest, } from './rfc9421.js';
|
|
30
|
+
/**
|
|
31
|
+
* Visa TAP protocol version
|
|
32
|
+
*/
|
|
33
|
+
export const TAP_VERSION = '1.0';
|
|
34
|
+
/**
|
|
35
|
+
* Default QUIC port for Visa TAP
|
|
36
|
+
*/
|
|
37
|
+
export const DEFAULT_QUIC_PORT = 8443;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum mandate lifetime (7 days in seconds)
|
|
40
|
+
*/
|
|
41
|
+
export const MAX_MANDATE_LIFETIME_SECS = 7 * 24 * 60 * 60;
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/visa-tap/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,kDAAkD;AAClD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,SAAS,EACT,iBAAiB,GAKlB,MAAM,4BAA4B,CAAC;AAEpC,wBAAwB;AACxB,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,kBAAkB;AAClB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAetB;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QUIC Transport Integration for Visa TAP
|
|
3
|
+
*
|
|
4
|
+
* Bridges agentic-payments with agentic-flow QUIC transport
|
|
5
|
+
*/
|
|
6
|
+
import type { QuicConfig, QuicStats, PaymentResponse, SignedActiveMandate } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Visa TAP QUIC Transport
|
|
9
|
+
*
|
|
10
|
+
* Provides high-performance QUIC transport for Visa TAP payments
|
|
11
|
+
* with 0-RTT connection resumption and multiplexed streams.
|
|
12
|
+
*/
|
|
13
|
+
export declare class VisaTapQuicTransport {
|
|
14
|
+
private quic;
|
|
15
|
+
private config;
|
|
16
|
+
private connected;
|
|
17
|
+
constructor(config: QuicConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Connect to QUIC server
|
|
20
|
+
*
|
|
21
|
+
* Supports 0-RTT connection resumption for sub-millisecond reconnection
|
|
22
|
+
*/
|
|
23
|
+
connect(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Send payment request over QUIC
|
|
26
|
+
*
|
|
27
|
+
* @param signedMandate - Cryptographically signed Active Mandate
|
|
28
|
+
* @returns Payment response
|
|
29
|
+
*/
|
|
30
|
+
sendPayment(signedMandate: SignedActiveMandate): Promise<PaymentResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Send raw payment data
|
|
33
|
+
*
|
|
34
|
+
* @param data - Payment data object
|
|
35
|
+
* @returns Response data
|
|
36
|
+
*/
|
|
37
|
+
send(data: any): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Get connection statistics
|
|
40
|
+
*/
|
|
41
|
+
getStats(): QuicStats | null;
|
|
42
|
+
/**
|
|
43
|
+
* Check if connected
|
|
44
|
+
*/
|
|
45
|
+
isConnected(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Get server address
|
|
48
|
+
*/
|
|
49
|
+
getServerAddress(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Close connection
|
|
52
|
+
*/
|
|
53
|
+
close(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Parse payment response from QUIC
|
|
56
|
+
*/
|
|
57
|
+
private parsePaymentResponse;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Create QUIC transport instance
|
|
61
|
+
*
|
|
62
|
+
* @param host - QUIC server host
|
|
63
|
+
* @param port - QUIC server port (default: 8443)
|
|
64
|
+
* @returns VisaTapQuicTransport instance
|
|
65
|
+
*/
|
|
66
|
+
export declare function createQuicTransport(host: string, port?: number): VisaTapQuicTransport;
|
|
67
|
+
//# sourceMappingURL=quic-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quic-transport.d.ts","sourceRoot":"","sources":["../../src/visa-tap/quic-transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAqB9F;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,SAAS,CAAkB;gBAEvB,MAAM,EAAE,UAAU;IAS9B;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAa9B;;;;;OAKG;IACG,WAAW,CAAC,aAAa,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IAc/E;;;;;OAKG;IACG,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAQnC;;OAEG;IACH,QAAQ,IAAI,SAAS,GAAG,IAAI;IAc5B;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAO5B;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAe7B;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAa,GAClB,oBAAoB,CAEtB"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QUIC Transport Integration for Visa TAP
|
|
3
|
+
*
|
|
4
|
+
* Bridges agentic-payments with agentic-flow QUIC transport
|
|
5
|
+
*/
|
|
6
|
+
// Dynamic import to handle optional dependency gracefully
|
|
7
|
+
let QuicTransport = null;
|
|
8
|
+
async function loadQuicTransport() {
|
|
9
|
+
if (QuicTransport)
|
|
10
|
+
return QuicTransport;
|
|
11
|
+
try {
|
|
12
|
+
// Try to load agentic-flow dynamically
|
|
13
|
+
// @ts-ignore - Dynamic import of optional peer dependency
|
|
14
|
+
const agenticFlow = await import('agentic-flow');
|
|
15
|
+
QuicTransport = agenticFlow.QuicTransport;
|
|
16
|
+
return QuicTransport;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw new Error('agentic-flow is not installed. Install it with: npm install agentic-flow@^1.6.4');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Visa TAP QUIC Transport
|
|
24
|
+
*
|
|
25
|
+
* Provides high-performance QUIC transport for Visa TAP payments
|
|
26
|
+
* with 0-RTT connection resumption and multiplexed streams.
|
|
27
|
+
*/
|
|
28
|
+
export class VisaTapQuicTransport {
|
|
29
|
+
quic = null;
|
|
30
|
+
config;
|
|
31
|
+
connected = false;
|
|
32
|
+
constructor(config) {
|
|
33
|
+
this.config = {
|
|
34
|
+
timeout: 30000,
|
|
35
|
+
enable0RTT: true,
|
|
36
|
+
maxConcurrentStreams: 100,
|
|
37
|
+
...config,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Connect to QUIC server
|
|
42
|
+
*
|
|
43
|
+
* Supports 0-RTT connection resumption for sub-millisecond reconnection
|
|
44
|
+
*/
|
|
45
|
+
async connect() {
|
|
46
|
+
const QuicClient = await loadQuicTransport();
|
|
47
|
+
this.quic = new QuicClient({
|
|
48
|
+
host: this.config.host,
|
|
49
|
+
port: this.config.port,
|
|
50
|
+
maxConcurrentStreams: this.config.maxConcurrentStreams,
|
|
51
|
+
});
|
|
52
|
+
await this.quic.connect();
|
|
53
|
+
this.connected = true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Send payment request over QUIC
|
|
57
|
+
*
|
|
58
|
+
* @param signedMandate - Cryptographically signed Active Mandate
|
|
59
|
+
* @returns Payment response
|
|
60
|
+
*/
|
|
61
|
+
async sendPayment(signedMandate) {
|
|
62
|
+
if (!this.connected) {
|
|
63
|
+
throw new Error('Not connected. Call connect() first.');
|
|
64
|
+
}
|
|
65
|
+
const response = await this.quic.send({
|
|
66
|
+
type: 'visa-tap-payment',
|
|
67
|
+
version: '1.0',
|
|
68
|
+
mandate: signedMandate,
|
|
69
|
+
});
|
|
70
|
+
return this.parsePaymentResponse(response);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Send raw payment data
|
|
74
|
+
*
|
|
75
|
+
* @param data - Payment data object
|
|
76
|
+
* @returns Response data
|
|
77
|
+
*/
|
|
78
|
+
async send(data) {
|
|
79
|
+
if (!this.connected) {
|
|
80
|
+
throw new Error('Not connected. Call connect() first.');
|
|
81
|
+
}
|
|
82
|
+
return await this.quic.send(data);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get connection statistics
|
|
86
|
+
*/
|
|
87
|
+
getStats() {
|
|
88
|
+
if (!this.connected || !this.quic.getStats) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const stats = this.quic.getStats();
|
|
92
|
+
return {
|
|
93
|
+
rtt: stats.rtt || 0,
|
|
94
|
+
sentBytes: stats.sentBytes || 0,
|
|
95
|
+
receivedBytes: stats.receivedBytes || 0,
|
|
96
|
+
activeStreams: stats.activeStreams || 0,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Check if connected
|
|
101
|
+
*/
|
|
102
|
+
isConnected() {
|
|
103
|
+
return this.connected;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get server address
|
|
107
|
+
*/
|
|
108
|
+
getServerAddress() {
|
|
109
|
+
return `${this.config.host}:${this.config.port}`;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Close connection
|
|
113
|
+
*/
|
|
114
|
+
async close() {
|
|
115
|
+
if (this.quic && this.connected) {
|
|
116
|
+
await this.quic.close();
|
|
117
|
+
this.connected = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Parse payment response from QUIC
|
|
122
|
+
*/
|
|
123
|
+
parsePaymentResponse(response) {
|
|
124
|
+
// Handle different response formats
|
|
125
|
+
if (response.transactionId) {
|
|
126
|
+
return response;
|
|
127
|
+
}
|
|
128
|
+
// Default response format
|
|
129
|
+
return {
|
|
130
|
+
transactionId: response.id || crypto.randomUUID(),
|
|
131
|
+
status: response.status || 'pending',
|
|
132
|
+
amount: response.amount || 0,
|
|
133
|
+
currency: response.currency || 'USD',
|
|
134
|
+
timestamp: new Date().toISOString(),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Create QUIC transport instance
|
|
140
|
+
*
|
|
141
|
+
* @param host - QUIC server host
|
|
142
|
+
* @param port - QUIC server port (default: 8443)
|
|
143
|
+
* @returns VisaTapQuicTransport instance
|
|
144
|
+
*/
|
|
145
|
+
export function createQuicTransport(host, port = 8443) {
|
|
146
|
+
return new VisaTapQuicTransport({ host, port });
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=quic-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quic-transport.js","sourceRoot":"","sources":["../../src/visa-tap/quic-transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,0DAA0D;AAC1D,IAAI,aAAa,GAAQ,IAAI,CAAC;AAE9B,KAAK,UAAU,iBAAiB;IAC9B,IAAI,aAAa;QAAE,OAAO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AAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IAED;;OAEG;IACK,oBAAoB,CAAC,QAAa;QACxC,oCAAoC;QACpC,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;YAC3B,OAAO,QAA2B,CAAC;QACrC,CAAC;QAED,0BAA0B;QAC1B,OAAO;YACL,aAAa,EAAE,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE;YACjD,MAAM,EAAE,QAAQ,CAAC,MAAM,IAAI,SAAS;YACpC,MAAM,EAAE,QAAQ,CAAC,MAAM,IAAI,CAAC;YAC5B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,KAAK;YACpC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC;IACJ,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,OAAe,IAAI;IAEnB,OAAO,IAAI,oBAAoB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC 9421 HTTP Message Signatures
|
|
3
|
+
*
|
|
4
|
+
* Implements cryptographic signing and verification of HTTP requests per RFC 9421
|
|
5
|
+
*/
|
|
6
|
+
import type { SignatureComponents, SignedHttpMessage } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Sign HTTP message per RFC 9421
|
|
9
|
+
*/
|
|
10
|
+
export declare function signHttpMessage(components: SignatureComponents, privateKeyHex: string, keyId: string): Promise<SignedHttpMessage>;
|
|
11
|
+
/**
|
|
12
|
+
* Verify RFC 9421 HTTP signature
|
|
13
|
+
*/
|
|
14
|
+
export declare function verifyHttpSignature(components: SignatureComponents, signed: SignedHttpMessage, publicKeyHex: string): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Compute content digest (SHA-256)
|
|
17
|
+
*/
|
|
18
|
+
export declare function computeContentDigest(body: Uint8Array): string;
|
|
19
|
+
//# sourceMappingURL=rfc9421.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rfc9421.d.ts","sourceRoot":"","sources":["../../src/visa-tap/rfc9421.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEzE;;GAEG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,mBAAmB,EAC/B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,iBAAiB,CAAC,CA2C5B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,mBAAmB,EAC/B,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CA+ClB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAI7D"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC 9421 HTTP Message Signatures
|
|
3
|
+
*
|
|
4
|
+
* Implements cryptographic signing and verification of HTTP requests per RFC 9421
|
|
5
|
+
*/
|
|
6
|
+
import { sha256 } from '@noble/hashes/sha256';
|
|
7
|
+
import { bytesToHex, hexToBytes } from '@noble/hashes/utils';
|
|
8
|
+
import * as ed25519 from '@noble/ed25519';
|
|
9
|
+
/**
|
|
10
|
+
* Sign HTTP message per RFC 9421
|
|
11
|
+
*/
|
|
12
|
+
export async function signHttpMessage(components, privateKeyHex, keyId) {
|
|
13
|
+
const nonce = generateNonce();
|
|
14
|
+
const created = Math.floor(Date.now() / 1000);
|
|
15
|
+
// Build signature base
|
|
16
|
+
const baseParts = [
|
|
17
|
+
`"@method": ${components.method}`,
|
|
18
|
+
`"@authority": ${components.authority}`,
|
|
19
|
+
`"@path": ${components.path}`,
|
|
20
|
+
];
|
|
21
|
+
if (components.contentDigest) {
|
|
22
|
+
baseParts.push(`"content-digest": ${components.contentDigest}`);
|
|
23
|
+
}
|
|
24
|
+
if (components.headers) {
|
|
25
|
+
for (const [name, value] of Object.entries(components.headers)) {
|
|
26
|
+
baseParts.push(`"${name.toLowerCase()}": ${value}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Add signature parameters
|
|
30
|
+
baseParts.push(`"@signature-params": ("@method" "@authority" "@path");created=${created};nonce="${nonce}";keyid="${keyId}"`);
|
|
31
|
+
const signatureBase = baseParts.join('\n');
|
|
32
|
+
// Sign with Ed25519
|
|
33
|
+
const privateKey = hexToBytes(privateKeyHex);
|
|
34
|
+
const messageBytes = new TextEncoder().encode(signatureBase);
|
|
35
|
+
const signatureBytes = await ed25519.sign(messageBytes, privateKey);
|
|
36
|
+
const signatureB64 = Buffer.from(signatureBytes).toString('base64');
|
|
37
|
+
// Build Signature-Input header
|
|
38
|
+
const signatureInput = `sig1=("@method" "@authority" "@path");created=${created};nonce="${nonce}";keyid="${keyId}";alg="ed25519"`;
|
|
39
|
+
return {
|
|
40
|
+
signatureInput,
|
|
41
|
+
signature: `sig1=:${signatureB64}:`,
|
|
42
|
+
nonce,
|
|
43
|
+
created,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Verify RFC 9421 HTTP signature
|
|
48
|
+
*/
|
|
49
|
+
export async function verifyHttpSignature(components, signed, publicKeyHex) {
|
|
50
|
+
try {
|
|
51
|
+
// Reconstruct signature base
|
|
52
|
+
const baseParts = [
|
|
53
|
+
`"@method": ${components.method}`,
|
|
54
|
+
`"@authority": ${components.authority}`,
|
|
55
|
+
`"@path": ${components.path}`,
|
|
56
|
+
];
|
|
57
|
+
if (components.contentDigest) {
|
|
58
|
+
baseParts.push(`"content-digest": ${components.contentDigest}`);
|
|
59
|
+
}
|
|
60
|
+
if (components.headers) {
|
|
61
|
+
for (const [name, value] of Object.entries(components.headers)) {
|
|
62
|
+
baseParts.push(`"${name.toLowerCase()}": ${value}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Extract keyid from signature input
|
|
66
|
+
const keyId = extractKeyId(signed.signatureInput);
|
|
67
|
+
// Add signature parameters
|
|
68
|
+
baseParts.push(`"@signature-params": ("@method" "@authority" "@path");created=${signed.created};nonce="${signed.nonce}";keyid="${keyId}"`);
|
|
69
|
+
const signatureBase = baseParts.join('\n');
|
|
70
|
+
// Extract signature bytes
|
|
71
|
+
const sigMatch = signed.signature.match(/^sig1=:(.+):$/);
|
|
72
|
+
if (!sigMatch || !sigMatch[1]) {
|
|
73
|
+
throw new Error('Invalid signature format');
|
|
74
|
+
}
|
|
75
|
+
const signatureB64 = sigMatch[1];
|
|
76
|
+
const signatureBytes = Buffer.from(signatureB64, 'base64');
|
|
77
|
+
// Verify with Ed25519
|
|
78
|
+
const publicKey = hexToBytes(publicKeyHex);
|
|
79
|
+
const messageBytes = new TextEncoder().encode(signatureBase);
|
|
80
|
+
return await ed25519.verify(signatureBytes, messageBytes, publicKey);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.error('Signature verification failed:', error);
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Compute content digest (SHA-256)
|
|
89
|
+
*/
|
|
90
|
+
export function computeContentDigest(body) {
|
|
91
|
+
const hash = sha256(body);
|
|
92
|
+
const hashB64 = Buffer.from(hash).toString('base64');
|
|
93
|
+
return `sha-256=:${hashB64}:`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Generate cryptographic nonce (16 bytes)
|
|
97
|
+
*/
|
|
98
|
+
function generateNonce() {
|
|
99
|
+
const bytes = new Uint8Array(16);
|
|
100
|
+
crypto.getRandomValues(bytes);
|
|
101
|
+
return bytesToHex(bytes);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Extract keyid from Signature-Input header
|
|
105
|
+
*/
|
|
106
|
+
function extractKeyId(signatureInput) {
|
|
107
|
+
const match = signatureInput.match(/keyid="([^"]+)"/);
|
|
108
|
+
if (!match || !match[1]) {
|
|
109
|
+
throw new Error('Missing keyid in signature-input');
|
|
110
|
+
}
|
|
111
|
+
return match[1];
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=rfc9421.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rfc9421.js","sourceRoot":"","sources":["../../src/visa-tap/rfc9421.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAG1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,UAA+B,EAC/B,aAAqB,EACrB,KAAa;IAEb,MAAM,KAAK,GAAG,aAAa,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAE9C,uBAAuB;IACvB,MAAM,SAAS,GAAa;QAC1B,cAAc,UAAU,CAAC,MAAM,EAAE;QACjC,iBAAiB,UAAU,CAAC,SAAS,EAAE;QACvC,YAAY,UAAU,CAAC,IAAI,EAAE;KAC9B,CAAC;IAEF,IAAI,UAAU,CAAC,aAAa,EAAE,CAAC;QAC7B,SAAS,CAAC,IAAI,CAAC,qBAAqB,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/D,SAAS,CAAC,IAAI,CAAC,IAA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AC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAgB;IACnD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrD,OAAO,YAAY,OAAO,GAAG,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,SAAS,aAAa;IACpB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACjC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,cAAsB;IAC1C,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visa TAP (Trusted Agent Protocol) Types
|
|
3
|
+
*
|
|
4
|
+
* TypeScript type definitions for Visa TAP integration
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Spend period for Active Mandate
|
|
8
|
+
*/
|
|
9
|
+
export type Period = 'single' | 'daily' | 'weekly' | 'monthly';
|
|
10
|
+
/**
|
|
11
|
+
* Mandate kind
|
|
12
|
+
*/
|
|
13
|
+
export type MandateKind = 'intent' | 'cart';
|
|
14
|
+
/**
|
|
15
|
+
* Active Mandate payload
|
|
16
|
+
*/
|
|
17
|
+
export interface ActiveMandatePayload {
|
|
18
|
+
/** Agent DID identifier */
|
|
19
|
+
agent: string;
|
|
20
|
+
/** Holder/user DID identifier */
|
|
21
|
+
holder: string;
|
|
22
|
+
/** Spend cap amount in minor units (e.g., cents) */
|
|
23
|
+
amount: number;
|
|
24
|
+
/** Currency code (ISO 4217) */
|
|
25
|
+
currency: string;
|
|
26
|
+
/** Spend period */
|
|
27
|
+
period: Period;
|
|
28
|
+
/** Mandate kind */
|
|
29
|
+
kind: MandateKind;
|
|
30
|
+
/** Expiration timestamp (ISO 8601) */
|
|
31
|
+
expires_at: string;
|
|
32
|
+
/** Allowed merchant hostnames */
|
|
33
|
+
merchant_allow?: string[];
|
|
34
|
+
/** Blocked merchant hostnames */
|
|
35
|
+
merchant_block?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Signed Active Mandate
|
|
39
|
+
*/
|
|
40
|
+
export interface SignedActiveMandate {
|
|
41
|
+
/** Payload */
|
|
42
|
+
payload: ActiveMandatePayload;
|
|
43
|
+
/** Ed25519 signature (hex-encoded) */
|
|
44
|
+
signature: string;
|
|
45
|
+
/** Public key (hex-encoded) */
|
|
46
|
+
public_key: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* RFC 9421 HTTP Message Signature Components
|
|
50
|
+
*/
|
|
51
|
+
export interface SignatureComponents {
|
|
52
|
+
/** HTTP method */
|
|
53
|
+
method: string;
|
|
54
|
+
/** Authority (host) */
|
|
55
|
+
authority: string;
|
|
56
|
+
/** Request path */
|
|
57
|
+
path: string;
|
|
58
|
+
/** Content digest (SHA-256) */
|
|
59
|
+
contentDigest?: string;
|
|
60
|
+
/** Additional headers to sign */
|
|
61
|
+
headers?: Record<string, string>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* RFC 9421 Signed HTTP Message
|
|
65
|
+
*/
|
|
66
|
+
export interface SignedHttpMessage {
|
|
67
|
+
/** Signature-Input header value */
|
|
68
|
+
signatureInput: string;
|
|
69
|
+
/** Signature header value */
|
|
70
|
+
signature: string;
|
|
71
|
+
/** Nonce for replay protection */
|
|
72
|
+
nonce: string;
|
|
73
|
+
/** Creation timestamp (Unix seconds) */
|
|
74
|
+
created: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* QUIC Transport Configuration
|
|
78
|
+
*/
|
|
79
|
+
export interface QuicConfig {
|
|
80
|
+
/** Server host */
|
|
81
|
+
host: string;
|
|
82
|
+
/** Server port */
|
|
83
|
+
port: number;
|
|
84
|
+
/** Connection timeout in milliseconds */
|
|
85
|
+
timeout?: number;
|
|
86
|
+
/** Enable 0-RTT connection resumption */
|
|
87
|
+
enable0RTT?: boolean;
|
|
88
|
+
/** Maximum concurrent streams */
|
|
89
|
+
maxConcurrentStreams?: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* QUIC Connection Statistics
|
|
93
|
+
*/
|
|
94
|
+
export interface QuicStats {
|
|
95
|
+
/** Round-trip time in milliseconds */
|
|
96
|
+
rtt: number;
|
|
97
|
+
/** Total bytes sent */
|
|
98
|
+
sentBytes: number;
|
|
99
|
+
/** Total bytes received */
|
|
100
|
+
receivedBytes: number;
|
|
101
|
+
/** Number of active streams */
|
|
102
|
+
activeStreams: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Payment Response
|
|
106
|
+
*/
|
|
107
|
+
export interface PaymentResponse {
|
|
108
|
+
/** Transaction ID */
|
|
109
|
+
transactionId: string;
|
|
110
|
+
/** Status */
|
|
111
|
+
status: 'approved' | 'declined' | 'pending';
|
|
112
|
+
/** Amount processed */
|
|
113
|
+
amount: number;
|
|
114
|
+
/** Currency */
|
|
115
|
+
currency: string;
|
|
116
|
+
/** Timestamp */
|
|
117
|
+
timestamp: string;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/visa-tap/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;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IAClB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iCAAiC;IACjC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa;IACb,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC5C,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/visa-tap/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-payments",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Dual-protocol payment infrastructure for autonomous AI commerce (AP2 + ACP)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
"types": "./dist/acp/index.d.ts",
|
|
27
27
|
"import": "./dist/acp/index.js"
|
|
28
28
|
},
|
|
29
|
+
"./visa-tap": {
|
|
30
|
+
"types": "./dist/visa-tap/index.d.ts",
|
|
31
|
+
"import": "./dist/visa-tap/index.js"
|
|
32
|
+
},
|
|
29
33
|
"./package.json": "./package.json"
|
|
30
34
|
},
|
|
31
35
|
"bin": {
|
|
@@ -106,6 +110,7 @@
|
|
|
106
110
|
"@modelcontextprotocol/sdk": "^1.18.2",
|
|
107
111
|
"@noble/ed25519": "^2.1.0",
|
|
108
112
|
"@noble/hashes": "^1.4.0",
|
|
113
|
+
"agentic-flow": "^1.6.4",
|
|
109
114
|
"base64-js": "^1.5.1",
|
|
110
115
|
"chalk": "^5.6.2",
|
|
111
116
|
"commander": "^14.0.1",
|
|
@@ -138,9 +143,13 @@
|
|
|
138
143
|
"wasm-pack": "^0.12.1"
|
|
139
144
|
},
|
|
140
145
|
"peerDependencies": {
|
|
146
|
+
"agentic-flow": "^1.6.4",
|
|
141
147
|
"typescript": ">=5.0.0"
|
|
142
148
|
},
|
|
143
149
|
"peerDependenciesMeta": {
|
|
150
|
+
"agentic-flow": {
|
|
151
|
+
"optional": true
|
|
152
|
+
},
|
|
144
153
|
"typescript": {
|
|
145
154
|
"optional": true
|
|
146
155
|
}
|