From 2f56e8b43d63f24c9a3e6bbd8da7d8070a78c85a Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 4 Apr 2023 13:30:07 +0200 Subject: [PATCH] include/libeosio/WIF.hpp: pass wif_codec_t to wif_print_key() and make it default to K1. --- include/libeosio/WIF.hpp | 2 +- src/WIF.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/libeosio/WIF.hpp b/include/libeosio/WIF.hpp index 2978c88..83ae7e4 100644 --- a/include/libeosio/WIF.hpp +++ b/include/libeosio/WIF.hpp @@ -78,7 +78,7 @@ bool wif_pub_decode(ec_pubkey_t& pub, const std::string& data); /** * Prints an EC keypair in WIF format to standard out. */ -void wif_print_key(const struct ec_keypair *key, const std::string& prefix = WIF_PUB_LEG); +void wif_print_key(const struct ec_keypair *key, const wif_codec_t& codec = WIF_CODEC_K1); /** * Signatures diff --git a/src/WIF.cpp b/src/WIF.cpp index 7de1c6b..cf19c16 100644 --- a/src/WIF.cpp +++ b/src/WIF.cpp @@ -123,10 +123,10 @@ bool wif_pub_decode(ec_pubkey_t& pub, const std::string& data) { return decoder(buf, pub); } -void wif_print_key(const struct ec_keypair *key, const std::string& prefix) { +void wif_print_key(const struct ec_keypair *key, const wif_codec_t& codec) { - std::cout << "Public: " << wif_pub_encode(key->pub, prefix) << std::endl; - std::cout << "Private: " << wif_priv_encode(key->secret, prefix) << std::endl; + std::cout << "Public: " << wif_pub_encode(key->pub, codec.pub) << std::endl; + std::cout << "Private: " << wif_priv_encode(key->secret, codec.pvt) << std::endl; } bool wif_sig_decode(ec_signature_t& sig, const std::string& data) {