@peac/kernel 0.9.18
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/README.md +23 -0
- package/dist/constants.d.ts +97 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +79 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +179 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/registries.d.ts +54 -0
- package/dist/registries.d.ts.map +1 -0
- package/dist/registries.js +170 -0
- package/dist/registries.js.map +1 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @peac/kernel
|
|
2
|
+
|
|
3
|
+
PEAC protocol kernel - normative constants, errors, and registries
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @peac/kernel
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
See [peacprotocol.org](https://peacprotocol.org) for full documentation.
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
Apache-2.0
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
PEAC Protocol is an open source project stewarded by Originary and community contributors.
|
|
22
|
+
|
|
23
|
+
[Originary](https://www.originary.xyz) | [Docs](https://peacprotocol.org) | [GitHub](https://github.com/peacprotocol/peac)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PEAC Protocol Constants
|
|
3
|
+
* Derived from specs/kernel/constants.json
|
|
4
|
+
*
|
|
5
|
+
* NOTE: This file is manually synced for v0.9.15.
|
|
6
|
+
* From v0.9.16+, this will be auto-generated via codegen.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Wire format type for PEAC receipts
|
|
10
|
+
* Frozen at peac.receipt/0.9 until v1.0.0
|
|
11
|
+
*/
|
|
12
|
+
export declare const WIRE_TYPE: "peac.receipt/0.9";
|
|
13
|
+
/**
|
|
14
|
+
* Wire format version (extracted from WIRE_TYPE)
|
|
15
|
+
* Use this for wire_version fields in receipts
|
|
16
|
+
*/
|
|
17
|
+
export declare const WIRE_VERSION: "0.9";
|
|
18
|
+
/**
|
|
19
|
+
* Supported cryptographic algorithms
|
|
20
|
+
*/
|
|
21
|
+
export declare const ALGORITHMS: {
|
|
22
|
+
readonly supported: readonly ["EdDSA"];
|
|
23
|
+
readonly default: "EdDSA";
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* HTTP header names for PEAC protocol
|
|
27
|
+
*/
|
|
28
|
+
export declare const HEADERS: {
|
|
29
|
+
readonly receipt: "PEAC-Receipt";
|
|
30
|
+
readonly dpop: "DPoP";
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Discovery manifest settings
|
|
34
|
+
*/
|
|
35
|
+
export declare const DISCOVERY: {
|
|
36
|
+
readonly manifestPath: "/.well-known/peac.txt";
|
|
37
|
+
readonly manifestVersion: "peac/0.9";
|
|
38
|
+
readonly cacheTtlSeconds: 3600;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* JWKS rotation and revocation settings
|
|
42
|
+
*/
|
|
43
|
+
export declare const JWKS: {
|
|
44
|
+
readonly rotationDays: 90;
|
|
45
|
+
readonly overlapDays: 7;
|
|
46
|
+
readonly emergencyRevocationHours: 24;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Receipt validation constants
|
|
50
|
+
*/
|
|
51
|
+
export declare const RECEIPT: {
|
|
52
|
+
readonly minReceiptIdLength: 16;
|
|
53
|
+
readonly maxReceiptIdLength: 64;
|
|
54
|
+
readonly defaultTtlSeconds: 86400;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Payment amount validation limits (in cents/smallest currency unit)
|
|
58
|
+
*/
|
|
59
|
+
export declare const LIMITS: {
|
|
60
|
+
readonly maxAmountCents: 999999999999;
|
|
61
|
+
readonly minAmountCents: 1;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* All constants export
|
|
65
|
+
*/
|
|
66
|
+
export declare const CONSTANTS: {
|
|
67
|
+
readonly WIRE_TYPE: "peac.receipt/0.9";
|
|
68
|
+
readonly WIRE_VERSION: "0.9";
|
|
69
|
+
readonly ALGORITHMS: {
|
|
70
|
+
readonly supported: readonly ["EdDSA"];
|
|
71
|
+
readonly default: "EdDSA";
|
|
72
|
+
};
|
|
73
|
+
readonly HEADERS: {
|
|
74
|
+
readonly receipt: "PEAC-Receipt";
|
|
75
|
+
readonly dpop: "DPoP";
|
|
76
|
+
};
|
|
77
|
+
readonly DISCOVERY: {
|
|
78
|
+
readonly manifestPath: "/.well-known/peac.txt";
|
|
79
|
+
readonly manifestVersion: "peac/0.9";
|
|
80
|
+
readonly cacheTtlSeconds: 3600;
|
|
81
|
+
};
|
|
82
|
+
readonly JWKS: {
|
|
83
|
+
readonly rotationDays: 90;
|
|
84
|
+
readonly overlapDays: 7;
|
|
85
|
+
readonly emergencyRevocationHours: 24;
|
|
86
|
+
};
|
|
87
|
+
readonly RECEIPT: {
|
|
88
|
+
readonly minReceiptIdLength: 16;
|
|
89
|
+
readonly maxReceiptIdLength: 64;
|
|
90
|
+
readonly defaultTtlSeconds: 86400;
|
|
91
|
+
};
|
|
92
|
+
readonly LIMITS: {
|
|
93
|
+
readonly maxAmountCents: 999999999999;
|
|
94
|
+
readonly minAmountCents: 1;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAG,kBAA2B,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;CAGV,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,IAAI;;;;CAIP,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;CAIV,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,MAAM;;;CAGT,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASZ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PEAC Protocol Constants
|
|
4
|
+
* Derived from specs/kernel/constants.json
|
|
5
|
+
*
|
|
6
|
+
* NOTE: This file is manually synced for v0.9.15.
|
|
7
|
+
* From v0.9.16+, this will be auto-generated via codegen.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CONSTANTS = exports.LIMITS = exports.RECEIPT = exports.JWKS = exports.DISCOVERY = exports.HEADERS = exports.ALGORITHMS = exports.WIRE_VERSION = exports.WIRE_TYPE = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Wire format type for PEAC receipts
|
|
13
|
+
* Frozen at peac.receipt/0.9 until v1.0.0
|
|
14
|
+
*/
|
|
15
|
+
exports.WIRE_TYPE = 'peac.receipt/0.9';
|
|
16
|
+
/**
|
|
17
|
+
* Wire format version (extracted from WIRE_TYPE)
|
|
18
|
+
* Use this for wire_version fields in receipts
|
|
19
|
+
*/
|
|
20
|
+
exports.WIRE_VERSION = '0.9';
|
|
21
|
+
/**
|
|
22
|
+
* Supported cryptographic algorithms
|
|
23
|
+
*/
|
|
24
|
+
exports.ALGORITHMS = {
|
|
25
|
+
supported: ['EdDSA'],
|
|
26
|
+
default: 'EdDSA',
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* HTTP header names for PEAC protocol
|
|
30
|
+
*/
|
|
31
|
+
exports.HEADERS = {
|
|
32
|
+
receipt: 'PEAC-Receipt',
|
|
33
|
+
dpop: 'DPoP',
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Discovery manifest settings
|
|
37
|
+
*/
|
|
38
|
+
exports.DISCOVERY = {
|
|
39
|
+
manifestPath: '/.well-known/peac.txt',
|
|
40
|
+
manifestVersion: 'peac/0.9',
|
|
41
|
+
cacheTtlSeconds: 3600,
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* JWKS rotation and revocation settings
|
|
45
|
+
*/
|
|
46
|
+
exports.JWKS = {
|
|
47
|
+
rotationDays: 90,
|
|
48
|
+
overlapDays: 7,
|
|
49
|
+
emergencyRevocationHours: 24,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Receipt validation constants
|
|
53
|
+
*/
|
|
54
|
+
exports.RECEIPT = {
|
|
55
|
+
minReceiptIdLength: 16,
|
|
56
|
+
maxReceiptIdLength: 64,
|
|
57
|
+
defaultTtlSeconds: 86400, // 24 hours
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Payment amount validation limits (in cents/smallest currency unit)
|
|
61
|
+
*/
|
|
62
|
+
exports.LIMITS = {
|
|
63
|
+
maxAmountCents: 999999999999,
|
|
64
|
+
minAmountCents: 1,
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* All constants export
|
|
68
|
+
*/
|
|
69
|
+
exports.CONSTANTS = {
|
|
70
|
+
WIRE_TYPE: exports.WIRE_TYPE,
|
|
71
|
+
WIRE_VERSION: exports.WIRE_VERSION,
|
|
72
|
+
ALGORITHMS: exports.ALGORITHMS,
|
|
73
|
+
HEADERS: exports.HEADERS,
|
|
74
|
+
DISCOVERY: exports.DISCOVERY,
|
|
75
|
+
JWKS: exports.JWKS,
|
|
76
|
+
RECEIPT: exports.RECEIPT,
|
|
77
|
+
LIMITS: exports.LIMITS,
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;GAGG;AACU,QAAA,SAAS,GAAG,kBAA2B,CAAC;AAErD;;;GAGG;AACU,QAAA,YAAY,GAAG,KAAc,CAAC;AAE3C;;GAEG;AACU,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE,CAAC,OAAO,CAAU;IAC7B,OAAO,EAAE,OAAgB;CACjB,CAAC;AAEX;;GAEG;AACU,QAAA,OAAO,GAAG;IACrB,OAAO,EAAE,cAAuB;IAChC,IAAI,EAAE,MAAe;CACb,CAAC;AAEX;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,YAAY,EAAE,uBAAgC;IAC9C,eAAe,EAAE,UAAmB;IACpC,eAAe,EAAE,IAAI;CACb,CAAC;AAEX;;GAEG;AACU,QAAA,IAAI,GAAG;IAClB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,CAAC;IACd,wBAAwB,EAAE,EAAE;CACpB,CAAC;AAEX;;GAEG;AACU,QAAA,OAAO,GAAG;IACrB,kBAAkB,EAAE,EAAE;IACtB,kBAAkB,EAAE,EAAE;IACtB,iBAAiB,EAAE,KAAK,EAAE,WAAW;CAC7B,CAAC;AAEX;;GAEG;AACU,QAAA,MAAM,GAAG;IACpB,cAAc,EAAE,YAAY;IAC5B,cAAc,EAAE,CAAC;CACT,CAAC;AAEX;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,SAAS,EAAT,iBAAS;IACT,YAAY,EAAZ,oBAAY;IACZ,UAAU,EAAV,kBAAU;IACV,OAAO,EAAP,eAAO;IACP,SAAS,EAAT,iBAAS;IACT,IAAI,EAAJ,YAAI;IACJ,OAAO,EAAP,eAAO;IACP,MAAM,EAAN,cAAM;CACE,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PEAC Protocol Error Codes
|
|
3
|
+
* Derived from specs/kernel/errors.json
|
|
4
|
+
*
|
|
5
|
+
* NOTE: This file is manually synced for v0.9.15.
|
|
6
|
+
* From v0.9.16+, this will be auto-generated via codegen.
|
|
7
|
+
*/
|
|
8
|
+
import type { ErrorDefinition } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Error code constants
|
|
11
|
+
*/
|
|
12
|
+
export declare const ERROR_CODES: {
|
|
13
|
+
readonly E_INVALID_SIGNATURE: "E_INVALID_SIGNATURE";
|
|
14
|
+
readonly E_INVALID_FORMAT: "E_INVALID_FORMAT";
|
|
15
|
+
readonly E_EXPIRED: "E_EXPIRED";
|
|
16
|
+
readonly E_NOT_YET_VALID: "E_NOT_YET_VALID";
|
|
17
|
+
readonly E_INVALID_ISSUER: "E_INVALID_ISSUER";
|
|
18
|
+
readonly E_INVALID_AUDIENCE: "E_INVALID_AUDIENCE";
|
|
19
|
+
readonly E_JWKS_FETCH_FAILED: "E_JWKS_FETCH_FAILED";
|
|
20
|
+
readonly E_KEY_NOT_FOUND: "E_KEY_NOT_FOUND";
|
|
21
|
+
readonly E_INVALID_AMOUNT: "E_INVALID_AMOUNT";
|
|
22
|
+
readonly E_INVALID_CURRENCY: "E_INVALID_CURRENCY";
|
|
23
|
+
readonly E_INVALID_RAIL: "E_INVALID_RAIL";
|
|
24
|
+
readonly E_MISSING_REQUIRED_CLAIM: "E_MISSING_REQUIRED_CLAIM";
|
|
25
|
+
readonly E_RATE_LIMITED: "E_RATE_LIMITED";
|
|
26
|
+
readonly E_CIRCUIT_BREAKER_OPEN: "E_CIRCUIT_BREAKER_OPEN";
|
|
27
|
+
readonly E_CONTROL_DENIED: "E_CONTROL_DENIED";
|
|
28
|
+
readonly E_CONTROL_REVIEW_REQUIRED: "E_CONTROL_REVIEW_REQUIRED";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Error definitions map
|
|
32
|
+
*/
|
|
33
|
+
export declare const ERRORS: Record<string, ErrorDefinition>;
|
|
34
|
+
/**
|
|
35
|
+
* Get error definition by code
|
|
36
|
+
*/
|
|
37
|
+
export declare function getError(code: string): ErrorDefinition | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Check if error is retriable
|
|
40
|
+
*/
|
|
41
|
+
export declare function isRetriable(code: string): boolean;
|
|
42
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;CAiBd,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAiIlD,CAAC;AAEF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAElE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PEAC Protocol Error Codes
|
|
4
|
+
* Derived from specs/kernel/errors.json
|
|
5
|
+
*
|
|
6
|
+
* NOTE: This file is manually synced for v0.9.15.
|
|
7
|
+
* From v0.9.16+, this will be auto-generated via codegen.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ERRORS = exports.ERROR_CODES = void 0;
|
|
11
|
+
exports.getError = getError;
|
|
12
|
+
exports.isRetriable = isRetriable;
|
|
13
|
+
/**
|
|
14
|
+
* Error code constants
|
|
15
|
+
*/
|
|
16
|
+
exports.ERROR_CODES = {
|
|
17
|
+
E_INVALID_SIGNATURE: 'E_INVALID_SIGNATURE',
|
|
18
|
+
E_INVALID_FORMAT: 'E_INVALID_FORMAT',
|
|
19
|
+
E_EXPIRED: 'E_EXPIRED',
|
|
20
|
+
E_NOT_YET_VALID: 'E_NOT_YET_VALID',
|
|
21
|
+
E_INVALID_ISSUER: 'E_INVALID_ISSUER',
|
|
22
|
+
E_INVALID_AUDIENCE: 'E_INVALID_AUDIENCE',
|
|
23
|
+
E_JWKS_FETCH_FAILED: 'E_JWKS_FETCH_FAILED',
|
|
24
|
+
E_KEY_NOT_FOUND: 'E_KEY_NOT_FOUND',
|
|
25
|
+
E_INVALID_AMOUNT: 'E_INVALID_AMOUNT',
|
|
26
|
+
E_INVALID_CURRENCY: 'E_INVALID_CURRENCY',
|
|
27
|
+
E_INVALID_RAIL: 'E_INVALID_RAIL',
|
|
28
|
+
E_MISSING_REQUIRED_CLAIM: 'E_MISSING_REQUIRED_CLAIM',
|
|
29
|
+
E_RATE_LIMITED: 'E_RATE_LIMITED',
|
|
30
|
+
E_CIRCUIT_BREAKER_OPEN: 'E_CIRCUIT_BREAKER_OPEN',
|
|
31
|
+
E_CONTROL_DENIED: 'E_CONTROL_DENIED',
|
|
32
|
+
E_CONTROL_REVIEW_REQUIRED: 'E_CONTROL_REVIEW_REQUIRED',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Error definitions map
|
|
36
|
+
*/
|
|
37
|
+
exports.ERRORS = {
|
|
38
|
+
E_INVALID_SIGNATURE: {
|
|
39
|
+
code: 'E_INVALID_SIGNATURE',
|
|
40
|
+
http_status: 400,
|
|
41
|
+
title: 'Invalid Signature',
|
|
42
|
+
description: 'Receipt signature verification failed',
|
|
43
|
+
retriable: false,
|
|
44
|
+
category: 'verification',
|
|
45
|
+
},
|
|
46
|
+
E_INVALID_FORMAT: {
|
|
47
|
+
code: 'E_INVALID_FORMAT',
|
|
48
|
+
http_status: 400,
|
|
49
|
+
title: 'Invalid Format',
|
|
50
|
+
description: 'Receipt does not conform to JWS format',
|
|
51
|
+
retriable: false,
|
|
52
|
+
category: 'validation',
|
|
53
|
+
},
|
|
54
|
+
E_EXPIRED: {
|
|
55
|
+
code: 'E_EXPIRED',
|
|
56
|
+
http_status: 400,
|
|
57
|
+
title: 'Receipt Expired',
|
|
58
|
+
description: 'Receipt has exceeded its expiration time',
|
|
59
|
+
retriable: false,
|
|
60
|
+
category: 'validation',
|
|
61
|
+
},
|
|
62
|
+
E_NOT_YET_VALID: {
|
|
63
|
+
code: 'E_NOT_YET_VALID',
|
|
64
|
+
http_status: 400,
|
|
65
|
+
title: 'Not Yet Valid',
|
|
66
|
+
description: 'Receipt nbf (not before) time is in the future',
|
|
67
|
+
retriable: true,
|
|
68
|
+
category: 'validation',
|
|
69
|
+
},
|
|
70
|
+
E_INVALID_ISSUER: {
|
|
71
|
+
code: 'E_INVALID_ISSUER',
|
|
72
|
+
http_status: 400,
|
|
73
|
+
title: 'Invalid Issuer',
|
|
74
|
+
description: 'Receipt issuer claim is invalid or untrusted',
|
|
75
|
+
retriable: false,
|
|
76
|
+
category: 'validation',
|
|
77
|
+
},
|
|
78
|
+
E_INVALID_AUDIENCE: {
|
|
79
|
+
code: 'E_INVALID_AUDIENCE',
|
|
80
|
+
http_status: 400,
|
|
81
|
+
title: 'Invalid Audience',
|
|
82
|
+
description: 'Receipt audience claim does not match expected value',
|
|
83
|
+
retriable: false,
|
|
84
|
+
category: 'validation',
|
|
85
|
+
},
|
|
86
|
+
E_JWKS_FETCH_FAILED: {
|
|
87
|
+
code: 'E_JWKS_FETCH_FAILED',
|
|
88
|
+
http_status: 503,
|
|
89
|
+
title: 'JWKS Fetch Failed',
|
|
90
|
+
description: 'Failed to fetch public keys from JWKS endpoint',
|
|
91
|
+
retriable: true,
|
|
92
|
+
category: 'infrastructure',
|
|
93
|
+
},
|
|
94
|
+
E_KEY_NOT_FOUND: {
|
|
95
|
+
code: 'E_KEY_NOT_FOUND',
|
|
96
|
+
http_status: 400,
|
|
97
|
+
title: 'Key Not Found',
|
|
98
|
+
description: 'Public key with specified kid not found in JWKS',
|
|
99
|
+
retriable: false,
|
|
100
|
+
category: 'verification',
|
|
101
|
+
},
|
|
102
|
+
E_INVALID_AMOUNT: {
|
|
103
|
+
code: 'E_INVALID_AMOUNT',
|
|
104
|
+
http_status: 400,
|
|
105
|
+
title: 'Invalid Amount',
|
|
106
|
+
description: 'Payment amount is invalid or out of allowed range',
|
|
107
|
+
retriable: false,
|
|
108
|
+
category: 'validation',
|
|
109
|
+
},
|
|
110
|
+
E_INVALID_CURRENCY: {
|
|
111
|
+
code: 'E_INVALID_CURRENCY',
|
|
112
|
+
http_status: 400,
|
|
113
|
+
title: 'Invalid Currency',
|
|
114
|
+
description: 'Currency code is not a valid ISO 4217 code',
|
|
115
|
+
retriable: false,
|
|
116
|
+
category: 'validation',
|
|
117
|
+
},
|
|
118
|
+
E_INVALID_RAIL: {
|
|
119
|
+
code: 'E_INVALID_RAIL',
|
|
120
|
+
http_status: 400,
|
|
121
|
+
title: 'Invalid Payment Rail',
|
|
122
|
+
description: 'Payment rail identifier is not recognized',
|
|
123
|
+
retriable: false,
|
|
124
|
+
category: 'validation',
|
|
125
|
+
},
|
|
126
|
+
E_MISSING_REQUIRED_CLAIM: {
|
|
127
|
+
code: 'E_MISSING_REQUIRED_CLAIM',
|
|
128
|
+
http_status: 400,
|
|
129
|
+
title: 'Missing Required Claim',
|
|
130
|
+
description: 'Receipt is missing a required JWT claim',
|
|
131
|
+
retriable: false,
|
|
132
|
+
category: 'validation',
|
|
133
|
+
},
|
|
134
|
+
E_RATE_LIMITED: {
|
|
135
|
+
code: 'E_RATE_LIMITED',
|
|
136
|
+
http_status: 429,
|
|
137
|
+
title: 'Rate Limited',
|
|
138
|
+
description: 'Too many requests, please retry later',
|
|
139
|
+
retriable: true,
|
|
140
|
+
category: 'infrastructure',
|
|
141
|
+
},
|
|
142
|
+
E_CIRCUIT_BREAKER_OPEN: {
|
|
143
|
+
code: 'E_CIRCUIT_BREAKER_OPEN',
|
|
144
|
+
http_status: 503,
|
|
145
|
+
title: 'Circuit Breaker Open',
|
|
146
|
+
description: 'Service temporarily unavailable due to circuit breaker',
|
|
147
|
+
retriable: true,
|
|
148
|
+
category: 'infrastructure',
|
|
149
|
+
},
|
|
150
|
+
E_CONTROL_DENIED: {
|
|
151
|
+
code: 'E_CONTROL_DENIED',
|
|
152
|
+
http_status: 403,
|
|
153
|
+
title: 'Control Decision Denied',
|
|
154
|
+
description: 'Control engine denied authorization',
|
|
155
|
+
retriable: false,
|
|
156
|
+
category: 'control',
|
|
157
|
+
},
|
|
158
|
+
E_CONTROL_REVIEW_REQUIRED: {
|
|
159
|
+
code: 'E_CONTROL_REVIEW_REQUIRED',
|
|
160
|
+
http_status: 202,
|
|
161
|
+
title: 'Review Required',
|
|
162
|
+
description: 'Control engine requires manual review',
|
|
163
|
+
retriable: true,
|
|
164
|
+
category: 'control',
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Get error definition by code
|
|
169
|
+
*/
|
|
170
|
+
function getError(code) {
|
|
171
|
+
return exports.ERRORS[code];
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Check if error is retriable
|
|
175
|
+
*/
|
|
176
|
+
function isRetriable(code) {
|
|
177
|
+
return exports.ERRORS[code]?.retriable ?? false;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;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11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PEAC Kernel
|
|
3
|
+
* Normative constants, errors, and registries for the PEAC protocol
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
export type { ErrorDefinition, PaymentRailEntry, ControlEngineEntry, TransportMethodEntry, AgentProtocolEntry, } from './types.js';
|
|
8
|
+
export { WIRE_TYPE, WIRE_VERSION, ALGORITHMS, HEADERS, DISCOVERY, JWKS, RECEIPT, LIMITS, CONSTANTS, } from './constants.js';
|
|
9
|
+
export { ERROR_CODES, ERRORS, getError, isRetriable } from './errors.js';
|
|
10
|
+
export { PAYMENT_RAILS, CONTROL_ENGINES, TRANSPORT_METHODS, AGENT_PROTOCOLS, REGISTRIES, findPaymentRail, findControlEngine, findTransportMethod, findAgentProtocol, } from './registries.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,OAAO,EACP,SAAS,EACT,IAAI,EACJ,OAAO,EACP,MAAM,EACN,SAAS,GACV,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PEAC Kernel
|
|
4
|
+
* Normative constants, errors, and registries for the PEAC protocol
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.findAgentProtocol = exports.findTransportMethod = exports.findControlEngine = exports.findPaymentRail = exports.REGISTRIES = exports.AGENT_PROTOCOLS = exports.TRANSPORT_METHODS = exports.CONTROL_ENGINES = exports.PAYMENT_RAILS = exports.isRetriable = exports.getError = exports.ERRORS = exports.ERROR_CODES = exports.CONSTANTS = exports.LIMITS = exports.RECEIPT = exports.JWKS = exports.DISCOVERY = exports.HEADERS = exports.ALGORITHMS = exports.WIRE_VERSION = exports.WIRE_TYPE = void 0;
|
|
10
|
+
// Export constants
|
|
11
|
+
var constants_js_1 = require("./constants.js");
|
|
12
|
+
Object.defineProperty(exports, "WIRE_TYPE", { enumerable: true, get: function () { return constants_js_1.WIRE_TYPE; } });
|
|
13
|
+
Object.defineProperty(exports, "WIRE_VERSION", { enumerable: true, get: function () { return constants_js_1.WIRE_VERSION; } });
|
|
14
|
+
Object.defineProperty(exports, "ALGORITHMS", { enumerable: true, get: function () { return constants_js_1.ALGORITHMS; } });
|
|
15
|
+
Object.defineProperty(exports, "HEADERS", { enumerable: true, get: function () { return constants_js_1.HEADERS; } });
|
|
16
|
+
Object.defineProperty(exports, "DISCOVERY", { enumerable: true, get: function () { return constants_js_1.DISCOVERY; } });
|
|
17
|
+
Object.defineProperty(exports, "JWKS", { enumerable: true, get: function () { return constants_js_1.JWKS; } });
|
|
18
|
+
Object.defineProperty(exports, "RECEIPT", { enumerable: true, get: function () { return constants_js_1.RECEIPT; } });
|
|
19
|
+
Object.defineProperty(exports, "LIMITS", { enumerable: true, get: function () { return constants_js_1.LIMITS; } });
|
|
20
|
+
Object.defineProperty(exports, "CONSTANTS", { enumerable: true, get: function () { return constants_js_1.CONSTANTS; } });
|
|
21
|
+
// Export errors
|
|
22
|
+
var errors_js_1 = require("./errors.js");
|
|
23
|
+
Object.defineProperty(exports, "ERROR_CODES", { enumerable: true, get: function () { return errors_js_1.ERROR_CODES; } });
|
|
24
|
+
Object.defineProperty(exports, "ERRORS", { enumerable: true, get: function () { return errors_js_1.ERRORS; } });
|
|
25
|
+
Object.defineProperty(exports, "getError", { enumerable: true, get: function () { return errors_js_1.getError; } });
|
|
26
|
+
Object.defineProperty(exports, "isRetriable", { enumerable: true, get: function () { return errors_js_1.isRetriable; } });
|
|
27
|
+
// Export registries
|
|
28
|
+
var registries_js_1 = require("./registries.js");
|
|
29
|
+
Object.defineProperty(exports, "PAYMENT_RAILS", { enumerable: true, get: function () { return registries_js_1.PAYMENT_RAILS; } });
|
|
30
|
+
Object.defineProperty(exports, "CONTROL_ENGINES", { enumerable: true, get: function () { return registries_js_1.CONTROL_ENGINES; } });
|
|
31
|
+
Object.defineProperty(exports, "TRANSPORT_METHODS", { enumerable: true, get: function () { return registries_js_1.TRANSPORT_METHODS; } });
|
|
32
|
+
Object.defineProperty(exports, "AGENT_PROTOCOLS", { enumerable: true, get: function () { return registries_js_1.AGENT_PROTOCOLS; } });
|
|
33
|
+
Object.defineProperty(exports, "REGISTRIES", { enumerable: true, get: function () { return registries_js_1.REGISTRIES; } });
|
|
34
|
+
Object.defineProperty(exports, "findPaymentRail", { enumerable: true, get: function () { return registries_js_1.findPaymentRail; } });
|
|
35
|
+
Object.defineProperty(exports, "findControlEngine", { enumerable: true, get: function () { return registries_js_1.findControlEngine; } });
|
|
36
|
+
Object.defineProperty(exports, "findTransportMethod", { enumerable: true, get: function () { return registries_js_1.findTransportMethod; } });
|
|
37
|
+
Object.defineProperty(exports, "findAgentProtocol", { enumerable: true, get: function () { return registries_js_1.findAgentProtocol; } });
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAWH,mBAAmB;AACnB,+CAUwB;AATtB,yGAAA,SAAS,OAAA;AACT,4GAAA,YAAY,OAAA;AACZ,0GAAA,UAAU,OAAA;AACV,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,oGAAA,IAAI,OAAA;AACJ,uGAAA,OAAO,OAAA;AACP,sGAAA,MAAM,OAAA;AACN,yGAAA,SAAS,OAAA;AAGX,gBAAgB;AAChB,yCAAyE;AAAhE,wGAAA,WAAW,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAAE,wGAAA,WAAW,OAAA;AAEnD,oBAAoB;AACpB,iDAUyB;AATvB,8GAAA,aAAa,OAAA;AACb,gHAAA,eAAe,OAAA;AACf,kHAAA,iBAAiB,OAAA;AACjB,gHAAA,eAAe,OAAA;AACf,2GAAA,UAAU,OAAA;AACV,gHAAA,eAAe,OAAA;AACf,kHAAA,iBAAiB,OAAA;AACjB,oHAAA,mBAAmB,OAAA;AACnB,kHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PEAC Protocol Registries
|
|
3
|
+
* Derived from specs/kernel/registries.json
|
|
4
|
+
*
|
|
5
|
+
* NOTE: This file is manually synced for v0.9.15.
|
|
6
|
+
* From v0.9.16+, this will be auto-generated via codegen.
|
|
7
|
+
*/
|
|
8
|
+
import type { PaymentRailEntry, ControlEngineEntry, TransportMethodEntry, AgentProtocolEntry } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Payment Rails Registry
|
|
11
|
+
* Settlement layer identifiers
|
|
12
|
+
*/
|
|
13
|
+
export declare const PAYMENT_RAILS: readonly PaymentRailEntry[];
|
|
14
|
+
/**
|
|
15
|
+
* Control Engines Registry
|
|
16
|
+
* Governance and authorization engine identifiers
|
|
17
|
+
*/
|
|
18
|
+
export declare const CONTROL_ENGINES: readonly ControlEngineEntry[];
|
|
19
|
+
/**
|
|
20
|
+
* Transport Methods Registry
|
|
21
|
+
* Transport-layer binding identifiers
|
|
22
|
+
*/
|
|
23
|
+
export declare const TRANSPORT_METHODS: readonly TransportMethodEntry[];
|
|
24
|
+
/**
|
|
25
|
+
* Agent Protocols Registry
|
|
26
|
+
* Agentic protocol integration identifiers
|
|
27
|
+
*/
|
|
28
|
+
export declare const AGENT_PROTOCOLS: readonly AgentProtocolEntry[];
|
|
29
|
+
/**
|
|
30
|
+
* All registries export
|
|
31
|
+
*/
|
|
32
|
+
export declare const REGISTRIES: {
|
|
33
|
+
readonly payment_rails: readonly PaymentRailEntry[];
|
|
34
|
+
readonly control_engines: readonly ControlEngineEntry[];
|
|
35
|
+
readonly transport_methods: readonly TransportMethodEntry[];
|
|
36
|
+
readonly agent_protocols: readonly AgentProtocolEntry[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Find payment rail by ID
|
|
40
|
+
*/
|
|
41
|
+
export declare function findPaymentRail(id: string): PaymentRailEntry | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Find control engine by ID
|
|
44
|
+
*/
|
|
45
|
+
export declare function findControlEngine(id: string): ControlEngineEntry | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Find transport method by ID
|
|
48
|
+
*/
|
|
49
|
+
export declare function findTransportMethod(id: string): TransportMethodEntry | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Find agent protocol by ID
|
|
52
|
+
*/
|
|
53
|
+
export declare function findAgentProtocol(id: string): AgentProtocolEntry | undefined;
|
|
54
|
+
//# sourceMappingURL=registries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../src/registries.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,gBAAgB,EA6B3C,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,kBAAkB,EAsB/C,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,oBAAoB,EAsBnD,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,kBAAkB,EA6B/C,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAEX;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAExE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAE5E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAEhF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAE5E"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PEAC Protocol Registries
|
|
4
|
+
* Derived from specs/kernel/registries.json
|
|
5
|
+
*
|
|
6
|
+
* NOTE: This file is manually synced for v0.9.15.
|
|
7
|
+
* From v0.9.16+, this will be auto-generated via codegen.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.REGISTRIES = exports.AGENT_PROTOCOLS = exports.TRANSPORT_METHODS = exports.CONTROL_ENGINES = exports.PAYMENT_RAILS = void 0;
|
|
11
|
+
exports.findPaymentRail = findPaymentRail;
|
|
12
|
+
exports.findControlEngine = findControlEngine;
|
|
13
|
+
exports.findTransportMethod = findTransportMethod;
|
|
14
|
+
exports.findAgentProtocol = findAgentProtocol;
|
|
15
|
+
/**
|
|
16
|
+
* Payment Rails Registry
|
|
17
|
+
* Settlement layer identifiers
|
|
18
|
+
*/
|
|
19
|
+
exports.PAYMENT_RAILS = [
|
|
20
|
+
{
|
|
21
|
+
id: 'x402',
|
|
22
|
+
category: 'agentic-payment',
|
|
23
|
+
description: 'HTTP 402-based paid call receipts',
|
|
24
|
+
reference: 'https://www.x402.org/',
|
|
25
|
+
status: 'informational',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'l402',
|
|
29
|
+
category: 'agentic-payment',
|
|
30
|
+
description: 'Lightning HTTP 402 Protocol (LSAT-based)',
|
|
31
|
+
reference: 'https://docs.lightning.engineering/the-lightning-network/l402',
|
|
32
|
+
status: 'informational',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'card-network',
|
|
36
|
+
category: 'card',
|
|
37
|
+
description: 'Generic card network authorizations/clearing',
|
|
38
|
+
reference: null,
|
|
39
|
+
status: 'informational',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'upi',
|
|
43
|
+
category: 'account-to-account',
|
|
44
|
+
description: 'Unified Payments Interface',
|
|
45
|
+
reference: 'https://www.npci.org.in/',
|
|
46
|
+
status: 'informational',
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
50
|
+
* Control Engines Registry
|
|
51
|
+
* Governance and authorization engine identifiers
|
|
52
|
+
*/
|
|
53
|
+
exports.CONTROL_ENGINES = [
|
|
54
|
+
{
|
|
55
|
+
id: 'spend-control-service',
|
|
56
|
+
category: 'limits',
|
|
57
|
+
description: 'Generic spend control decisions (per-tx, daily, monthly limits)',
|
|
58
|
+
reference: null,
|
|
59
|
+
status: 'informational',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'risk-engine',
|
|
63
|
+
category: 'fraud',
|
|
64
|
+
description: 'Generic risk/fraud scoring engine',
|
|
65
|
+
reference: null,
|
|
66
|
+
status: 'informational',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'mandate-service',
|
|
70
|
+
category: 'mandate',
|
|
71
|
+
description: 'Generic enterprise mandate/approval chain evaluator',
|
|
72
|
+
reference: null,
|
|
73
|
+
status: 'informational',
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
/**
|
|
77
|
+
* Transport Methods Registry
|
|
78
|
+
* Transport-layer binding identifiers
|
|
79
|
+
*/
|
|
80
|
+
exports.TRANSPORT_METHODS = [
|
|
81
|
+
{
|
|
82
|
+
id: 'dpop',
|
|
83
|
+
category: 'proof-of-possession',
|
|
84
|
+
description: 'Demonstrating Proof-of-Possession at the Application Layer',
|
|
85
|
+
reference: 'https://www.rfc-editor.org/rfc/rfc9449',
|
|
86
|
+
status: 'informational',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'http-signature',
|
|
90
|
+
category: 'message-signature',
|
|
91
|
+
description: 'HTTP Message Signatures',
|
|
92
|
+
reference: 'https://www.rfc-editor.org/rfc/rfc9421',
|
|
93
|
+
status: 'informational',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'none',
|
|
97
|
+
category: 'none',
|
|
98
|
+
description: 'No transport binding',
|
|
99
|
+
reference: null,
|
|
100
|
+
status: 'informational',
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
/**
|
|
104
|
+
* Agent Protocols Registry
|
|
105
|
+
* Agentic protocol integration identifiers
|
|
106
|
+
*/
|
|
107
|
+
exports.AGENT_PROTOCOLS = [
|
|
108
|
+
{
|
|
109
|
+
id: 'mcp',
|
|
110
|
+
category: 'tool-protocol',
|
|
111
|
+
description: 'Model Context Protocol (MCP)',
|
|
112
|
+
reference: 'https://modelcontextprotocol.io/',
|
|
113
|
+
status: 'informational',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'acp',
|
|
117
|
+
category: 'commerce-protocol',
|
|
118
|
+
description: 'Agentic Commerce Protocol',
|
|
119
|
+
reference: null,
|
|
120
|
+
status: 'informational',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: 'ap2',
|
|
124
|
+
category: 'agent-protocol',
|
|
125
|
+
description: 'Google Agent Protocol v2',
|
|
126
|
+
reference: null,
|
|
127
|
+
status: 'informational',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: 'tap',
|
|
131
|
+
category: 'card-protocol',
|
|
132
|
+
description: 'Trusted Agent Protocol (Visa TAP)',
|
|
133
|
+
reference: 'https://developer.visa.com/',
|
|
134
|
+
status: 'informational',
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
/**
|
|
138
|
+
* All registries export
|
|
139
|
+
*/
|
|
140
|
+
exports.REGISTRIES = {
|
|
141
|
+
payment_rails: exports.PAYMENT_RAILS,
|
|
142
|
+
control_engines: exports.CONTROL_ENGINES,
|
|
143
|
+
transport_methods: exports.TRANSPORT_METHODS,
|
|
144
|
+
agent_protocols: exports.AGENT_PROTOCOLS,
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Find payment rail by ID
|
|
148
|
+
*/
|
|
149
|
+
function findPaymentRail(id) {
|
|
150
|
+
return exports.PAYMENT_RAILS.find((rail) => rail.id === id);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Find control engine by ID
|
|
154
|
+
*/
|
|
155
|
+
function findControlEngine(id) {
|
|
156
|
+
return exports.CONTROL_ENGINES.find((engine) => engine.id === id);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Find transport method by ID
|
|
160
|
+
*/
|
|
161
|
+
function findTransportMethod(id) {
|
|
162
|
+
return exports.TRANSPORT_METHODS.find((method) => method.id === id);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Find agent protocol by ID
|
|
166
|
+
*/
|
|
167
|
+
function findAgentProtocol(id) {
|
|
168
|
+
return exports.AGENT_PROTOCOLS.find((protocol) => protocol.id === id);
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=registries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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Aa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,EAAU;IAC1C,OAAO,uBAAe,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,EAAU;IAC5C,OAAO,yBAAiB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,EAAU;IAC1C,OAAO,uBAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PEAC Kernel Types
|
|
3
|
+
* Shared type definitions for kernel exports
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Error code definition
|
|
7
|
+
*/
|
|
8
|
+
export interface ErrorDefinition {
|
|
9
|
+
code: string;
|
|
10
|
+
http_status: number;
|
|
11
|
+
title: string;
|
|
12
|
+
description: string;
|
|
13
|
+
retriable: boolean;
|
|
14
|
+
category: 'verification' | 'validation' | 'infrastructure' | 'control';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Payment rail registry entry
|
|
18
|
+
*/
|
|
19
|
+
export interface PaymentRailEntry {
|
|
20
|
+
id: string;
|
|
21
|
+
category: string;
|
|
22
|
+
description: string;
|
|
23
|
+
reference: string | null;
|
|
24
|
+
status: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Control engine registry entry
|
|
28
|
+
*/
|
|
29
|
+
export interface ControlEngineEntry {
|
|
30
|
+
id: string;
|
|
31
|
+
category: string;
|
|
32
|
+
description: string;
|
|
33
|
+
reference: string | null;
|
|
34
|
+
status: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Transport method registry entry
|
|
38
|
+
*/
|
|
39
|
+
export interface TransportMethodEntry {
|
|
40
|
+
id: string;
|
|
41
|
+
category: string;
|
|
42
|
+
description: string;
|
|
43
|
+
reference: string | null;
|
|
44
|
+
status: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Agent protocol registry entry
|
|
48
|
+
*/
|
|
49
|
+
export interface AgentProtocolEntry {
|
|
50
|
+
id: string;
|
|
51
|
+
category: string;
|
|
52
|
+
description: string;
|
|
53
|
+
reference: string | null;
|
|
54
|
+
status: string;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,cAAc,GAAG,YAAY,GAAG,gBAAgB,GAAG,SAAS,CAAC;CACxE;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@peac/kernel",
|
|
3
|
+
"version": "0.9.18",
|
|
4
|
+
"description": "PEAC protocol kernel - normative constants, errors, and registries",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./constants": {
|
|
15
|
+
"types": "./dist/constants.d.ts",
|
|
16
|
+
"import": "./dist/constants.js",
|
|
17
|
+
"require": "./dist/constants.js",
|
|
18
|
+
"default": "./dist/constants.js"
|
|
19
|
+
},
|
|
20
|
+
"./errors": {
|
|
21
|
+
"types": "./dist/errors.d.ts",
|
|
22
|
+
"import": "./dist/errors.js",
|
|
23
|
+
"require": "./dist/errors.js",
|
|
24
|
+
"default": "./dist/errors.js"
|
|
25
|
+
},
|
|
26
|
+
"./registries": {
|
|
27
|
+
"types": "./dist/registries.d.ts",
|
|
28
|
+
"import": "./dist/registries.js",
|
|
29
|
+
"require": "./dist/registries.js",
|
|
30
|
+
"default": "./dist/registries.js"
|
|
31
|
+
},
|
|
32
|
+
"./types": {
|
|
33
|
+
"types": "./dist/types.d.ts",
|
|
34
|
+
"import": "./dist/types.js",
|
|
35
|
+
"require": "./dist/types.js",
|
|
36
|
+
"default": "./dist/types.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
42
|
+
"typecheck": "tsc --noEmit"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"peac",
|
|
46
|
+
"protocol",
|
|
47
|
+
"kernel",
|
|
48
|
+
"constants",
|
|
49
|
+
"errors",
|
|
50
|
+
"registries"
|
|
51
|
+
],
|
|
52
|
+
"author": "PEAC Protocol Contributors",
|
|
53
|
+
"license": "Apache-2.0",
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "https://github.com/peacprotocol/peac.git",
|
|
57
|
+
"directory": "packages/kernel"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/peacprotocol/peac/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/peacprotocol/peac#readme",
|
|
63
|
+
"files": [
|
|
64
|
+
"dist",
|
|
65
|
+
"README.md"
|
|
66
|
+
],
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"typescript": "^5.6.2"
|
|
72
|
+
}
|
|
73
|
+
}
|