forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: Rederive pubkey for encode/decode (MystenLabs#6989)
MystenLabs#6940 ## What This changes the serialization of a `SuiKeyPair` from base64 encoded `flag || pubkey || privkey` to `flag || privkey`. This is to never trust the pubkey bytes inputs when but to always derive it from privkey when bootstrapping from read/write from files. This impact the `sui keytool generate` and `sui client new-address`. ## Notes for breaking change If you see the following error, ``` target/debug/sui keytool generate ed25519 Invalid Keypair file InvalidInput "/Users/joy/.sui/sui_config/sui.keystore" ``` This is because the old serialization cannot be parsed anymore. Run: `rm /Users/joy/.sui/sui_config/sui.keystore` If you would like to keep the existing keys, please reimport from mnemonics using `keytool import` ## Test ``` target/debug/sui client new-address ed25519 Created new keypair for address with scheme ED25519: [0x25142b365037715dae989375ac2b74b2517edd62] Secret Recovery Phrase : [original rent brick leader middle target cheap rather choose elephant system abstract despair math pudding music garment young syrup foam core try good market] target/debug/sui client new-address secp256k1 Created new keypair for address with scheme Secp256k1: [0x049045049bbcd071609e0caf88b0542ed791aa3e] Secret Recovery Phrase : [enroll field short hurry unique morning glad can bridge immune sorry blood badge collect gesture math gallery rifle lens surge nasty hurt couch delay] target/debug/sui client new-address secp256r1 Created new keypair for address with scheme Secp256r1: [0xa76b0f7b5e19b86c768486b1ffb757b9952f8d61] Secret Recovery Phrase : [witness stuff sorry try chuckle cliff moon share purchase person runway online usual exit lunar same limit act walk spread abandon cradle basic coin] target/debug/sui keytool list Sui Address | Public Key (Base64) | Scheme ---------------------------------------------------------------------------------------------------- 0x049045049bbcd071609e0caf88b0542ed791aa3e | AQKxLzhpin3HwLzcjscgPGzrcdRvCX6vZT0xTH5X6PDKRA== | secp256k1 0x25142b365037715dae989375ac2b74b2517edd62 | AOBT/yUKPQuCNh8eiLaGyyIoUTa3HbWpxwYxM/1dNdoV | ed25519 0xa76b0f7b5e19b86c768486b1ffb757b9952f8d61 | AgNy9UEXhU/K1aro4vY/QxssR6pfw9K6NmNLsUDi0VydSg== | secp256r1 cat /Users/joy/.sui/sui_config/sui.keystore [ "ATWhXWl/zlrENWnc2AIbjChwAB5FGMsBp3RBcKUCUe90", "AOhFYQNpqLgJyYmfg975nwQmQ8YCPXCnTw/l8ZjIBEqy", "ArYljv5d6NQWahm8/oDF7xa+E5f6XpyMdDxTfPuxhLzD" ]%
- Loading branch information
Showing
10 changed files
with
267 additions
and
320 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.