@peac/middleware-core 0.10.9
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/LICENSE +190 -0
- package/README.md +86 -0
- package/dist/config.d.ts +66 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +226 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/rate-limit.d.ts +49 -0
- package/dist/rate-limit.d.ts.map +1 -0
- package/dist/rate-limit.js +67 -0
- package/dist/rate-limit.js.map +1 -0
- package/dist/receipt.d.ts +58 -0
- package/dist/receipt.d.ts.map +1 -0
- package/dist/receipt.js +256 -0
- package/dist/receipt.js.map +1 -0
- package/dist/transport.d.ts +89 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +173 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +131 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Transport Profile Selection and Response Wrapping
|
|
4
|
+
*
|
|
5
|
+
* Implements transport profile selection and body wrapping per TRANSPORT-PROFILES.md.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.selectTransport = selectTransport;
|
|
11
|
+
exports.wrapResponse = wrapResponse;
|
|
12
|
+
exports.buildResponseHeaders = buildResponseHeaders;
|
|
13
|
+
exports.buildReceiptResult = buildReceiptResult;
|
|
14
|
+
const kernel_1 = require("@peac/kernel");
|
|
15
|
+
const crypto_1 = require("@peac/crypto");
|
|
16
|
+
const config_js_1 = require("./config.js");
|
|
17
|
+
/**
|
|
18
|
+
* Maximum pointer header size (prevents oversized headers)
|
|
19
|
+
*/
|
|
20
|
+
const MAX_POINTER_HEADER_SIZE = 2048;
|
|
21
|
+
/**
|
|
22
|
+
* Validate pointer URL for safety (SSRF prevention and header injection)
|
|
23
|
+
*
|
|
24
|
+
* @throws Error if URL is invalid or unsafe
|
|
25
|
+
*/
|
|
26
|
+
function validatePointerUrl(url) {
|
|
27
|
+
// Must be absolute HTTPS URL
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = new URL(url);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
throw new Error('Pointer URL is not a valid URL');
|
|
34
|
+
}
|
|
35
|
+
if (parsed.protocol !== 'https:') {
|
|
36
|
+
throw new Error('Pointer URL must use HTTPS');
|
|
37
|
+
}
|
|
38
|
+
// Prevent header injection via URL content
|
|
39
|
+
// RFC 8941 quoted strings cannot contain " or \ without escaping
|
|
40
|
+
if (url.includes('"') || url.includes('\\')) {
|
|
41
|
+
throw new Error('Pointer URL contains invalid characters for structured header');
|
|
42
|
+
}
|
|
43
|
+
// Control characters are never valid in headers
|
|
44
|
+
// eslint-disable-next-line no-control-regex
|
|
45
|
+
if (/[\x00-\x1f\x7f]/.test(url)) {
|
|
46
|
+
throw new Error('Pointer URL contains control characters');
|
|
47
|
+
}
|
|
48
|
+
// Sanity check on length to prevent oversized headers
|
|
49
|
+
if (url.length > MAX_POINTER_HEADER_SIZE) {
|
|
50
|
+
throw new Error(`Pointer URL exceeds maximum length (${MAX_POINTER_HEADER_SIZE})`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Calculate receipt size and determine appropriate transport
|
|
55
|
+
*
|
|
56
|
+
* Falls back from header to body if receipt exceeds maxHeaderSize.
|
|
57
|
+
* Pointer transport is only used if explicitly configured (never auto-selected).
|
|
58
|
+
*
|
|
59
|
+
* @param receipt - JWS compact serialization
|
|
60
|
+
* @param config - Transport configuration (optional fields)
|
|
61
|
+
* @returns Selected transport profile
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const transport = selectTransport(receipt, { maxHeaderSize: 4096 });
|
|
66
|
+
* // Returns 'header' if receipt fits, 'body' otherwise
|
|
67
|
+
*
|
|
68
|
+
* // Also accepts empty config for defaults
|
|
69
|
+
* const transport = selectTransport(receipt, {});
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
function selectTransport(receipt, config = {}) {
|
|
73
|
+
const preferredTransport = config.transport ?? config_js_1.CONFIG_DEFAULTS.transport;
|
|
74
|
+
const maxHeaderSize = config.maxHeaderSize ?? config_js_1.CONFIG_DEFAULTS.maxHeaderSize;
|
|
75
|
+
// Pointer is only used when explicitly configured
|
|
76
|
+
if (preferredTransport === 'pointer') {
|
|
77
|
+
return 'pointer';
|
|
78
|
+
}
|
|
79
|
+
// Body is used when explicitly configured
|
|
80
|
+
if (preferredTransport === 'body') {
|
|
81
|
+
return 'body';
|
|
82
|
+
}
|
|
83
|
+
// For header preference, check size and fallback to body if needed
|
|
84
|
+
// Header profile uses the receipt directly as the header value
|
|
85
|
+
const receiptBytes = new TextEncoder().encode(receipt);
|
|
86
|
+
if (receiptBytes.length > maxHeaderSize) {
|
|
87
|
+
return 'body';
|
|
88
|
+
}
|
|
89
|
+
return 'header';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Wrap a response body with a PEAC receipt (for body transport profile)
|
|
93
|
+
*
|
|
94
|
+
* Creates a wrapper object containing the original data and the receipt.
|
|
95
|
+
* Per TRANSPORT-PROFILES.md, the body format is:
|
|
96
|
+
* `{ "data": <original>, "peac_receipt": "<jws>" }`
|
|
97
|
+
*
|
|
98
|
+
* @param data - Original response body
|
|
99
|
+
* @param receipt - JWS compact serialization
|
|
100
|
+
* @returns Wrapped response body
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const original = { items: [1, 2, 3] };
|
|
105
|
+
* const wrapped = wrapResponse(original, receipt);
|
|
106
|
+
* // { data: { items: [1, 2, 3] }, peac_receipt: "eyJ..." }
|
|
107
|
+
* res.json(wrapped);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
function wrapResponse(data, receipt) {
|
|
111
|
+
return {
|
|
112
|
+
data,
|
|
113
|
+
peac_receipt: receipt,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Build response headers for a receipt based on transport profile
|
|
118
|
+
*
|
|
119
|
+
* For header profile: adds PEAC-Receipt header
|
|
120
|
+
* For pointer profile: adds PEAC-Receipt-Pointer header
|
|
121
|
+
* For body profile: returns empty headers (receipt is in body)
|
|
122
|
+
*
|
|
123
|
+
* @param receipt - JWS compact serialization
|
|
124
|
+
* @param transport - Transport profile to use
|
|
125
|
+
* @param pointerUrl - URL for pointer profile (required if transport is 'pointer')
|
|
126
|
+
* @returns Headers to add to response
|
|
127
|
+
*/
|
|
128
|
+
async function buildResponseHeaders(receipt, transport, pointerUrl) {
|
|
129
|
+
switch (transport) {
|
|
130
|
+
case 'header':
|
|
131
|
+
return {
|
|
132
|
+
[kernel_1.HEADERS.receipt]: receipt,
|
|
133
|
+
};
|
|
134
|
+
case 'pointer': {
|
|
135
|
+
if (!pointerUrl) {
|
|
136
|
+
throw new Error('pointerUrl is required for pointer transport');
|
|
137
|
+
}
|
|
138
|
+
// Validate pointer URL (SSRF prevention, header injection prevention)
|
|
139
|
+
validatePointerUrl(pointerUrl);
|
|
140
|
+
// Compute SHA-256 digest of receipt (lowercase hex)
|
|
141
|
+
const digestHex = await (0, crypto_1.sha256Hex)(receipt);
|
|
142
|
+
// RFC 8941 structured header dictionary format with quoted strings
|
|
143
|
+
return {
|
|
144
|
+
[kernel_1.HEADERS.receiptPointer]: `sha256="${digestHex}", url="${pointerUrl}"`,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
case 'body':
|
|
148
|
+
// No headers for body profile
|
|
149
|
+
return {};
|
|
150
|
+
default:
|
|
151
|
+
throw new Error(`Unknown transport profile: ${transport}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Build complete receipt result with headers and optional body wrapper
|
|
156
|
+
*
|
|
157
|
+
* @param input - Receipt and transport information
|
|
158
|
+
* @returns Complete receipt result ready for response
|
|
159
|
+
*/
|
|
160
|
+
async function buildReceiptResult(input) {
|
|
161
|
+
const headers = await buildResponseHeaders(input.receipt, input.transport, input.pointerUrl);
|
|
162
|
+
const result = {
|
|
163
|
+
receipt: input.receipt,
|
|
164
|
+
transport: input.transport,
|
|
165
|
+
headers,
|
|
166
|
+
};
|
|
167
|
+
// Add body wrapper for body transport
|
|
168
|
+
if (input.transport === 'body' && input.originalBody !== undefined) {
|
|
169
|
+
result.bodyWrapper = wrapResponse(input.originalBody, input.receipt);
|
|
170
|
+
}
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAmEH,0CAyBC;AAqBD,oCAKC;AAcD,oDAgCC;AAkBD,gDAyBC;AA7MD,yCAAuC;AACvC,yCAAyC;AACzC,2CAA8C;AAG9C;;GAEG;AACH,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,GAAW;IACrC,6BAA6B;IAC7B,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACh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AS,EAAE,CAAC;QACnE,MAAM,CAAC,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PEAC Middleware Core Types
|
|
3
|
+
*
|
|
4
|
+
* Framework-agnostic type definitions for PEAC receipt issuance middleware.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Ed25519 private key in JWK format
|
|
10
|
+
*/
|
|
11
|
+
export interface Ed25519PrivateJwk {
|
|
12
|
+
kty: 'OKP';
|
|
13
|
+
crv: 'Ed25519';
|
|
14
|
+
/** Public key (base64url, 32 bytes) */
|
|
15
|
+
x: string;
|
|
16
|
+
/** Private key (base64url, 32 bytes) */
|
|
17
|
+
d: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Interaction binding mode for privacy control
|
|
21
|
+
*
|
|
22
|
+
* - 'minimal': Include method, path (no query), status (default)
|
|
23
|
+
* - 'off': Do not include interaction binding
|
|
24
|
+
* - 'full': Include method, full path with query string, status
|
|
25
|
+
*/
|
|
26
|
+
export type InteractionBindingMode = 'minimal' | 'off' | 'full';
|
|
27
|
+
/**
|
|
28
|
+
* Middleware configuration for PEAC receipt issuance
|
|
29
|
+
*/
|
|
30
|
+
export interface MiddlewareConfig {
|
|
31
|
+
/** Issuer URL (becomes `iss` claim). Must be HTTPS. */
|
|
32
|
+
issuer: string;
|
|
33
|
+
/** Ed25519 private key in JWK format */
|
|
34
|
+
signingKey: Ed25519PrivateJwk;
|
|
35
|
+
/** Key ID for JWKS lookup (appears in JWS header `kid`) */
|
|
36
|
+
keyId: string;
|
|
37
|
+
/** Receipt expiration in seconds (default: 300) */
|
|
38
|
+
expiresIn?: number;
|
|
39
|
+
/** Transport profile preference (default: 'header') */
|
|
40
|
+
transport?: 'header' | 'body' | 'pointer';
|
|
41
|
+
/** Maximum header size in bytes before fallback to body (default: 4096) */
|
|
42
|
+
maxHeaderSize?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Interaction binding mode (default: 'minimal')
|
|
45
|
+
*
|
|
46
|
+
* Controls what request/response data is included in the receipt:
|
|
47
|
+
* - 'minimal': method, path (no query string), status (default, privacy-safe)
|
|
48
|
+
* - 'off': No interaction binding included
|
|
49
|
+
* - 'full': method, full path with query string, status
|
|
50
|
+
*
|
|
51
|
+
* Privacy note: Query strings often contain API keys, tokens, or PII.
|
|
52
|
+
* Use 'minimal' (default) unless you explicitly need query parameters.
|
|
53
|
+
*/
|
|
54
|
+
interactionBinding?: InteractionBindingMode;
|
|
55
|
+
/** Pointer URL generator for 'pointer' transport */
|
|
56
|
+
pointerUrlGenerator?: (receipt: string) => Promise<string>;
|
|
57
|
+
/** Custom claims generator */
|
|
58
|
+
claimsGenerator?: (context: RequestContext) => Promise<Partial<ReceiptClaimsInput>>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Request context captured for receipt generation
|
|
62
|
+
*/
|
|
63
|
+
export interface RequestContext {
|
|
64
|
+
/** HTTP method (GET, POST, etc.) */
|
|
65
|
+
method: string;
|
|
66
|
+
/** Request path (e.g., '/api/data') */
|
|
67
|
+
path: string;
|
|
68
|
+
/** Request headers */
|
|
69
|
+
headers: Record<string, string | string[] | undefined>;
|
|
70
|
+
/** Request body (if available) */
|
|
71
|
+
body?: unknown;
|
|
72
|
+
/** Request timestamp (Unix milliseconds) */
|
|
73
|
+
timestamp: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Response context for receipt generation
|
|
77
|
+
*/
|
|
78
|
+
export interface ResponseContext {
|
|
79
|
+
/** HTTP status code */
|
|
80
|
+
statusCode: number;
|
|
81
|
+
/** Response headers */
|
|
82
|
+
headers: Record<string, string | string[] | undefined>;
|
|
83
|
+
/** Response body (if available) */
|
|
84
|
+
body?: unknown;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Custom claims that can be added to receipts
|
|
88
|
+
*/
|
|
89
|
+
export interface ReceiptClaimsInput {
|
|
90
|
+
/** Subject identifier (optional) */
|
|
91
|
+
sub?: string;
|
|
92
|
+
/** Audience override (defaults to request origin) */
|
|
93
|
+
aud?: string;
|
|
94
|
+
/** Additional extensions */
|
|
95
|
+
ext?: Record<string, unknown>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Result of receipt creation
|
|
99
|
+
*/
|
|
100
|
+
export interface ReceiptResult {
|
|
101
|
+
/** JWS compact serialization of the receipt */
|
|
102
|
+
receipt: string;
|
|
103
|
+
/** Transport profile used */
|
|
104
|
+
transport: 'header' | 'body' | 'pointer';
|
|
105
|
+
/** Headers to add to the response */
|
|
106
|
+
headers: Record<string, string>;
|
|
107
|
+
/** Wrapped body (for body transport profile) */
|
|
108
|
+
bodyWrapper?: {
|
|
109
|
+
data: unknown;
|
|
110
|
+
peac_receipt: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Validation error for middleware configuration
|
|
115
|
+
*/
|
|
116
|
+
export interface ConfigValidationError {
|
|
117
|
+
field: string;
|
|
118
|
+
message: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Transport profile selection input
|
|
122
|
+
*/
|
|
123
|
+
export interface TransportSelectionInput {
|
|
124
|
+
/** Receipt JWS string */
|
|
125
|
+
receipt: string;
|
|
126
|
+
/** Preferred transport from config */
|
|
127
|
+
transport?: 'header' | 'body' | 'pointer';
|
|
128
|
+
/** Maximum header size */
|
|
129
|
+
maxHeaderSize?: number;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAA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|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PEAC Middleware Core Types
|
|
4
|
+
*
|
|
5
|
+
* Framework-agnostic type definitions for PEAC receipt issuance middleware.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@peac/middleware-core",
|
|
3
|
+
"version": "0.10.9",
|
|
4
|
+
"description": "Framework-agnostic middleware primitives for PEAC receipt issuance",
|
|
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
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/peacprotocol/peac.git",
|
|
18
|
+
"directory": "packages/middleware-core"
|
|
19
|
+
},
|
|
20
|
+
"author": "jithinraj <7850727+jithinraj@users.noreply.github.com>",
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/peacprotocol/peac/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/peacprotocol/peac#readme",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"provenance": true
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"uuidv7": "^0.6.3",
|
|
36
|
+
"@peac/kernel": "0.10.9",
|
|
37
|
+
"@peac/schema": "0.10.9",
|
|
38
|
+
"@peac/crypto": "0.10.9"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^20.10.0",
|
|
42
|
+
"typescript": "^5.3.3",
|
|
43
|
+
"vitest": "^1.1.0"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"prebuild": "rm -rf dist tsconfig.tsbuildinfo",
|
|
47
|
+
"build": "tsc",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest",
|
|
50
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
51
|
+
}
|
|
52
|
+
}
|