Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tegefaulkes authored and CMCDragonkai committed Aug 18, 2023
1 parent 6fc7b80 commit 3064e24
Show file tree
Hide file tree
Showing 13 changed files with 195 additions and 325 deletions.
166 changes: 0 additions & 166 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 29 additions & 27 deletions src/PolykeyAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,6 @@ import TaskManager from './tasks/TaskManager';
import { serverManifest as clientServerManifest } from './client/handlers';
import { serverManifest as agentServerManifest } from './agent/handlers';

type NetworkConfig = {
// Agent QUICSocket config
agentHost?: string;
agentPort?: number;
ipv6Only?: boolean;
agentKeepAliveIntervalTime?: number;
agentMaxIdleTimeout?: number;
// RPCServer for client service
clientHost?: string;
clientPort?: number;
// Websocket server config
maxIdleTimeout?: number;
pingIntervalTime?: number;
pingTimeoutTimeTime?: number;
// RPC config
clientParserBufferByteLimit?: number;
handlerTimeoutTime?: number;
handlerTimeoutGraceTime?: number;
};

interface PolykeyAgent extends CreateDestroyStartStop {}
@CreateDestroyStartStop(
new errors.ErrorPolykeyAgentRunning(),
Expand Down Expand Up @@ -123,6 +103,10 @@ class PolykeyAgent {
}: {
password: string;
nodePath?: string;

// WHY IS THERE SO MANY CONFIGURATIONS???


keyRingConfig?: {
recoveryCode?: RecoveryCode;
privateKey?: PrivateKey;
Expand All @@ -142,7 +126,25 @@ class PolykeyAgent {
connectionHolePunchTimeoutTime?: number;
connectionHolePunchIntervalTime?: number;
};
networkConfig?: NetworkConfig;
networkConfig?: {
// Agent QUICSocket config
agentHost?: string;
agentPort?: number;
ipv6Only?: boolean;
agentKeepAliveIntervalTime?: number;
agentMaxIdleTimeout?: number;
// RPCServer for client service
clientHost?: string;
clientPort?: number;
// Websocket server config
maxIdleTimeout?: number;
pingIntervalTime?: number;
pingTimeoutTimeTime?: number;
// RPC config
clientParserBufferByteLimit?: number;
handlerTimeoutTime?: number;
handlerTimeoutGraceTime?: number;
};
seedNodes?: SeedNodes;
workers?: number;
status?: Status;
Expand Down Expand Up @@ -192,12 +194,12 @@ class PolykeyAgent {
};

await utils.mkdirExists(fs, nodePath);
const statusPath = path.join(nodePath, config.defaults.statusBase);
const statusLockPath = path.join(nodePath, config.defaults.statusLockBase);
const statePath = path.join(nodePath, config.defaults.stateBase);
const dbPath = path.join(statePath, config.defaults.dbBase);
const keysPath = path.join(statePath, config.defaults.keysBase);
const vaultsPath = path.join(statePath, config.defaults.vaultsBase);
const statusPath = path.join(nodePath, config.paths.statusBase);
const statusLockPath = path.join(nodePath, config.paths.statusLockBase);
const statePath = path.join(nodePath, config.paths.stateBase);
const dbPath = path.join(statePath, config.paths.dbBase);
const keysPath = path.join(statePath, config.paths.keysBase);
const vaultsPath = path.join(statePath, config.paths.vaultsBase);
const events = new EventBus({
captureRejections: true,
});
Expand Down
2 changes: 1 addition & 1 deletion src/PolykeyClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class PolykeyClient {
throw new errors.ErrorUtilsNodePath();
}
await utils.mkdirExists(fs, nodePath);
const sessionTokenPath = path.join(nodePath, config.defaults.tokenBase);
const sessionTokenPath = path.join(nodePath, config.paths.tokenBase);
session =
session ??
(await Session.createSession({
Expand Down
12 changes: 6 additions & 6 deletions src/bootstrap/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ async function bootstrapState({
}
await mkdirExists(fs, nodePath);
// Setup node path and sub paths
const statusPath = path.join(nodePath, config.defaults.statusBase);
const statusLockPath = path.join(nodePath, config.defaults.statusLockBase);
const statePath = path.join(nodePath, config.defaults.stateBase);
const dbPath = path.join(statePath, config.defaults.dbBase);
const keysPath = path.join(statePath, config.defaults.keysBase);
const vaultsPath = path.join(statePath, config.defaults.vaultsBase);
const statusPath = path.join(nodePath, config.paths.statusBase);
const statusLockPath = path.join(nodePath, config.paths.statusLockBase);
const statePath = path.join(nodePath, config.paths.stateBase);
const dbPath = path.join(statePath, config.paths.dbBase);
const keysPath = path.join(statePath, config.paths.keysBase);
const vaultsPath = path.join(statePath, config.paths.vaultsBase);
const status = new Status({
statusPath,
statusLockPath,
Expand Down
Loading

0 comments on commit 3064e24

Please sign in to comment.