Skip to content

Commit 66dc5c3

Browse files
tegefaulkesCMCDragonkai
authored andcommitted
WIP
1 parent 6fc7b80 commit 66dc5c3

File tree

13 files changed

+196
-323
lines changed

13 files changed

+196
-323
lines changed

package-lock.json

Lines changed: 0 additions & 166 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/PolykeyAgent.ts

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,6 @@ import TaskManager from './tasks/TaskManager';
4646
import { serverManifest as clientServerManifest } from './client/handlers';
4747
import { serverManifest as agentServerManifest } from './agent/handlers';
4848

49-
type NetworkConfig = {
50-
// Agent QUICSocket config
51-
agentHost?: string;
52-
agentPort?: number;
53-
ipv6Only?: boolean;
54-
agentKeepAliveIntervalTime?: number;
55-
agentMaxIdleTimeout?: number;
56-
// RPCServer for client service
57-
clientHost?: string;
58-
clientPort?: number;
59-
// Websocket server config
60-
maxIdleTimeout?: number;
61-
pingIntervalTime?: number;
62-
pingTimeoutTimeTime?: number;
63-
// RPC config
64-
clientParserBufferByteLimit?: number;
65-
handlerTimeoutTime?: number;
66-
handlerTimeoutGraceTime?: number;
67-
};
68-
6949
interface PolykeyAgent extends CreateDestroyStartStop {}
7050
@CreateDestroyStartStop(
7151
new errors.ErrorPolykeyAgentRunning(),
@@ -123,6 +103,10 @@ class PolykeyAgent {
123103
}: {
124104
password: string;
125105
nodePath?: string;
106+
107+
// WHY IS THERE SO MANY CONFIGURATIONS???
108+
109+
126110
keyRingConfig?: {
127111
recoveryCode?: RecoveryCode;
128112
privateKey?: PrivateKey;
@@ -142,7 +126,25 @@ class PolykeyAgent {
142126
connectionHolePunchTimeoutTime?: number;
143127
connectionHolePunchIntervalTime?: number;
144128
};
145-
networkConfig?: NetworkConfig;
129+
networkConfig?: {
130+
// Agent QUICSocket config
131+
agentHost?: string;
132+
agentPort?: number;
133+
ipv6Only?: boolean;
134+
agentKeepAliveIntervalTime?: number;
135+
agentMaxIdleTimeout?: number;
136+
// RPCServer for client service
137+
clientHost?: string;
138+
clientPort?: number;
139+
// Websocket server config
140+
maxIdleTimeout?: number;
141+
pingIntervalTime?: number;
142+
pingTimeoutTimeTime?: number;
143+
// RPC config
144+
clientParserBufferByteLimit?: number;
145+
handlerTimeoutTime?: number;
146+
handlerTimeoutGraceTime?: number;
147+
};
146148
seedNodes?: SeedNodes;
147149
workers?: number;
148150
status?: Status;
@@ -192,12 +194,12 @@ class PolykeyAgent {
192194
};
193195

194196
await utils.mkdirExists(fs, nodePath);
195-
const statusPath = path.join(nodePath, config.defaults.statusBase);
196-
const statusLockPath = path.join(nodePath, config.defaults.statusLockBase);
197-
const statePath = path.join(nodePath, config.defaults.stateBase);
198-
const dbPath = path.join(statePath, config.defaults.dbBase);
199-
const keysPath = path.join(statePath, config.defaults.keysBase);
200-
const vaultsPath = path.join(statePath, config.defaults.vaultsBase);
197+
const statusPath = path.join(nodePath, config.paths.statusBase);
198+
const statusLockPath = path.join(nodePath, config.paths.statusLockBase);
199+
const statePath = path.join(nodePath, config.paths.stateBase);
200+
const dbPath = path.join(statePath, config.paths.dbBase);
201+
const keysPath = path.join(statePath, config.paths.keysBase);
202+
const vaultsPath = path.join(statePath, config.paths.vaultsBase);
201203
const events = new EventBus({
202204
captureRejections: true,
203205
});

src/PolykeyClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class PolykeyClient {
4949
throw new errors.ErrorUtilsNodePath();
5050
}
5151
await utils.mkdirExists(fs, nodePath);
52-
const sessionTokenPath = path.join(nodePath, config.defaults.tokenBase);
52+
const sessionTokenPath = path.join(nodePath, config.paths.tokenBase);
5353
session =
5454
session ??
5555
(await Session.createSession({

src/bootstrap/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ async function bootstrapState({
5656
}
5757
await mkdirExists(fs, nodePath);
5858
// Setup node path and sub paths
59-
const statusPath = path.join(nodePath, config.defaults.statusBase);
60-
const statusLockPath = path.join(nodePath, config.defaults.statusLockBase);
61-
const statePath = path.join(nodePath, config.defaults.stateBase);
62-
const dbPath = path.join(statePath, config.defaults.dbBase);
63-
const keysPath = path.join(statePath, config.defaults.keysBase);
64-
const vaultsPath = path.join(statePath, config.defaults.vaultsBase);
59+
const statusPath = path.join(nodePath, config.paths.statusBase);
60+
const statusLockPath = path.join(nodePath, config.paths.statusLockBase);
61+
const statePath = path.join(nodePath, config.paths.stateBase);
62+
const dbPath = path.join(statePath, config.paths.dbBase);
63+
const keysPath = path.join(statePath, config.paths.keysBase);
64+
const vaultsPath = path.join(statePath, config.paths.vaultsBase);
6565
const status = new Status({
6666
statusPath,
6767
statusLockPath,

0 commit comments

Comments
 (0)