-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathb33address.cpp
31 lines (29 loc) · 1.01 KB
/
b33address.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <string>
#include <memory>
#include "Identity.h"
#include "LeaseSet.h"
#include "common/key.hpp"
int main(int argc, char * argv[])
{
// base64 input, b33 and store key output, 11->11 only
std::cout << "Waiting for base64 from stdin..." << std::endl;
std::string base64;
std::getline (std::cin, base64);
auto ident = std::make_shared<i2p::data::IdentityEx>();
if (ident->FromBase64 (base64))
{
if (ident->GetSigningKeyType () == i2p::data::SIGNING_KEY_TYPE_REDDSA_SHA512_ED25519 ||
ident->GetSigningKeyType () == i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519)
{
i2p::data::BlindedPublicKey blindedKey (ident);
std::cout << "b33 address: " << blindedKey.ToB33 () << ".b32.i2p" << std::endl;
std::cout << "Today's store hash: " << blindedKey.GetStoreHash ().ToBase64 () << std::endl;
}
else
std::cout << "Invalid signature type " << SigTypeToName (ident->GetSigningKeyType ()) << std::endl;
}
else
std::cout << "Invalid base64 address" << std::endl;
return 0;
}