MCPcopy Create free account
hub / github.com/ElementsProject/elements / DecodeI2PBase64

Function DecodeI2PBase64

src/i2p.cpp:69–78  ·  view source on GitHub ↗

* Decode an I2P-style Base64 string. * @param[in] i2p_b64 I2P-style Base64 string. * @return decoded `i2p_b64` * @throw std::runtime_error if decoding fails */

Source from the content-addressed store, hash-verified

67 * @throw std::runtime_error if decoding fails
68 */
69static Binary DecodeI2PBase64(const std::string& i2p_b64)
70{
71 const std::string& std_b64 = SwapBase64(i2p_b64);
72 bool invalid;
73 Binary decoded = DecodeBase64(std_b64.c_str(), &invalid);
74 if (invalid) {
75 throw std::runtime_error(strprintf("Cannot decode Base64: \"%s\"", i2p_b64));
76 }
77 return decoded;
78}
79
80/**
81 * Derive the .b32.i2p address of an I2P destination (binary).

Callers 2

DestB64ToAddrFunction · 0.85
DestGenerateMethod · 0.85

Calls 2

SwapBase64Function · 0.85
DecodeBase64Function · 0.85

Tested by

no test coverage detected