Adding privateKeyPath back to PolykeyAgent #600
Conversation
b02eac1 to
6109fa6
Compare
|
@addievo I don't think you lintfixed this? |
|
| privateKeyPath: string; | ||
| privateKey: PrivateKey; |
There was a problem hiding this comment.
The privateKey: PrivateKey should be using a more open type, instead the opaque type because of PolykeyAgent taking parameters from outside world.
So if you want to keep this then you should be using privateKey: Buffer.
Also privateKey should be moved up top.
privateKey: Buffer;
privateKeyPath: string;
There was a problem hiding this comment.
These 2 options aren't even being used, if these 2 options are to be used, they should be passed to the KeyRing.createKeyRing.
There was a problem hiding this comment.
The PolykeyAgent.start should be taking DeepPartial of options, and the options need to keys: { recoveryCode; privateKey; privateKeyPath; }.
And also in the KeyRing.createKeyRing and KeyRing.start methods, these need to receive those options if you want to make them useful.
There was a problem hiding this comment.
Also the PolykeyAgentOptions needs to match:
} & ( // eslint-disable-next-line @typescript-eslint/ban-types
| {}
| {
recoveryCode: RecoveryCode;
}
| {
privateKey: PrivateKey;
}
| {
privateKeyPath: string;
}
Which ensures mutually independent options.
There was a problem hiding this comment.
So:
keys: ({} | { recoveryCode: string; } | { privateKey: Buffer } | { privateKeyPath: string })
And PolykeyAgent.start should take this.

Description
In
#582
Changes were made to
PolykeyAgentOptionsand it was flattened to remove dependency on types, this resulted inprivateKeyPathbeing removed fromPolykeyAgentOptionswhich is causing issues inPolykey-CLI.This PR aims to add it back to PolykeyAgentOptions.
Tasks
privateKeyandprivateKeyPathback toPolykeyAgentOptions.Final checklist