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: Ed25519 fromSecretKey takes pure 32 bytes privkey (MystenLabs…
…#6798) MystenLabs#6006 ## What This change makes `fromSecretKey` to take in an input of 32 bytes used as the pure privkey before hashing and bit clamping. Previously it took in a 64 byte privkey where the last 32 bytes is the public key and optionally validate it. The `fromSeed` method is deprecated. ## Why Taking in the 64 bytes privkey with baked in pubkey as the last 32 bytes is an API subject to misuse. Especially with skipValidation = true. ## How to fix If you run into errors probably because you are using 64 bytes privkey, truncating it to the first 32 bytes (.slice(0, 32)) will just work. ## Test plan Test added to confirm the sui.keystore vs typescript are the same when importing via mnenomics vs via raw secret key bytes. Also added an example in comments since we got a lot of qs on how to import a sui keystore format to typescript
- Loading branch information
Showing
7 changed files
with
112 additions
and
87 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@mysten/sui.js": minor | ||
--- | ||
|
||
Make fromSecretKey take the 32 bytes privkey |
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
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