Skip to content
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

Merged
merged 1 commit into from
Dec 30, 2022
Merged

crypto: Load keypairs from file path #7011

merged 1 commit into from
Dec 30, 2022

Conversation

joyqvq
Copy link
Contributor

@joyqvq joyqvq commented Dec 23, 2022

tested with

cargo build --bin sui
target/debug/sui genesis -f
target/debug/sui start 

@vercel
Copy link

vercel bot commented Dec 23, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
explorer 🔄 Building (Inspect) Dec 28, 2022 at 2:03AM (UTC)
2 Ignored Deployments
Name Status Preview Comments Updated
explorer-storybook ⬜️ Ignored (Inspect) Dec 28, 2022 at 2:03AM (UTC)
wallet-adapter ⬜️ Ignored (Inspect) Dec 28, 2022 at 2:03AM (UTC)

@joyqvq joyqvq force-pushed the load-kp1 branch 2 times, most recently from fe1723c to 51d1c6e Compare December 23, 2022 14:18
@joyqvq joyqvq marked this pull request as ready for review December 23, 2022 14:18
Comment on lines 61 to 68
/// 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,
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revised

.as_ref()
}
}

Copy link
Contributor Author

@joyqvq joyqvq Dec 28, 2022

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=
Copy link
Contributor Author

@joyqvq joyqvq Dec 28, 2022

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.

Copy link
Contributor Author

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

@joyqvq joyqvq requested review from benr-ml and bmwill December 28, 2022 02:05
Copy link
Contributor

@bmwill bmwill left a 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!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants