Skip to content

Commit

Permalink
fix: Small fixes and changes
Browse files Browse the repository at this point in the history
All tests are passing and linted.
  • Loading branch information
tegefaulkes committed Oct 24, 2023
1 parent aa03ce0 commit 98206de
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/PolykeyAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ type PolykeyAgentOptions = {
certDuration: number;
certRenewLeadTime: number;
recoveryCode: string;
privateKey: Buffer;
privateKeyPath: string;
};
} & (
| ObjectEmpty
| { recoveryCode: string }
| { privateKey: Buffer }
| { privateKeyPath: string }
);
client: {
keepAliveTimeoutTime: number;
keepAliveIntervalTime: number;
Expand All @@ -80,12 +83,7 @@ type PolykeyAgentOptions = {
rpcCallTimeoutTime: number;
rpcParserBufferSize: number;
};
} & (
| ObjectEmpty
| { recoveryCode: string }
| { privateKey: Buffer }
| { privateKeyPath: string }
);
};

interface PolykeyAgent extends CreateDestroyStartStop {}
@CreateDestroyStartStop(
Expand Down Expand Up @@ -169,7 +167,7 @@ class PolykeyAgent {
connectionHolePunchIntervalTime:
config.defaultsSystem.nodesConnectionHolePunchIntervalTime,
},
}) as PolykeyAgentOptions;
});
// This can only happen if the caller didn't specify the node path and the
// automatic detection failed
if (optionsDefaulted.nodePath == null) {
Expand Down Expand Up @@ -227,13 +225,16 @@ class PolykeyAgent {
});
keyRing = await KeyRing.createKeyRing({
keysPath,
passwordOpsLimit: optionsDefaulted.keys.passwordOpsLimit,
passwordMemLimit: optionsDefaulted.keys.passwordMemLimit,
strictMemoryLock: optionsDefaulted.keys.strictMemoryLock,
fs,
fresh,
password,
logger: logger.getChild(KeyRing.name),
passwordMemLimit: optionsDefaulted.keys.passwordMemLimit,
passwordOpsLimit: optionsDefaulted.keys.passwordOpsLimit,
privateKey: optionsDefaulted.keys.privateKey,
privateKeyPath: optionsDefaulted.keys.privateKeyPath,
recoveryCode: optionsDefaulted.keys.recoveryCode,
strictMemoryLock: optionsDefaulted.keys.strictMemoryLock,
});
db = await DB.createDB({
dbPath,
Expand Down Expand Up @@ -619,11 +620,11 @@ class PolykeyAgent {
agentServicePort: number;
ipv6Only: boolean;
workers: number;
keys: {
recoveryCode: string;
privateKey: Buffer;
privateKeyPath: string;
};
keys:
| ObjectEmpty
| { recoveryCode: string }
| { privateKey: Buffer }
| { privateKeyPath: string };
}>;
workers?: number;
fresh?: boolean;
Expand All @@ -649,9 +650,9 @@ class PolykeyAgent {
await this.keyRing.start({
password,
fresh,
recoveryCode: optionsDefaulted.keys.recoveryCode,
privateKey: optionsDefaulted.keys.privateKey,
privateKeyPath: optionsDefaulted.keys.privateKeyPath,
recoveryCode: optionsDefaulted.keys?.recoveryCode,
privateKey: optionsDefaulted.keys?.privateKey,
privateKeyPath: optionsDefaulted.keys?.privateKeyPath,
});
await this.db.start({
crypto: {
Expand Down

0 comments on commit 98206de

Please sign in to comment.