mindoodb 0.0.60 → 0.0.62
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-server.md +13 -3
- package/README.md +1 -0
- package/dist/core/appendonlystores/network/IrohNetworkTransport.d.ts +10 -0
- package/dist/core/appendonlystores/network/IrohNetworkTransport.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/IrohNetworkTransport.js +186 -25
- package/dist/core/appendonlystores/network/IrohNetworkTransport.js.map +1 -1
- package/dist/core/appendonlystores/network/IrohStreamIO.d.ts +30 -1
- package/dist/core/appendonlystores/network/IrohStreamIO.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/IrohStreamIO.js +43 -11
- package/dist/core/appendonlystores/network/IrohStreamIO.js.map +1 -1
- package/dist/iroh/index.d.ts +5 -1
- package/dist/iroh/index.d.ts.map +1 -1
- package/dist/iroh/index.js +4 -0
- package/dist/iroh/index.js.map +1 -1
- package/dist/iroh/node.d.ts +26 -0
- package/dist/iroh/node.d.ts.map +1 -0
- package/dist/iroh/node.js +27 -0
- package/dist/iroh/node.js.map +1 -0
- package/dist/node/server/IrohServerEndpoint.d.ts +5 -0
- package/dist/node/server/IrohServerEndpoint.d.ts.map +1 -1
- package/dist/node/server/IrohServerEndpoint.js +14 -104
- package/dist/node/server/IrohServerEndpoint.js.map +1 -1
- package/dist/node/server/IrohServerRpc.d.ts +38 -0
- package/dist/node/server/IrohServerRpc.d.ts.map +1 -1
- package/dist/node/server/IrohServerRpc.js +266 -5
- package/dist/node/server/IrohServerRpc.js.map +1 -1
- package/dist/node/server/MindooDBServer.d.ts +3 -0
- package/dist/node/server/MindooDBServer.d.ts.map +1 -1
- package/dist/node/server/MindooDBServer.js +29 -0
- package/dist/node/server/MindooDBServer.js.map +1 -1
- package/dist/node/server/nativeIrohStreamIO.d.ts +13 -0
- package/dist/node/server/nativeIrohStreamIO.d.ts.map +1 -0
- package/dist/node/server/nativeIrohStreamIO.js +259 -0
- package/dist/node/server/nativeIrohStreamIO.js.map +1 -0
- package/dist/node/server/peer/ClusterManager.d.ts +6 -0
- package/dist/node/server/peer/ClusterManager.d.ts.map +1 -1
- package/dist/node/server/peer/ClusterManager.js +1 -0
- package/dist/node/server/peer/ClusterManager.js.map +1 -1
- package/dist/node/server/peer/IrohPeerLink.d.ts +24 -0
- package/dist/node/server/peer/IrohPeerLink.d.ts.map +1 -0
- package/dist/node/server/peer/IrohPeerLink.js +115 -0
- package/dist/node/server/peer/IrohPeerLink.js.map +1 -0
- package/dist/node/server/peer/PeerReplicator.d.ts +9 -0
- package/dist/node/server/peer/PeerReplicator.d.ts.map +1 -1
- package/dist/node/server/peer/PeerReplicator.js +103 -6
- package/dist/node/server/peer/PeerReplicator.js.map +1 -1
- package/dist/node/server/types.d.ts +5 -3
- package/dist/node/server/types.d.ts.map +1 -1
- package/dist/node/server/types.js.map +1 -1
- package/package.json +7 -1
- package/scripts/iroh-live-test-server.mjs +30 -0
- package/scripts/iroh-live-test-server.ts +61 -0
- package/scripts/iroh-multistream-spike.mjs +113 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IrohStreamIO.js","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/IrohStreamIO.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"IrohStreamIO.js","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/IrohStreamIO.ts"],"names":[],"mappings":";;;AA2HA,0CAEC;AAGD,8CAGC;AAWD,oEA6CC;AAQD,0CAEC;AAmGD,wDAsEC;AA9WD;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG,kBAAkB,CAAC;AA2GrD,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,OAAgB;IAC9C,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,O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,EAAE,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC;KAC9D,CAAC;AACJ,CAAC"}
|
package/dist/iroh/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Additive Iroh transport. Not imported by `mindoodb/browser`.
|
|
3
|
+
*
|
|
4
|
+
* Protocol types and `IrohNetworkTransport` live here. The Node QUIC adapter
|
|
5
|
+
* (`createNodeIrohStreamIO`) is `mindoodb/iroh/node` so web bundlers do not
|
|
6
|
+
* pull in `fs` / `@number0/iroh`.
|
|
3
7
|
*/
|
|
4
|
-
export { MINDOODB_IROH_ALPN, createLoopbackIrohPair, decodeIrohFrame, encodeIrohFrame, wrapLengthPrefixedByteStream, type IrohByteStream, type IrohRpcContext, type IrohRpcRequest, type IrohRpcResponse, type IrohStreamIO, } from "../core/appendonlystores/network/IrohStreamIO";
|
|
8
|
+
export { MINDOODB_IROH_ALPN, createLoopbackIrohPair, decodeIrohFrame, encodeIrohFrame, wrapLengthPrefixedByteStream, type IrohByteStream, type IrohConnectionHandle, type IrohRpcContext, type IrohRpcRequest, type IrohRpcResponse, type IrohStreamIO, } from "../core/appendonlystores/network/IrohStreamIO";
|
|
5
9
|
export { IrohNetworkTransport, IrohPeerStore, createStoreIrohHandler, listenForIrohPeers, serveIrohRpc, type IrohRpcHandler, } from "../core/appendonlystores/network/IrohNetworkTransport";
|
|
6
10
|
export { createReactNativeIrohStreamIO } from "../core/appendonlystores/network/reactNativeIrohStreamIO";
|
|
7
11
|
export { extractEndpointIdFromTicket, isIrohLocator, parseIrohLocator, type ParsedIrohLocator, } from "../core/appendonlystores/network/irohLocator";
|
package/dist/iroh/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/iroh/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/iroh/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,4BAA4B,EAC5B,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,GAClB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,YAAY,EACZ,KAAK,cAAc,GACpB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0DAA0D,CAAC;AACzG,OAAO,EACL,2BAA2B,EAC3B,aAAa,EACb,gBAAgB,EAChB,KAAK,iBAAiB,GACvB,MAAM,8CAA8C,CAAC"}
|
package/dist/iroh/index.js
CHANGED
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseIrohLocator = exports.isIrohLocator = exports.extractEndpointIdFromTicket = exports.createReactNativeIrohStreamIO = exports.serveIrohRpc = exports.listenForIrohPeers = exports.createStoreIrohHandler = exports.IrohPeerStore = exports.IrohNetworkTransport = exports.wrapLengthPrefixedByteStream = exports.encodeIrohFrame = exports.decodeIrohFrame = exports.createLoopbackIrohPair = exports.MINDOODB_IROH_ALPN = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Additive Iroh transport. Not imported by `mindoodb/browser`.
|
|
6
|
+
*
|
|
7
|
+
* Protocol types and `IrohNetworkTransport` live here. The Node QUIC adapter
|
|
8
|
+
* (`createNodeIrohStreamIO`) is `mindoodb/iroh/node` so web bundlers do not
|
|
9
|
+
* pull in `fs` / `@number0/iroh`.
|
|
6
10
|
*/
|
|
7
11
|
var IrohStreamIO_1 = require("../core/appendonlystores/network/IrohStreamIO");
|
|
8
12
|
Object.defineProperty(exports, "MINDOODB_IROH_ALPN", { enumerable: true, get: function () { return IrohStreamIO_1.MINDOODB_IROH_ALPN; } });
|
package/dist/iroh/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/iroh/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/iroh/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,8EAYuD;AAXrD,kHAAA,kBAAkB,OAAA;AAClB,sHAAA,sBAAsB,OAAA;AACtB,+GAAA,eAAe,OAAA;AACf,+GAAA,eAAe,OAAA;AACf,4HAAA,4BAA4B,OAAA;AAQ9B,8FAO+D;AAN7D,4HAAA,oBAAoB,OAAA;AACpB,qHAAA,aAAa,OAAA;AACb,8HAAA,sBAAsB,OAAA;AACtB,0HAAA,kBAAkB,OAAA;AAClB,oHAAA,YAAY,OAAA;AAGd,oGAAyG;AAAhG,wIAAA,6BAA6B,OAAA;AACtC,4EAKsD;AAJpD,0HAAA,2BAA2B,OAAA;AAC3B,4GAAA,aAAa,OAAA;AACb,+GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Iroh adapter (`@number0/iroh`). Import from `mindoodb/iroh/node`,
|
|
3
|
+
* not `mindoodb/iroh` — this module uses `fs`/`path` and must not be bundled
|
|
4
|
+
* for the browser.
|
|
5
|
+
*/
|
|
6
|
+
import { createNativeIrohStreamIO, tryImportNumber0Iroh, type NativeIrohStreamIO } from "../node/server/nativeIrohStreamIO";
|
|
7
|
+
export { createNativeIrohStreamIO, tryImportNumber0Iroh, type NativeIrohStreamIO };
|
|
8
|
+
export interface NodeIrohStreamIOOptions {
|
|
9
|
+
/** Directory for the persistent 32-byte Iroh secret (created if missing). */
|
|
10
|
+
dataDir: string;
|
|
11
|
+
/**
|
|
12
|
+
* Secret-key path. Relative paths resolve against {@link NodeIrohStreamIOOptions.dataDir}.
|
|
13
|
+
* Defaults to `iroh-secret.key`.
|
|
14
|
+
*/
|
|
15
|
+
secretKeyPath?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Bind a native Iroh endpoint for a Node CLI or service.
|
|
19
|
+
*
|
|
20
|
+
* Waits until the endpoint has a home relay (`online()`) so browser/WASM
|
|
21
|
+
* peers can dial the ticket. Prefer {@link NativeIrohStreamIO.openConnection}
|
|
22
|
+
* and then `openStream()` for each in-flight RPC (and the change feed);
|
|
23
|
+
* {@link NativeIrohStreamIO.connect} is a one-stream convenience wrapper.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createNodeIrohStreamIO(options: NodeIrohStreamIOOptions): Promise<NativeIrohStreamIO>;
|
|
26
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/iroh/node.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,kBAAkB,EACxB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,KAAK,kBAAkB,EAAE,CAAC;AAEnF,MAAM,WAAW,uBAAuB;IACtC,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAK7B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryImportNumber0Iroh = exports.createNativeIrohStreamIO = void 0;
|
|
4
|
+
exports.createNodeIrohStreamIO = createNodeIrohStreamIO;
|
|
5
|
+
/**
|
|
6
|
+
* Node.js Iroh adapter (`@number0/iroh`). Import from `mindoodb/iroh/node`,
|
|
7
|
+
* not `mindoodb/iroh` — this module uses `fs`/`path` and must not be bundled
|
|
8
|
+
* for the browser.
|
|
9
|
+
*/
|
|
10
|
+
const nativeIrohStreamIO_1 = require("../node/server/nativeIrohStreamIO");
|
|
11
|
+
Object.defineProperty(exports, "createNativeIrohStreamIO", { enumerable: true, get: function () { return nativeIrohStreamIO_1.createNativeIrohStreamIO; } });
|
|
12
|
+
Object.defineProperty(exports, "tryImportNumber0Iroh", { enumerable: true, get: function () { return nativeIrohStreamIO_1.tryImportNumber0Iroh; } });
|
|
13
|
+
/**
|
|
14
|
+
* Bind a native Iroh endpoint for a Node CLI or service.
|
|
15
|
+
*
|
|
16
|
+
* Waits until the endpoint has a home relay (`online()`) so browser/WASM
|
|
17
|
+
* peers can dial the ticket. Prefer {@link NativeIrohStreamIO.openConnection}
|
|
18
|
+
* and then `openStream()` for each in-flight RPC (and the change feed);
|
|
19
|
+
* {@link NativeIrohStreamIO.connect} is a one-stream convenience wrapper.
|
|
20
|
+
*/
|
|
21
|
+
async function createNodeIrohStreamIO(options) {
|
|
22
|
+
return (0, nativeIrohStreamIO_1.createNativeIrohStreamIO)(options.dataDir, {
|
|
23
|
+
enabled: true,
|
|
24
|
+
secretKeyPath: options.secretKeyPath,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/iroh/node.ts"],"names":[],"mappings":";;;AA+BA,wDAOC;AAtCD;;;;GAIG;AACH,0EAI2C;AAElC,yGALP,6CAAwB,OAKO;AAAE,qGAJjC,yCAAoB,OAIiC;AAYvD;;;;;;;GAOG;AACI,KAAK,UAAU,sBAAsB,CAC1C,OAAgC;IAEhC,OAAO,IAAA,6CAAwB,EAAC,OAAO,CAAC,OAAO,EAAE;QAC/C,OAAO,EAAE,IAAI;QACb,aAAa,EAAE,OAAO,CAAC,aAAa;KACrC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type IrohRpcHandler } from "../../core/appendonlystores/network/IrohNetworkTransport";
|
|
2
2
|
import type { ServerIrohConfig } from "./types";
|
|
3
|
+
import { type NativeIrohStreamIO } from "./nativeIrohStreamIO";
|
|
3
4
|
export interface IrohServerEndpointStatus {
|
|
4
5
|
enabled: boolean;
|
|
5
6
|
ticket?: string;
|
|
@@ -11,8 +12,11 @@ export interface IrohServerEndpointStatus {
|
|
|
11
12
|
*/
|
|
12
13
|
export declare class IrohServerEndpoint {
|
|
13
14
|
private stop;
|
|
15
|
+
private io;
|
|
14
16
|
private status;
|
|
15
17
|
getStatus(): IrohServerEndpointStatus;
|
|
18
|
+
/** The bound native endpoint, or `null` until listen succeeds. */
|
|
19
|
+
getStreamIO(): NativeIrohStreamIO | null;
|
|
16
20
|
start(options: {
|
|
17
21
|
dataDir: string;
|
|
18
22
|
config: ServerIrohConfig;
|
|
@@ -20,4 +24,5 @@ export declare class IrohServerEndpoint {
|
|
|
20
24
|
}): Promise<IrohServerEndpointStatus>;
|
|
21
25
|
stopListening(): Promise<void>;
|
|
22
26
|
}
|
|
27
|
+
export type { NativeIrohStreamIO };
|
|
23
28
|
//# sourceMappingURL=IrohServerEndpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IrohServerEndpoint.d.ts","sourceRoot":"","sources":["../../../src/node/server/IrohServerEndpoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IrohServerEndpoint.d.ts","sourceRoot":"","sources":["../../../src/node/server/IrohServerEndpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,0DAA0D,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEzF,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,IAAI,CAAsC;IAClD,OAAO,CAAC,EAAE,CAAmC;IAC7C,OAAO,CAAC,MAAM,CAAgD;IAE9D,SAAS,IAAI,wBAAwB;IAIrC,kEAAkE;IAClE,WAAW,IAAI,kBAAkB,GAAG,IAAI;IAIlC,KAAK,CAAC,OAAO,EAAE;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,gBAAgB,CAAC;QACzB,OAAO,EAAE,cAAc,CAAC;KACzB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAiC/B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAWrC;AAED,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IrohServerEndpoint = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const crypto_1 = require("crypto");
|
|
7
4
|
const IrohNetworkTransport_1 = require("../../core/appendonlystores/network/IrohNetworkTransport");
|
|
8
5
|
const IrohStreamIO_1 = require("../../core/appendonlystores/network/IrohStreamIO");
|
|
6
|
+
const nativeIrohStreamIO_1 = require("./nativeIrohStreamIO");
|
|
9
7
|
/**
|
|
10
8
|
* Optional native Iroh listen loop. `@number0/iroh` is loaded dynamically so
|
|
11
9
|
* tests and HTTP-only installs do not need the N-API binary.
|
|
@@ -13,27 +11,34 @@ const IrohStreamIO_1 = require("../../core/appendonlystores/network/IrohStreamIO
|
|
|
13
11
|
class IrohServerEndpoint {
|
|
14
12
|
constructor() {
|
|
15
13
|
this.stop = null;
|
|
14
|
+
this.io = null;
|
|
16
15
|
this.status = { enabled: false };
|
|
17
16
|
}
|
|
18
17
|
getStatus() {
|
|
19
18
|
return this.status;
|
|
20
19
|
}
|
|
20
|
+
/** The bound native endpoint, or `null` until listen succeeds. */
|
|
21
|
+
getStreamIO() {
|
|
22
|
+
return this.io;
|
|
23
|
+
}
|
|
21
24
|
async start(options) {
|
|
22
25
|
await this.stopListening();
|
|
23
26
|
if (!options.config.enabled) {
|
|
24
27
|
this.status = { enabled: false };
|
|
25
28
|
return this.status;
|
|
26
29
|
}
|
|
27
|
-
const io = await createNativeIrohStreamIO(options.dataDir, options.config);
|
|
30
|
+
const io = await (0, nativeIrohStreamIO_1.createNativeIrohStreamIO)(options.dataDir, options.config);
|
|
31
|
+
this.io = io;
|
|
28
32
|
const abort = new AbortController();
|
|
29
|
-
const
|
|
33
|
+
const listenDone = (0, IrohNetworkTransport_1.listenForIrohPeers)(io, options.handler, { signal: abort.signal }).catch((error) => {
|
|
34
|
+
console.error("[Iroh] listen loop failed:", error);
|
|
35
|
+
});
|
|
30
36
|
this.stop = async () => {
|
|
31
37
|
abort.abort();
|
|
38
|
+
this.io = null;
|
|
32
39
|
await io.close?.();
|
|
40
|
+
await listenDone;
|
|
33
41
|
};
|
|
34
|
-
void listen.catch((error) => {
|
|
35
|
-
console.error("[Iroh] listen loop failed:", error);
|
|
36
|
-
});
|
|
37
42
|
const ticket = await io.getLocalTicket();
|
|
38
43
|
this.status = {
|
|
39
44
|
enabled: true,
|
|
@@ -53,104 +58,9 @@ class IrohServerEndpoint {
|
|
|
53
58
|
console.error("[Iroh] stop failed:", error);
|
|
54
59
|
});
|
|
55
60
|
}
|
|
61
|
+
this.io = null;
|
|
56
62
|
this.status = { enabled: false };
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
exports.IrohServerEndpoint = IrohServerEndpoint;
|
|
60
|
-
async function createNativeIrohStreamIO(dataDir, config) {
|
|
61
|
-
let iroh;
|
|
62
|
-
try {
|
|
63
|
-
iroh = await import("@number0/iroh");
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
throw new Error("Iroh is enabled in config.json but @number0/iroh is missing from the server image. " +
|
|
67
|
-
"Rebuild with ./serversetup.sh --update " +
|
|
68
|
-
`(${error instanceof Error ? error.message : String(error)}).`);
|
|
69
|
-
}
|
|
70
|
-
const secretBytes = loadOrCreateIrohSecret(dataDir, config.secretKeyPath);
|
|
71
|
-
const alpn = Array.from(Buffer.from(IrohStreamIO_1.MINDOODB_IROH_ALPN));
|
|
72
|
-
const secretKey = createSecretKey(iroh, secretBytes);
|
|
73
|
-
const endpoint = (await iroh.Endpoint.bind({
|
|
74
|
-
alpns: [alpn],
|
|
75
|
-
secretKey,
|
|
76
|
-
}));
|
|
77
|
-
const ticket = iroh.EndpointTicket.fromAddr(endpoint.addr()).toString();
|
|
78
|
-
const endpointId = endpoint.id().toString();
|
|
79
|
-
return {
|
|
80
|
-
endpointId,
|
|
81
|
-
async getLocalTicket() {
|
|
82
|
-
return ticket;
|
|
83
|
-
},
|
|
84
|
-
async connect(peerTicket, protocolAlpn) {
|
|
85
|
-
const addr = iroh.EndpointTicket.fromString(peerTicket).endpointAddr();
|
|
86
|
-
const conn = await endpoint.connect(addr, protocolAlpn ? Array.from(Buffer.from(protocolAlpn)) : alpn);
|
|
87
|
-
const bi = await conn.openBi();
|
|
88
|
-
return wrapNativeBiStream(bi);
|
|
89
|
-
},
|
|
90
|
-
async *listen() {
|
|
91
|
-
const acceptNext = endpoint.acceptNext.bind(endpoint);
|
|
92
|
-
while (true) {
|
|
93
|
-
const incoming = await acceptNext();
|
|
94
|
-
const connecting = await incoming.accept();
|
|
95
|
-
const conn = await connecting.connect();
|
|
96
|
-
const bi = await conn.acceptBi();
|
|
97
|
-
yield wrapNativeBiStream(bi);
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
async close() {
|
|
101
|
-
await endpoint.close();
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function wrapNativeBiStream(bi) {
|
|
106
|
-
return (0, IrohStreamIO_1.wrapLengthPrefixedByteStream)({
|
|
107
|
-
async write(bytes) {
|
|
108
|
-
await bi.send.writeAll(bytes);
|
|
109
|
-
},
|
|
110
|
-
async read(max) {
|
|
111
|
-
if (typeof bi.recv.read === "function") {
|
|
112
|
-
const chunk = await bi.recv.read(max);
|
|
113
|
-
return chunk ? toUint8Array(chunk) : null;
|
|
114
|
-
}
|
|
115
|
-
const chunk = await bi.recv.readToEnd?.(max);
|
|
116
|
-
return chunk ? toUint8Array(chunk) : null;
|
|
117
|
-
},
|
|
118
|
-
async close() {
|
|
119
|
-
await bi.send.finish().catch(() => undefined);
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function toUint8Array(value) {
|
|
124
|
-
return value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
125
|
-
}
|
|
126
|
-
function createSecretKey(iroh, secretBytes) {
|
|
127
|
-
const SecretKey = iroh.SecretKey;
|
|
128
|
-
if (typeof SecretKey?.fromBytes === "function") {
|
|
129
|
-
return SecretKey.fromBytes(secretBytes);
|
|
130
|
-
}
|
|
131
|
-
if (typeof SecretKey?.fromString === "function") {
|
|
132
|
-
return SecretKey.fromString(Buffer.from(secretBytes).toString("hex"));
|
|
133
|
-
}
|
|
134
|
-
throw new Error("@number0/iroh SecretKey.fromBytes is not available");
|
|
135
|
-
}
|
|
136
|
-
function loadOrCreateIrohSecret(dataDir, configuredPath) {
|
|
137
|
-
const filePath = configuredPath
|
|
138
|
-
? (0, path_1.isAbsolute)(configuredPath)
|
|
139
|
-
? configuredPath
|
|
140
|
-
: (0, path_1.join)(dataDir, configuredPath)
|
|
141
|
-
: (0, path_1.join)(dataDir, "iroh-secret.key");
|
|
142
|
-
if ((0, fs_1.existsSync)(filePath)) {
|
|
143
|
-
const raw = (0, fs_1.readFileSync)(filePath, "utf-8").trim();
|
|
144
|
-
const bytes = Buffer.from(raw, raw.length === 64 ? "hex" : "base64");
|
|
145
|
-
if (bytes.length !== 32) {
|
|
146
|
-
throw new Error(`Iroh secret key at ${filePath} must be 32 bytes`);
|
|
147
|
-
}
|
|
148
|
-
return new Uint8Array(bytes);
|
|
149
|
-
}
|
|
150
|
-
const bytes = (0, crypto_1.randomBytes)(32);
|
|
151
|
-
(0, fs_1.mkdirSync)((0, path_1.dirname)(filePath), { recursive: true });
|
|
152
|
-
(0, fs_1.writeFileSync)(filePath, bytes.toString("hex"), { encoding: "utf-8", mode: 0o600 });
|
|
153
|
-
console.log(`[Iroh] Wrote new secret key to ${filePath}`);
|
|
154
|
-
return new Uint8Array(bytes);
|
|
155
|
-
}
|
|
156
66
|
//# sourceMappingURL=IrohServerEndpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IrohServerEndpoint.js","sourceRoot":"","sources":["../../../src/node/server/IrohServerEndpoint.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"IrohServerEndpoint.js","sourceRoot":"","sources":["../../../src/node/server/IrohServerEndpoint.ts"],"names":[],"mappings":";;;AAAA,mGAGkE;AAClE,mFAAsF;AAEtF,6DAAyF;AAQzF;;;GAGG;AACH,MAAa,kBAAkB;IAA/B;QACU,SAAI,GAAiC,IAAI,CAAC;QAC1C,OAAE,GAA8B,IAAI,CAAC;QACrC,WAAM,GAA6B,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IA2DhE,CAAC;IAzDC,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,kEAAkE;IAClE,WAAW;QACT,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAIX;QACC,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,MAAM,GAAG,EAAE,OAAO,EAAE,KAAK,E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;YACd,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,MAAM,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC3B,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;CACF;AA9DD,gDA8DC"}
|
|
@@ -2,6 +2,16 @@ import { StoreKind } from "../../core/appendonlystores/types";
|
|
|
2
2
|
import type { IrohRpcHandler } from "../../core/appendonlystores/network/IrohNetworkTransport";
|
|
3
3
|
import type { MindooDBServerInfo } from "../../core/types";
|
|
4
4
|
import { ValidationError } from "./validation";
|
|
5
|
+
import type { SyncEventBus } from "./SyncEventBus";
|
|
6
|
+
import type { PeerTokenPayload } from "./peer/PeerAuthService";
|
|
7
|
+
/** QUIC idle timeout is ~30s; keep the feed alive below that. */
|
|
8
|
+
export declare const IROH_CHANGE_FEED_HEARTBEAT_MS = 20000;
|
|
9
|
+
export declare const IROH_CHANGE_FEED_HEARTBEAT: {
|
|
10
|
+
readonly type: "heartbeat";
|
|
11
|
+
};
|
|
12
|
+
/** Unauthenticated `peer.challenge` / `peer.authenticate` window. */
|
|
13
|
+
export declare const IROH_PEER_UNAUTH_WINDOW_MS = 60000;
|
|
14
|
+
export declare const IROH_PEER_UNAUTH_MAX = 30;
|
|
5
15
|
export interface IrohServerAuthService {
|
|
6
16
|
generateChallenge(username?: string, options?: {
|
|
7
17
|
signingPublicKey?: string;
|
|
@@ -32,6 +42,25 @@ export interface IrohServerStore {
|
|
|
32
42
|
handlePlanDocumentMaterializationBatch(token: string, docIds: string[], options?: unknown): Promise<unknown>;
|
|
33
43
|
handlePlanAttachmentReadByWalkingMetadata(token: string, lastChunkId: string, attachmentSize: number, options: unknown): Promise<unknown>;
|
|
34
44
|
}
|
|
45
|
+
export interface IrohPeerAuthHost {
|
|
46
|
+
generateChallenge(publicsignkey: string): Promise<string>;
|
|
47
|
+
authenticate(challenge: string, signature: Uint8Array): Promise<{
|
|
48
|
+
success: boolean;
|
|
49
|
+
token?: string;
|
|
50
|
+
error?: string;
|
|
51
|
+
}>;
|
|
52
|
+
validateToken(token: string): Promise<PeerTokenPayload | null>;
|
|
53
|
+
}
|
|
54
|
+
export interface IrohPeerClusterHost {
|
|
55
|
+
recordPeerIntersection(peerName: string, tenantIds: string[]): void;
|
|
56
|
+
peerMaySeeTenant(peerName: string, tenantId: string): boolean;
|
|
57
|
+
listTenants(): string[];
|
|
58
|
+
listDatabases(tenantId: string): string[];
|
|
59
|
+
requestSync(peerName: string, scope?: {
|
|
60
|
+
tenantId?: string;
|
|
61
|
+
dbId?: string;
|
|
62
|
+
}): void;
|
|
63
|
+
}
|
|
35
64
|
export interface IrohServerRpcHost {
|
|
36
65
|
getServerPublicInfo(): MindooDBServerInfo | null;
|
|
37
66
|
getJsonBodyLimit?: () => {
|
|
@@ -42,11 +71,20 @@ export interface IrohServerRpcHost {
|
|
|
42
71
|
listTenantPublicInfosFingerprints(tenantId: string): Promise<string[]>;
|
|
43
72
|
getAuthService(tenantId: string): Promise<IrohServerAuthService>;
|
|
44
73
|
getServerStore(tenantId: string, dbId: string, storeKind: StoreKind): Promise<IrohServerStore>;
|
|
74
|
+
syncEventBus?: SyncEventBus;
|
|
75
|
+
peerAuth?: IrohPeerAuthHost;
|
|
76
|
+
peerCluster?: IrohPeerClusterHost;
|
|
77
|
+
getPeerUnauthRateLimit?: () => {
|
|
78
|
+
windowMs: number;
|
|
79
|
+
max: number;
|
|
80
|
+
};
|
|
45
81
|
}
|
|
46
82
|
/**
|
|
47
83
|
* Inverse of {@link IrohNetworkTransport}: same method names, same args.
|
|
48
84
|
* Discovery methods are unauthenticated, matching `/.well-known/*`.
|
|
49
85
|
*/
|
|
50
86
|
export declare function createMindooDBServerIrohHandler(host: IrohServerRpcHost): IrohRpcHandler;
|
|
87
|
+
/** Test hook: drop recorded unauthenticated peer hits. */
|
|
88
|
+
export declare function resetIrohPeerUnauthLimiter(): void;
|
|
51
89
|
export declare function isIrohValidationError(error: unknown): error is ValidationError;
|
|
52
90
|
//# sourceMappingURL=IrohServerRpc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IrohServerRpc.d.ts","sourceRoot":"","sources":["../../../src/node/server/IrohServerRpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"IrohServerRpc.d.ts","sourceRoot":"","sources":["../../../src/node/server/IrohServerRpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4B,MAAM,mCAAmC,CAAC;AAExF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0DAA0D,CAAC;AAE/F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAoB,eAAe,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,iEAAiE;AACjE,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAEpD,eAAO,MAAM,0BAA0B;;CAAiC,CAAC;AAEzE,qEAAqE;AACrE,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAIvC,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,CACf,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,GACtC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,YAAY,CACV,SAAS,EAAE,MAA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