ED25519 and Ethereum String Serialization Support #170
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes standardized string serialization and deserialization for Solana Ed25519 (ED) and Ethereum (EM) cryptographic types. It enables conversion between native string formats (e.g., Solana-style Base58 for ED25519 and Hex for Ethereum) and the project's internal
public_key,private_key, andsignaturestorage types.Changes
fc::cryptotype changesfc::cryptopublic_key,private_key,signaturetypes now have afrom_string()instead of constructors for converting from a string. Thefrom_stringtakes an optional type for specification of the type of key/signature to create. If the defaultunknownis provided then the prefix strings likePUB_ED_is required so that the type can be inferred from the string.to_string()now takes abool include_prefixdefaulting tofalse. Iftruethen the type prefix, e.g.PUB_ED_is added to the string. This is useful for knowing how to parse the string according to its type. If the defaultfalseis provided then the prefix is not included. This currently only affects ED and EM as other existing Wire types like R1 and BLS always provide the prefix since that is part of their "native" string representation.Ed25519 String Formatting
to_stringandfrom_stringmethods topublic_key_shim,private_key_shim, andsignature_shimusing standard Ed25519 Base58 encoding.from_native_string_to_signature<chain_key_type_solana>inkey_serdes.hpp.Ethereum (EM) String Formatting
to_stringandfrom_stringfor Ethereum types, supporting standard hexadecimal representations for keys and signatures.signature.cppandprivate_key.cppto correctly routeemtypes to Ethereum-specific hex utilities viakey_serdes.hpp.Unified Prefix Support
Updated parsing logic to support the following project-standardized prefixes:
PVT_ED_,PUB_ED_, andSIG_ED_.PVT_EM_,PUB_EM_, andSIG_EM_.PUB_EM_0x04e68a...=>0x04e68a....clioupdatesclio create key --k1which will generate K1 keys withPUB_K1_&PVT_K1_prefix.clio convert k1_public_keywhich will read either form of K1 key and output both.clio convert k1_private_keywhich will read either form of K1 key and output private key and public key in both formats.PR also removes unneeded padding from ED
signature_shim.