b33address.cpp 942 B

12345678910111213141516171819202122232425262728293031
  1. #include <iostream>
  2. #include <string>
  3. #include <memory>
  4. #include "Identity.h"
  5. #include "LeaseSet.h"
  6. #include "common/key.hpp"
  7. int main(int argc, char * argv[])
  8. {
  9. // base64 input, b33 and store key output, 11->11 only
  10. std::cout << "Waiting for base64 from stdin..." << std::endl;
  11. std::string base64;
  12. std::getline (std::cin, base64);
  13. auto ident = std::make_shared<i2p::data::IdentityEx>();
  14. if (ident->FromBase64 (base64))
  15. {
  16. if (ident->GetSigningKeyType () == i2p::data::SIGNING_KEY_TYPE_REDDSA_SHA512_ED25519)
  17. {
  18. i2p::data::BlindedPublicKey blindedKey (ident);
  19. std::cout << "b33 address: " << blindedKey.ToB33 () << ".b32.i2p" << std::endl;
  20. std::cout << "Today's store hash: " << blindedKey.GetStoreHash ().ToBase64 () << std::endl;
  21. }
  22. else
  23. std::cout << "Invalid signature type " << SigTypeToName (ident->GetSigningKeyType ()) << std::endl;
  24. }
  25. else
  26. std::cout << "Invalid base64 address" << std::endl;
  27. return 0;
  28. }