-
Notifications
You must be signed in to change notification settings - Fork 11.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto: Load keypairs from file path #7011
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
fe1723c
to
51d1c6e
Compare
crates/sui-config/src/node.rs
Outdated
/// File path to read the protocol_key_pair from. | ||
pub protocol_key_pair_path: PathBuf, | ||
/// File path to read the worker_key_pair from. | ||
pub worker_key_pair_path: PathBuf, | ||
/// File path to read the account_key_pair from. | ||
pub account_key_pair_path: PathBuf, | ||
/// File path to read the network_key_pair from. | ||
pub network_key_pair_path: PathBuf, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having two fields, one for a file path and one for an embedded key, could we improve the UX of this to instead be handled by a single config like we've done for genesis? https://github.com/MystenLabs/sui/blob/main/crates/sui-config/src/node.rs#L300-L306
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
7c5fea0
to
c7522e2
Compare
.as_ref() | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, BLS is not included in the enum SuiKeyPair
and hence we have some code dup on KeyPairWithPath
vs AuthorityKeyPairWithPath
. I will follow up a cleanup PR to deprecate AuthorityKeyPair
fully (it is not trivial to add bc it comes with many traits to impl)
- protocol-key-pair: | ||
value: | ||
name: mfJe9h+AMrkUY2RgmCxcxvE07x3a52ZX8sv+wev8jQlzdAgN9vzw3Li8Sw2OCvXYDrv/K0xZn1T0LWMS38MUJ2B4wcw0fru+xRmL4lhRPzhrkw0CwnSagD4jMJVevRoQ | ||
secret: VTDx4HjVmRBqdqBWg2zN+zcFE20io3CrBchGy/iV1lo= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that the serialization for protocol-key-pair
looks different than the rest three that uses SuiKeyPair
. this is because it uses the derived serializer from fastcrypto instead of SuiKeyPair's own encode base64. this will be resolved when we add BLS to SuiKeyPair
.
this is not concerning because in production keypairs are using the file path option. the NetworkConfig
serialization is only used for swarm/testing that contains in-place serialized keypairs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be fixed by MystenLabs/fastcrypto#324
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for improving this!!
tested with