wallet-core
wallet-core copied to clipboard
[PrivateKey] Add shortcut method to get `PublicKey` from `CoinType`
We have these methods in TWPrivateKey.h:
TWPrivateKeyGetPublicKeySecp256k1TWPrivateKeyGetPublicKeyEd25519TWPrivateKeyGetPublicKeyNist256p1- ...
Would be easier for the app to have a method like TWPrivateKeyGetPublicKey(TWCoinType)
In the internal C++ class we have with publicKeyType parameter. I'm not sure why in the C version we have named versions for different types. If we follow the same approach, we should have a version with publicKeyType (caller has to first retrieve public key type from coin type). But your suggestion is more convenient for the caller.
https://github.com/trustwallet/wallet-core/blob/master/src/PrivateKey.h#L65
@hewigovens @catenocrypt TWCoinType include TWPrivateKey.h
There is a circular dependencies, and forward enum declaration are not authorized in C++ - do we implement the function in TWCoinType.h?
Otherwise I can just move the enum in a standalone file and continue the implementation as expected
In the internal C++ class we have with
publicKeyTypeparameter. I'm not sure why in the C version we have named versions for different types. If we follow the same approach, we should have a version withpublicKeyType(caller has to first retrieve public key type from coin type). But your suggestion is more convenient for the caller. https://github.com/trustwallet/wallet-core/blob/master/src/PrivateKey.h#L65
We can have both possibility - there is some use case where in CLI the second version is more appropriate.