-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support custom key types and key definition registry
There is now a type core/crypto.KeyDefinition that is registered with core/crypto.RegisterKeyType. An arbitrary external key type can be supported with basic capabilities defined, including unmarshal/generate/type. The main purpose is to recognize key types in various config, DBs, and network comms, and provide the ability to unmarshal and create these keys. type KeyDefinition interface { Type() KeyType // name of key type e.g. "secp256k1" EncodeFlag() uint32 // prefix for compact unique binary encoding UnmarshalPrivateKey(b []byte) (PrivateKey, error) UnmarshalPublicKey(b []byte) (PublicKey, error) Generate() PrivateKey } The package level core/crypto.UnmarshalPrivateKey (and one for public) dispatch to the registered implementation based on KeyType. Note that the interfaces PrivateKey and PublicKey include the crypto.Key interface, which has its own marshal method (Bytes()). KeyType is a string now to make it self describing since we can't really have methods like Valid and String anymore now that the key type registry is not in core. Regarding the weird new EncodeFlag, this is for node internal use to make compact serializations. See core/crypto.WireEncodeKey etc. It seemed silly to encode a string key type in non-user-facing places like storage, network transmission, hashing, etc. So this does create a second value that must be unique to register, but I don't think it's a problem. permit eth address in account balance,transfer commands eth addr in account balance output
- Loading branch information
1 parent
1c3700e
commit c27631e
Showing
99 changed files
with
2,192 additions
and
2,081 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
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
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.