@keri-ts/hosting 0.0.0-stage → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +22 -2
- package/esm/hosting/npm/src/_dnt.shims.js +61 -0
- package/esm/hosting/npm/src/mod.js +7 -0
- package/esm/hosting/npm/src/src/host/http-server.js +310 -0
- package/esm/hosting/npm/src/src/host/kernel.js +83 -0
- package/esm/hosting/npm/src/src/http/app.js +33 -0
- package/esm/hosting/npm/src/src/http/error-mapping.js +19 -0
- package/esm/hosting/npm/src/src/http/policy.js +63 -0
- package/esm/hosting/npm/src/src/http/protocol/artifact-files.js +164 -0
- package/esm/hosting/npm/src/src/http/protocol/context.js +48 -0
- package/esm/hosting/npm/src/src/http/protocol/endpoints/did-resolution.js +90 -0
- package/esm/hosting/npm/src/src/http/protocol/endpoints/dws-artifacts.js +112 -0
- package/esm/hosting/npm/src/src/http/protocol/endpoints/generic-cesr-ingress.js +272 -0
- package/esm/hosting/npm/src/src/http/protocol/endpoints/health.js +9 -0
- package/esm/hosting/npm/src/src/http/protocol/endpoints/mailbox-admin.js +136 -0
- package/esm/hosting/npm/src/src/http/protocol/endpoints/oobi.js +171 -0
- package/esm/hosting/npm/src/src/http/protocol/endpoints/witness-http.js +98 -0
- package/esm/hosting/npm/src/src/http/protocol/responses.js +21 -0
- package/esm/hosting/npm/src/src/http/protocol/runtime-bridge.js +16 -0
- package/esm/hosting/npm/src/src/http/protocol/types.js +1 -0
- package/esm/hosting/npm/src/src/http/protocol-handler.js +68 -0
- package/esm/hosting/npm/src/src/http/source.js +118 -0
- package/esm/package.json +3 -0
- package/package.json +43 -4
- package/types/_dnt.shims.d.ts +6 -0
- package/types/_dnt.shims.d.ts.map +1 -0
- package/types/mod.d.ts +9 -0
- package/types/mod.d.ts.map +1 -0
- package/types/src/host/http-server.d.ts +46 -0
- package/types/src/host/http-server.d.ts.map +1 -0
- package/types/src/host/kernel.d.ts +37 -0
- package/types/src/host/kernel.d.ts.map +1 -0
- package/types/src/http/app.d.ts +22 -0
- package/types/src/http/app.d.ts.map +1 -0
- package/types/src/http/error-mapping.d.ts +7 -0
- package/types/src/http/error-mapping.d.ts.map +1 -0
- package/types/src/http/policy.d.ts +27 -0
- package/types/src/http/policy.d.ts.map +1 -0
- package/types/src/http/protocol/artifact-files.d.ts +11 -0
- package/types/src/http/protocol/artifact-files.d.ts.map +1 -0
- package/types/src/http/protocol/context.d.ts +14 -0
- package/types/src/http/protocol/context.d.ts.map +1 -0
- package/types/src/http/protocol/endpoints/did-resolution.d.ts +12 -0
- package/types/src/http/protocol/endpoints/did-resolution.d.ts.map +1 -0
- package/types/src/http/protocol/endpoints/dws-artifacts.d.ts +9 -0
- package/types/src/http/protocol/endpoints/dws-artifacts.d.ts.map +1 -0
- package/types/src/http/protocol/endpoints/generic-cesr-ingress.d.ts +21 -0
- package/types/src/http/protocol/endpoints/generic-cesr-ingress.d.ts.map +1 -0
- package/types/src/http/protocol/endpoints/health.d.ts +6 -0
- package/types/src/http/protocol/endpoints/health.d.ts.map +1 -0
- package/types/src/http/protocol/endpoints/mailbox-admin.d.ts +26 -0
- package/types/src/http/protocol/endpoints/mailbox-admin.d.ts.map +1 -0
- package/types/src/http/protocol/endpoints/oobi.d.ts +31 -0
- package/types/src/http/protocol/endpoints/oobi.d.ts.map +1 -0
- package/types/src/http/protocol/endpoints/witness-http.d.ts +13 -0
- package/types/src/http/protocol/endpoints/witness-http.d.ts.map +1 -0
- package/types/src/http/protocol/responses.d.ts +7 -0
- package/types/src/http/protocol/responses.d.ts.map +1 -0
- package/types/src/http/protocol/runtime-bridge.d.ts +13 -0
- package/types/src/http/protocol/runtime-bridge.d.ts.map +1 -0
- package/types/src/http/protocol/types.d.ts +78 -0
- package/types/src/http/protocol/types.d.ts.map +1 -0
- package/types/src/http/protocol-handler.d.ts +19 -0
- package/types/src/http/protocol-handler.d.ts.map +1 -0
- package/types/src/http/source.d.ts +25 -0
- package/types/src/http/source.d.ts.map +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Return one CESR response body with the expected content type. */
|
|
2
|
+
export function cesrResponse(body, status) {
|
|
3
|
+
return new Response(body.slice().buffer, {
|
|
4
|
+
status,
|
|
5
|
+
headers: { "Content-Type": "application/cesr" },
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
/** Return one plain-text response. */
|
|
9
|
+
export function textResponse(message, status) {
|
|
10
|
+
return new Response(message, {
|
|
11
|
+
status,
|
|
12
|
+
headers: { "Content-Type": "text/plain" },
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** Return the ordinary no-content JSON response used by ingress routes. */
|
|
16
|
+
export function jsonNoContentResponse() {
|
|
17
|
+
return new Response(null, {
|
|
18
|
+
status: 204,
|
|
19
|
+
headers: { "Content-Type": "application/json" },
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { processCuesOnce } from "keri-ts/runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Route HTTP cues and finish the existing query-delivery pass.
|
|
4
|
+
* Poster work is only admitted here; its independent worker owns network delivery.
|
|
5
|
+
* Request-owned direct replies remain with the HTTP request lifetime.
|
|
6
|
+
*
|
|
7
|
+
* @param runtime Borrowed composed runtime; caller owns its worker and store lifetime.
|
|
8
|
+
* @param serviceHab Optional hosted signer for cue production.
|
|
9
|
+
* @param cues Exact runtime source Deck; foreign Decks are rejected.
|
|
10
|
+
*/
|
|
11
|
+
export function* drainRuntimeCues(runtime, serviceHab, cues) {
|
|
12
|
+
if (cues !== runtime.cues)
|
|
13
|
+
throw new RangeError("HTTP cue drain requires the runtime source deck");
|
|
14
|
+
yield* processCuesOnce(runtime, { hab: serviceHab });
|
|
15
|
+
yield* runtime.querying.deliverOnce();
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ArtifactFiles } from "./protocol/artifact-files.js";
|
|
2
|
+
import { buildProtocolRequestContext } from "./protocol/context.js";
|
|
3
|
+
import { classifyDidResolutionRoute, handleDidResolutionRoute } from "./protocol/endpoints/did-resolution.js";
|
|
4
|
+
import { classifyDwsArtifactRoute, handleDwsArtifactRoute } from "./protocol/endpoints/dws-artifacts.js";
|
|
5
|
+
import { classifyGenericCesrIngressRoute, handleGenericCesrIngress, } from "./protocol/endpoints/generic-cesr-ingress.js";
|
|
6
|
+
import { classifyHealthRoute, handleHealthRoute } from "./protocol/endpoints/health.js";
|
|
7
|
+
import { classifyMailboxAdminRoute, handleMailboxAdmin } from "./protocol/endpoints/mailbox-admin.js";
|
|
8
|
+
import { classifyOobiRoute, handleOobiRoute } from "./protocol/endpoints/oobi.js";
|
|
9
|
+
import { classifyWitnessHttpRoute, handleWitnessKeyStateGet, handleWitnessQueryGet, handleWitnessReceiptGet, handleWitnessReceiptPost, } from "./protocol/endpoints/witness-http.js";
|
|
10
|
+
export { buildProtocolRequestContext } from "./protocol/context.js";
|
|
11
|
+
export { classifyCesrIngressRoute } from "./protocol/endpoints/generic-cesr-ingress.js";
|
|
12
|
+
export { parseOobiRouteRequest } from "./protocol/endpoints/oobi.js";
|
|
13
|
+
/** Build the shared protocol handler used by the Deno and Node HTTP hosts. */
|
|
14
|
+
export function createProtocolHandler(runtime, policy = {}) {
|
|
15
|
+
const files = new ArtifactFiles();
|
|
16
|
+
const handle = async (req) => {
|
|
17
|
+
const context = buildProtocolRequestContext(req, runtime, policy);
|
|
18
|
+
const route = classifyProtocolRoute(context);
|
|
19
|
+
return await dispatchProtocolRoute(context, route, files);
|
|
20
|
+
};
|
|
21
|
+
return Object.assign(handle, { close: () => files.close() });
|
|
22
|
+
}
|
|
23
|
+
/** Classify one request by explicit endpoint precedence. */
|
|
24
|
+
export function classifyProtocolRoute(context) {
|
|
25
|
+
return classifyHealthRoute(context)
|
|
26
|
+
?? classifyDidResolutionRoute(context)
|
|
27
|
+
?? classifyDwsArtifactRoute(context)
|
|
28
|
+
?? classifyMailboxAdminRoute(context)
|
|
29
|
+
?? classifyWitnessHttpRoute(context)
|
|
30
|
+
?? classifyOobiRoute(context)
|
|
31
|
+
?? classifyGenericCesrIngressRoute(context)
|
|
32
|
+
?? { kind: "notFound" };
|
|
33
|
+
}
|
|
34
|
+
/** Dispatch one already-classified route to its concrete response. */
|
|
35
|
+
async function dispatchProtocolRoute(context, route, files) {
|
|
36
|
+
switch (route.kind) {
|
|
37
|
+
case "health":
|
|
38
|
+
return handleHealthRoute();
|
|
39
|
+
case "didResolution":
|
|
40
|
+
return await handleDidResolutionRoute(context, route.did);
|
|
41
|
+
case "dwsArtifact":
|
|
42
|
+
return await handleDwsArtifactRoute(context, route, files);
|
|
43
|
+
case "ambiguousHostedPath":
|
|
44
|
+
return new Response(route.message, {
|
|
45
|
+
status: 409,
|
|
46
|
+
headers: { "Content-Type": "text/plain" },
|
|
47
|
+
});
|
|
48
|
+
case "mailboxAdmin":
|
|
49
|
+
return await handleMailboxAdmin(context.runtime, context.req, route.mailboxAid, context.policy.serviceHab);
|
|
50
|
+
case "witnessReceiptsPost":
|
|
51
|
+
return await handleWitnessReceiptPost(context.runtime, context.req, route.witnessHab);
|
|
52
|
+
case "witnessReceiptsGet":
|
|
53
|
+
return handleWitnessReceiptGet(context, route.witnessHab);
|
|
54
|
+
case "witnessKeyStateGet":
|
|
55
|
+
return handleWitnessKeyStateGet(context, route.witnessHab);
|
|
56
|
+
case "witnessQueryGet":
|
|
57
|
+
return handleWitnessQueryGet(context, route.witnessHab);
|
|
58
|
+
case "oobi":
|
|
59
|
+
return handleOobiRoute(context, route.request);
|
|
60
|
+
case "genericCesrIngress":
|
|
61
|
+
return await handleGenericCesrIngress(context, route.hosted);
|
|
62
|
+
case "notFound":
|
|
63
|
+
return new Response("Not Found", {
|
|
64
|
+
status: 404,
|
|
65
|
+
headers: { "Content-Type": "text/plain" },
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/** One configured HTTPS response source; TLS supplies source identity, never issuer authority. */
|
|
2
|
+
import { call, resource, scoped } from "effection";
|
|
3
|
+
import { collectBytes, TransportError, ValidationError } from "keri-ts/runtime";
|
|
4
|
+
import { Buffer } from "node:buffer";
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import { request } from "node:https";
|
|
7
|
+
import { isIP } from "node:net";
|
|
8
|
+
import { isAbsolute } from "node:path";
|
|
9
|
+
import { checkServerIdentity } from "node:tls";
|
|
10
|
+
/** Validated fixed source data; URL identity is retained exactly, not derived from a response. */
|
|
11
|
+
export class SourceTrust {
|
|
12
|
+
constructor({ url, caFile, certName }) {
|
|
13
|
+
Object.defineProperty(this, "url", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: void 0
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(this, "caFile", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: void 0
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(this, "certName", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: void 0
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(this, "hostname", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: void 0
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(this, "ca", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
43
|
+
if (typeof url !== "string" || !url.trim())
|
|
44
|
+
throw new ValidationError("Source URL is required.");
|
|
45
|
+
const target = new URL(url.trim());
|
|
46
|
+
if (target.protocol !== "https:" || target.username || target.password || target.search || target.hash) {
|
|
47
|
+
throw new ValidationError("Source must be HTTPS without credentials, query or fragment.");
|
|
48
|
+
}
|
|
49
|
+
const host = target.hostname.replace(/^\[|\]$/g, "");
|
|
50
|
+
if (certName !== undefined && (!isIP(host) || typeof certName !== "string" || !certName
|
|
51
|
+
|| isIP(certName) || !certName.split(".").every(label => /^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(label)))) {
|
|
52
|
+
throw new ValidationError("Separate certificate DNS name requires an IP source URL.");
|
|
53
|
+
}
|
|
54
|
+
if (caFile !== undefined && (typeof caFile !== "string" || !isAbsolute(caFile))) {
|
|
55
|
+
throw new ValidationError("Source CA must be an absolute file path.");
|
|
56
|
+
}
|
|
57
|
+
this.url = url.trim();
|
|
58
|
+
this.caFile = caFile;
|
|
59
|
+
this.certName = certName;
|
|
60
|
+
this.hostname = certName ?? host;
|
|
61
|
+
this.ca = caFile ? readFileSync(caFile) : undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Own one finite POST, absolute deadline, body reader and joined socket close.
|
|
66
|
+
* Node's TLS verifier checks CA plus the configured URL/name; request never follows redirects.
|
|
67
|
+
*/
|
|
68
|
+
export function sourceRequest(source, body, timeoutMs) {
|
|
69
|
+
return scoped(function* () {
|
|
70
|
+
return yield* resource(function* (provide) {
|
|
71
|
+
const host = new URL(source.url).hostname.replace(/^\[|\]$/g, "");
|
|
72
|
+
let closed;
|
|
73
|
+
const joined = new Promise(resolve => closed = resolve);
|
|
74
|
+
let succeed, fail;
|
|
75
|
+
const pending = new Promise((resolve, reject) => {
|
|
76
|
+
succeed = resolve;
|
|
77
|
+
fail = cause => reject(new TransportError("HTTPS registrar source failed", { cause }));
|
|
78
|
+
});
|
|
79
|
+
const req = request(source.url, {
|
|
80
|
+
method: "POST",
|
|
81
|
+
agent: false,
|
|
82
|
+
ca: source.ca,
|
|
83
|
+
rejectUnauthorized: true,
|
|
84
|
+
servername: isIP(host) ? source.certName : host,
|
|
85
|
+
checkServerIdentity: (_hostname, certificate) => checkServerIdentity(source.hostname, certificate),
|
|
86
|
+
headers: { "Content-Type": "application/cesr" },
|
|
87
|
+
}, response => {
|
|
88
|
+
const headers = new Headers();
|
|
89
|
+
for (const [key, value] of Object.entries(response.headers)) {
|
|
90
|
+
if (Array.isArray(value))
|
|
91
|
+
value.forEach(item => headers.append(key, item));
|
|
92
|
+
else if (value !== undefined)
|
|
93
|
+
headers.set(key, value);
|
|
94
|
+
}
|
|
95
|
+
void collectBytes(response).then(bytes => succeed({
|
|
96
|
+
status: response.statusCode ?? 0,
|
|
97
|
+
ok: (response.statusCode ?? 0) >= 200 && (response.statusCode ?? 0) < 300,
|
|
98
|
+
headers,
|
|
99
|
+
body: bytes,
|
|
100
|
+
}), fail);
|
|
101
|
+
});
|
|
102
|
+
req.on("error", fail);
|
|
103
|
+
req.once("close", closed);
|
|
104
|
+
req.end(Buffer.from(body));
|
|
105
|
+
// Cancellation may finish the operation before the native promise rejects.
|
|
106
|
+
void pending.catch(() => { });
|
|
107
|
+
const timer = setTimeout(() => req.destroy(new Error("Registrar source deadline expired")), timeoutMs);
|
|
108
|
+
try {
|
|
109
|
+
yield* provide(yield* call(() => pending));
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
clearTimeout(timer);
|
|
113
|
+
req.destroy();
|
|
114
|
+
yield* call(() => joined);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
package/esm/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keri-ts/hosting",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "HTTP host lifecycle, application middleware and protocol route composition",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/kentbull/keri-ts.git",
|
|
8
|
+
"directory": "packages/hosting"
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"main": "./esm/hosting/npm/src/mod.js",
|
|
12
|
+
"module": "./esm/hosting/npm/src/mod.js",
|
|
13
|
+
"types": "./types/mod.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./types/mod.d.ts",
|
|
17
|
+
"import": "./esm/hosting/npm/src/mod.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "node --version"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"files": [
|
|
26
|
+
"esm",
|
|
27
|
+
"types",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20.3"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"cesr-ts": "2.0.0",
|
|
36
|
+
"effection": "^3.6.0",
|
|
37
|
+
"hono": "^4.7.11",
|
|
38
|
+
"keri-ts": "2.0.0",
|
|
39
|
+
"@deno/shim-deno": "~0.18.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^20.9.0"
|
|
43
|
+
},
|
|
44
|
+
"_generatedBy": "dnt@dev"
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,eAAO,MAAM,aAAa;;CAA2C,CAAC"}
|
package/types/mod.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** HTTP hosting package entrypoint. */
|
|
2
|
+
export { type RuntimeHttpHostOptions, startServer } from "./src/host/http-server.js";
|
|
3
|
+
export { type HostKernelHttpSpec, type HostKernelSpec, type HostTaskFactory, type HttpListenAddress, runHostKernel, } from "./src/host/kernel.js";
|
|
4
|
+
export { createTufaApp, type CreateTufaAppOptions } from "./src/http/app.js";
|
|
5
|
+
export type { TufaCorsPolicy, TufaHttpAppOptions, TufaHttpAppPolicy } from "./src/http/policy.js";
|
|
6
|
+
export { createProtocolHandler, type ProtocolHandler } from "./src/http/protocol-handler.js";
|
|
7
|
+
export { handleWitnessReceiptPost } from "./src/http/protocol/endpoints/witness-http.js";
|
|
8
|
+
export { type SourceConfig, sourceRequest, SourceTrust } from "./src/http/source.js";
|
|
9
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,KAAK,sBAAsB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,KAAK,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Operation } from "effection";
|
|
2
|
+
import { type AgentRuntime, type Logger, type ProtocolHostPolicy } from "keri-ts/runtime";
|
|
3
|
+
import type { ProtocolHandler } from "../http/protocol/types.js";
|
|
4
|
+
interface RunningServer {
|
|
5
|
+
readonly finished: Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
interface ServerHost {
|
|
8
|
+
readonly server: RunningServer;
|
|
9
|
+
close(): void | Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
interface ServerOptions {
|
|
12
|
+
tls?: {
|
|
13
|
+
key: string;
|
|
14
|
+
cert: string;
|
|
15
|
+
};
|
|
16
|
+
port: number;
|
|
17
|
+
hostname: string;
|
|
18
|
+
signal: AbortSignal;
|
|
19
|
+
onListen: (address: {
|
|
20
|
+
port: number;
|
|
21
|
+
}) => void;
|
|
22
|
+
onError: (error: unknown) => Response;
|
|
23
|
+
}
|
|
24
|
+
/** HTTP host options. */
|
|
25
|
+
export interface RuntimeHttpHostOptions extends ProtocolHostPolicy {
|
|
26
|
+
/** Explicit PEM identity for HTTPS; selected TLS never falls back to a plaintext listener. */
|
|
27
|
+
tls?: {
|
|
28
|
+
key: string;
|
|
29
|
+
cert: string;
|
|
30
|
+
};
|
|
31
|
+
/** A concrete service may own routing across independent runtimes; it also owns handler cleanup. */
|
|
32
|
+
protocolHandler?: ProtocolHandler;
|
|
33
|
+
hostname?: string;
|
|
34
|
+
onListen?: (address: {
|
|
35
|
+
port: number;
|
|
36
|
+
hostname: string;
|
|
37
|
+
}) => void;
|
|
38
|
+
}
|
|
39
|
+
/** Open the native Deno HTTP host and join request cleanup after its listener closes. */
|
|
40
|
+
export declare function openDenoServerHost(options: ServerOptions, handler: (req: Request) => Promise<Response>): ServerHost;
|
|
41
|
+
/** Open the Node fallback host; completion joins every admitted request after the listener closes. */
|
|
42
|
+
export declare function openNodeServerHost(options: ServerOptions, handler: (req: Request) => Promise<Response>): ServerHost;
|
|
43
|
+
/** Start the Tufa HTTP host for one shared `AgentRuntime`. */
|
|
44
|
+
export declare function startServer(port?: number, logger?: Logger, runtime?: AgentRuntime, options?: RuntimeHttpHostOptions, beforeDrain?: () => Operation<void>): Operation<void>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=http-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../../../src/src/host/http-server.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,YAAY,EAAiB,KAAK,MAAM,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAMzG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,UAAU,aAAa;IACrB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,UAAU,UAAU;IAClB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAMD,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC9C,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,QAAQ,CAAC;CACvC;AAED,yBAAyB;AACzB,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE,8FAA8F;IAC9F,GAAG,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,oGAAoG;IACpG,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAClE;AA4CD,yFAAyF;AACzF,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAC3C,UAAU,CAoBZ;AAyHD,sGAAsG;AACtG,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAC3C,UAAU,CA+CZ;AAyFD,8DAA8D;AAC9D,wBAAiB,WAAW,CAC1B,IAAI,GAAE,MAAa,EACnB,MAAM,GAAE,MAAsB,EAC9B,OAAO,CAAC,EAAE,YAAY,EACtB,OAAO,GAAE,sBAA2B,EACpC,WAAW,CAAC,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,GAClC,SAAS,CAAC,IAAI,CAAC,CAgBjB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Operation } from "effection";
|
|
2
|
+
import { type AgentRuntime, type Hab, type Habery, type KramConfig, type ProtocolHostPolicy } from "keri-ts/runtime";
|
|
3
|
+
/** Resolved listen callback address for one HTTP host. */
|
|
4
|
+
export interface HttpListenAddress {
|
|
5
|
+
port: number;
|
|
6
|
+
hostname: string;
|
|
7
|
+
}
|
|
8
|
+
/** Actual companion listener work, supervised alongside the runtime and HTTP server. */
|
|
9
|
+
export type HostTaskFactory = (runtime: AgentRuntime) => Operation<void>;
|
|
10
|
+
/** HTTP listener spec owned by the shared host kernel. */
|
|
11
|
+
export interface HostKernelHttpSpec {
|
|
12
|
+
port: number;
|
|
13
|
+
hostname?: string;
|
|
14
|
+
onListen?: (address: HttpListenAddress) => void;
|
|
15
|
+
}
|
|
16
|
+
/** Concrete host-kernel configuration for one long-lived role host. */
|
|
17
|
+
export interface HostKernelSpec {
|
|
18
|
+
/** Whether this host constructs provider mailbox storage. */
|
|
19
|
+
enableMailboxStore: boolean;
|
|
20
|
+
/** Explicit receiver policy selected by this host's composition root; omission leaves KRAM disabled. */
|
|
21
|
+
kram?: KramConfig;
|
|
22
|
+
serviceHab: Hab;
|
|
23
|
+
hostedPrefixes?: readonly string[];
|
|
24
|
+
http: HostKernelHttpSpec;
|
|
25
|
+
protocolPolicy: Omit<ProtocolHostPolicy, "serviceHab" | "hostedPrefixes">;
|
|
26
|
+
companionHosts?: readonly HostTaskFactory[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Compose and run the long-lived host over one borrowed Habery.
|
|
30
|
+
* Select HTTP/clock/polling implementations at this root, acquire runtime/listener
|
|
31
|
+
* resources in scope, and join dependent workers before owned store teardown.
|
|
32
|
+
*
|
|
33
|
+
* @param hby Borrowed local identities and accepted-state stores.
|
|
34
|
+
* @param spec Explicit hosted identities, listener settings, protocol handlers and host policy.
|
|
35
|
+
*/
|
|
36
|
+
export declare function runHostKernel(hby: Habery, spec: HostKernelSpec): Operation<void>;
|
|
37
|
+
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../src/src/host/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,WAAW,CAAC;AAG7D,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,GAAG,EACR,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,kBAAkB,EAExB,MAAM,iBAAiB,CAAC;AAGzB,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wFAAwF;AACxF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;AAEzE,0DAA0D;AAC1D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACjD;AAED,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,kBAAkB,EAAE,OAAO,CAAC;IAC5B,wGAAwG;IACxG,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,GAAG,CAAC;IAChB,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,IAAI,EAAE,kBAAkB,CAAC;IACzB,cAAc,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,GAAG,gBAAgB,CAAC,CAAC;IAC1E,cAAc,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAiB,aAAa,CAC5B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,cAAc,GACnB,SAAS,CAAC,IAAI,CAAC,CA6EjB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentRuntime, ProtocolHostPolicy } from "keri-ts/runtime";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { type TufaHttpAppOptions } from "./policy.js";
|
|
4
|
+
import type { ProtocolHandler } from "./protocol/types.js";
|
|
5
|
+
/** Construction options for the Stage 4 Tufa HTTP app edge. */
|
|
6
|
+
export interface CreateTufaAppOptions {
|
|
7
|
+
readonly runtime?: AgentRuntime;
|
|
8
|
+
readonly protocolPolicy?: ProtocolHostPolicy;
|
|
9
|
+
readonly app?: TufaHttpAppOptions;
|
|
10
|
+
readonly protocolHandler?: ProtocolHandler;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Build the Stage 4 Hono shell for the Tufa HTTP edge.
|
|
14
|
+
*
|
|
15
|
+
* Stage 4 keeps route semantics inside the protocol handler while moving
|
|
16
|
+
* cross-cutting HTTP policy into explicit hosting-owned middleware and error
|
|
17
|
+
* mapping.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createTufaApp(options?: CreateTufaAppOptions): Hono & {
|
|
20
|
+
close(): Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/src/http/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAmD,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEvG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAC7C,QAAQ,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC;CAC5C;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,GAAE,oBAAyB,GACjC,IAAI,GAAG;IAAE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAuBnC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Hono } from "hono";
|
|
2
|
+
import type { TufaHttpAppPolicy } from "./policy.js";
|
|
3
|
+
/** Map one unhandled edge error into the Stage 4 HTTP response contract. */
|
|
4
|
+
export declare function mapTufaHttpError(error: unknown, policy: TufaHttpAppPolicy): Response;
|
|
5
|
+
/** Install the centralized Stage 4 app-level error mapping. */
|
|
6
|
+
export declare function installTufaHttpErrorHandling(app: Hono, policy: TufaHttpAppPolicy): void;
|
|
7
|
+
//# sourceMappingURL=error-mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-mapping.d.ts","sourceRoot":"","sources":["../../../src/src/http/error-mapping.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,iBAAiB,GACxB,QAAQ,CAOV;AAED,+DAA+D;AAC/D,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,iBAAiB,GACxB,IAAI,CAMN"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Logger } from "keri-ts/runtime";
|
|
2
|
+
import type { Hono } from "hono";
|
|
3
|
+
/** Fixed CORS policy owned by the Stage 4 Tufa HTTP edge. */
|
|
4
|
+
export interface TufaCorsPolicy {
|
|
5
|
+
readonly allowOrigin: string;
|
|
6
|
+
readonly allowMethods: readonly string[];
|
|
7
|
+
readonly allowHeaders: readonly string[];
|
|
8
|
+
readonly exposeHeaders: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/** App-level Stage 4 policy for the Hono middleware envelope. */
|
|
11
|
+
export interface TufaHttpAppPolicy {
|
|
12
|
+
readonly logger: Logger;
|
|
13
|
+
readonly cors: TufaCorsPolicy;
|
|
14
|
+
}
|
|
15
|
+
/** Call-site options used to resolve the concrete app policy. */
|
|
16
|
+
export interface TufaHttpAppOptions {
|
|
17
|
+
readonly logger?: Logger;
|
|
18
|
+
readonly cors?: Partial<TufaCorsPolicy>;
|
|
19
|
+
}
|
|
20
|
+
export declare const DEFAULT_TUFA_CORS_POLICY: TufaCorsPolicy;
|
|
21
|
+
/** Resolve one app policy with Stage 4 defaults. */
|
|
22
|
+
export declare function resolveTufaHttpAppPolicy(options?: TufaHttpAppOptions): TufaHttpAppPolicy;
|
|
23
|
+
/** Install the Stage 4 middleware envelope onto one Hono app. */
|
|
24
|
+
export declare function installTufaHttpPolicy(app: Hono, policy: TufaHttpAppPolicy): void;
|
|
25
|
+
/** Apply the resolved Stage 4 CORS policy to one response header set. */
|
|
26
|
+
export declare function applyTufaCorsHeaders(headers: Headers, policy: TufaCorsPolicy): void;
|
|
27
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/src/http/policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAqB,MAAM,MAAM,CAAC;AAGpD,6DAA6D;AAC7D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B;AAED,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CACzC;AAED,eAAO,MAAM,wBAAwB,EAAE,cAcrC,CAAC;AAEH,oDAAoD;AACpD,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAcnB;AAED,iEAAiE;AACjE,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,iBAAiB,GACxB,IAAI,CAEN;AAiCD,yEAAyE;AACzE,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,cAAc,GACrB,IAAI,CAcN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Own one host's open file responses, including bodies that have not been consumed. */
|
|
2
|
+
export declare class ArtifactFiles {
|
|
3
|
+
private readonly owners;
|
|
4
|
+
private stopping;
|
|
5
|
+
private closing?;
|
|
6
|
+
/** Open the regular file and capture its extent without reading data. */
|
|
7
|
+
response(path: string, contentType: string, signal: AbortSignal): Promise<Response>;
|
|
8
|
+
/** Close every file, including pending acquisitions, before the HTTP host finishes shutdown. */
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=artifact-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-files.d.ts","sourceRoot":"","sources":["../../../../src/src/http/protocol/artifact-files.ts"],"names":[],"mappings":"AAMA,wFAAwF;AACxF,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkD;IACzE,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAC,CAAgB;IAEhC,yEAAyE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAyGzF,gGAAgG;IAChG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAUvB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-context construction for Tufa protocol routing.
|
|
3
|
+
*
|
|
4
|
+
* The router is path-first: every endpoint classifier receives the same
|
|
5
|
+
* normalized path plus hosted-prefix projections, so mailbox admin, OOBI, and
|
|
6
|
+
* generic CESR ingress cannot disagree about which local AID a URL addresses.
|
|
7
|
+
*/
|
|
8
|
+
import { type AgentRuntime, type ProtocolHostPolicy } from "keri-ts/runtime";
|
|
9
|
+
import type { ProtocolRequestContext } from "./types.js";
|
|
10
|
+
/** Snapshot one request into the path-first routing context. */
|
|
11
|
+
export declare function buildProtocolRequestContext(req: Request, runtime?: AgentRuntime, policy?: ProtocolHostPolicy): ProtocolRequestContext;
|
|
12
|
+
/** Normalize incoming request paths into the comparison form used by routing. */
|
|
13
|
+
export declare function normalizeProtocolPath(pathname: string): string;
|
|
14
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/src/http/protocol/context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAA6B,MAAM,iBAAiB,CAAC;AAExG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,gEAAgE;AAChE,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,OAAO,EACZ,OAAO,CAAC,EAAE,YAAY,EACtB,MAAM,GAAE,kBAAuB,GAC9B,sBAAsB,CA4CxB;AAED,iFAAiF;AACjF,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO9D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProtocolRequestContext, ProtocolRoute } from "../types.js";
|
|
2
|
+
/** Classify `/1.0/identifiers/{did}` requests. */
|
|
3
|
+
export declare function classifyDidResolutionRoute(context: ProtocolRequestContext): ProtocolRoute | null;
|
|
4
|
+
/**
|
|
5
|
+
* Handle one Universal Resolver request.
|
|
6
|
+
*
|
|
7
|
+
* @param context Request-owned host context with the configured runtime/registry.
|
|
8
|
+
* @param did Requested DID to resolve and verify.
|
|
9
|
+
* @returns HTTP resolution response based on accepted KERI/VDR state.
|
|
10
|
+
*/
|
|
11
|
+
export declare function handleDidResolutionRoute(context: ProtocolRequestContext, did: string): Promise<Response>;
|
|
12
|
+
//# sourceMappingURL=did-resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-resolution.d.ts","sourceRoot":"","sources":["../../../../../src/src/http/protocol/endpoints/did-resolution.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIzE,kDAAkD;AAClD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,sBAAsB,GAC9B,aAAa,GAAG,IAAI,CAStB;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,sBAAsB,EAC/B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,QAAQ,CAAC,CAuDnB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArtifactFiles } from "../artifact-files.js";
|
|
2
|
+
import type { ProtocolRequestContext, ProtocolRoute } from "../types.js";
|
|
3
|
+
/** Classify configured `did.json` and `keri.cesr` artifact routes. */
|
|
4
|
+
export declare function classifyDwsArtifactRoute(context: ProtocolRequestContext): ProtocolRoute | null;
|
|
5
|
+
/** Serve one configured artifact route from dynamic state or static files. */
|
|
6
|
+
export declare function handleDwsArtifactRoute(context: ProtocolRequestContext, route: Extract<ProtocolRoute, {
|
|
7
|
+
kind: "dwsArtifact";
|
|
8
|
+
}>, files: ArtifactFiles): Promise<Response>;
|
|
9
|
+
//# sourceMappingURL=dws-artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dws-artifacts.d.ts","sourceRoot":"","sources":["../../../../../src/src/http/protocol/endpoints/dws-artifacts.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzE,sEAAsE;AACtE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,sBAAsB,GAC9B,aAAa,GAAG,IAAI,CAqBtB;AAED,8EAA8E;AAC9E,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,EACtD,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,QAAQ,CAAC,CAWnB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic CESR POST/PUT ingress for the Tufa HTTP edge.
|
|
3
|
+
*
|
|
4
|
+
* Explicit routes are classified before this module runs. This handler owns
|
|
5
|
+
* the remaining raw CESR traffic and decides whether it belongs to local
|
|
6
|
+
* witness ingestion, mailbox SSE query streaming, or normal runtime ingress.
|
|
7
|
+
*/
|
|
8
|
+
import { type SerderKERI } from "cesr-ts";
|
|
9
|
+
import { type HostedRouteResolution } from "keri-ts/runtime";
|
|
10
|
+
import type { CesrIngressRoute, ProtocolRequestContext, ProtocolRoute } from "../types.js";
|
|
11
|
+
/** Classify generic POST/PUT CESR ingress after all explicit HTTP routes. */
|
|
12
|
+
export declare function classifyGenericCesrIngressRoute(context: ProtocolRequestContext): ProtocolRoute | null;
|
|
13
|
+
/**
|
|
14
|
+
* Decide how one inspected CESR request should be ingested.
|
|
15
|
+
*
|
|
16
|
+
* This is the explicit replacement for the old inline witness-root boolean.
|
|
17
|
+
*/
|
|
18
|
+
export declare function classifyCesrIngressRoute(context: ProtocolRequestContext, hosted: HostedRouteResolution, serder: Pick<SerderKERI, "ilk" | "route" | "ked">): CesrIngressRoute;
|
|
19
|
+
/** Run one request in a single owned Effection task and join it on disconnect. */
|
|
20
|
+
export declare function handleGenericCesrIngress(context: ProtocolRequestContext, hosted: HostedRouteResolution): Promise<Response>;
|
|
21
|
+
//# sourceMappingURL=generic-cesr-ingress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-cesr-ingress.d.ts","sourceRoot":"","sources":["../../../../../src/src/http/protocol/endpoints/generic-cesr-ingress.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpE,OAAO,EAEL,KAAK,qBAAqB,EAK3B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAS3F,6EAA6E;AAC7E,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,sBAAsB,GAC9B,aAAa,GAAG,IAAI,CAgBtB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,sBAAsB,EAC/B,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC,GAChD,gBAAgB,CA8BlB;AAsBD,kFAAkF;AAClF,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,sBAAsB,EAC/B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,QAAQ,CAAC,CAwEnB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ProtocolRequestContext, ProtocolRoute } from "../types.js";
|
|
2
|
+
/** Classify `/health` before any runtime-aware routing. */
|
|
3
|
+
export declare function classifyHealthRoute(context: ProtocolRequestContext): ProtocolRoute | null;
|
|
4
|
+
/** Return the fixed health response. */
|
|
5
|
+
export declare function handleHealthRoute(): Response;
|
|
6
|
+
//# sourceMappingURL=health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../../../src/src/http/protocol/endpoints/health.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzE,2DAA2D;AAC3D,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,sBAAsB,GAC9B,aAAa,GAAG,IAAI,CAEtB;AAED,wCAAwC;AACxC,wBAAgB,iBAAiB,IAAI,QAAQ,CAE5C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Operation } from "effection";
|
|
2
|
+
import { type AgentRuntime, type CesrStreamInspection, type Hab } from "keri-ts/runtime";
|
|
3
|
+
import type { ProtocolRequestContext, ProtocolRoute } from "../types.js";
|
|
4
|
+
/** Classify mailbox-admin requests before witness or generic ingress routing. */
|
|
5
|
+
export declare function classifyMailboxAdminRoute(context: ProtocolRequestContext): ProtocolRoute | null;
|
|
6
|
+
/**
|
|
7
|
+
* Handle mailbox add/remove authorization requests for one hosted mailbox AID.
|
|
8
|
+
*
|
|
9
|
+
* Contract:
|
|
10
|
+
* - request body is either one `application/cesr` stream or one
|
|
11
|
+
* `multipart/form-data` request carrying `kel`, optional `delkel`, and `rpy`
|
|
12
|
+
* - both request shapes normalize to one mailbox authorization CESR stream
|
|
13
|
+
* - that stream ends in the mailbox authorization `rpy`
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleMailboxAdmin(runtime: AgentRuntime, req: Request, mailboxAid: string, serviceHab?: Hab): Promise<Response>;
|
|
16
|
+
/** Validate the terminal mailbox authorization reply before local acceptance checks. */
|
|
17
|
+
export declare function validateMailboxAuthorizationReply(inspection: CesrStreamInspection, mailboxAid: string): Response | {
|
|
18
|
+
cid: string;
|
|
19
|
+
role: string;
|
|
20
|
+
expected: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** Confirm that mailbox authorization state was accepted locally. */
|
|
23
|
+
export declare function confirmMailboxAuthorization(runtime: AgentRuntime, cid: string, mailboxAid: string, expected: boolean): Response | null;
|
|
24
|
+
/** Settle mailbox-admin CESR ingress without responder-side cue forwarding. */
|
|
25
|
+
export declare function settleMailboxAdminIngress(runtime: AgentRuntime, bytes: Uint8Array, mailboxAid: string, signal?: AbortSignal): Operation<void>;
|
|
26
|
+
//# sourceMappingURL=mailbox-admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailbox-admin.d.ts","sourceRoot":"","sources":["../../../../../src/src/http/protocol/endpoints/mailbox-admin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAO,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAEzB,KAAK,GAAG,EAIT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzE,iFAAiF;AACjF,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,sBAAsB,GAC9B,aAAa,GAAG,IAAI,CAiBtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,GAAG,GACf,OAAO,CAAC,QAAQ,CAAC,CA+DnB;AAED,wFAAwF;AACxF,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,oBAAoB,EAChC,UAAU,EAAE,MAAM,GACjB,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAqC7D;AAED,qEAAqE;AACrE,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,OAAO,GAChB,QAAQ,GAAG,IAAI,CAOjB;AAED,+EAA+E;AAC/E,wBAAiB,yBAAyB,CACxC,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,SAAS,CAAC,IAAI,CAAC,CAMjB"}
|